* discovery: add aws/ec2 unit tests
* discovery: initial skeleton for aws/ec2 unit tests
This is a - very likely - not too useful unit test for the AWS SD. It is
commited so other people can check the basic logic and the
implementation.
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: fix linter complains about ec2_test.go
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: add basic unit test for aws
This tests only the basic labelling, not including the VPC related
information.
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: fix linter complains about ec2_test.go
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: other linter fixes in aws/ec2_test.go
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: implement remaining tests for aws/ec2
The coverage is not 100% but I think it is a good starting point if
someone wants to improve that.
Currently it covers all the AWS API calls.
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: make linter happy in aws/ec2_test.go
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: make utility funtcions private
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discover: no global variable in the aws/ec2 test
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: common body for some tests in ec2
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: try to make golangci-lint happy
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: make every non-test function private
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: test for errors first in TestRefresh
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: move refresh tests into the function
This way people can find both the test cases and the execution of the
test at the same place.
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: fix copyright date
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: remove misleading comment
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: rename test for easier identification
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: use static values for the test cases
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discover: try to make the linter happy
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: drop redundant data from ec2 and use common ptr functions
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: use Error instead of Equal
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
* discovery: merge refreshAZIDs tests into one
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
---------
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
For: #14355
This commit updates Prometheus to adopt stdlib's log/slog package in
favor of go-kit/log. As part of converting to use slog, several other
related changes are required to get prometheus working, including:
- removed unused logging util func `RateLimit()`
- forward ported the util/logging/Deduper logging by implementing a small custom slog.Handler that does the deduping before chaining log calls to the underlying real slog.Logger
- move some of the json file logging functionality to use prom/common package functionality
- refactored some of the new json file logging for scraping
- changes to promql.QueryLogger interface to swap out logging methods for relevant slog sugar wrappers
- updated lots of tests that used/replicated custom logging functionality, attempting to keep the logical goal of the tests consistent after the transition
- added a healthy amount of `if logger == nil { $makeLogger }` type conditional checks amongst various functions where none were provided -- old code that used the go-kit/log.Logger interface had several places where there were nil references when trying to use functions like `With()` to add keyvals on the new *slog.Logger type
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
* discovery: aws: expose Primary IPv6 addresses as label
Add __meta_ec2_primary_ipv6_addresses label. This label contains the
Primary IPv6 address for every ENI attached to the EC2 instance. It is
ordered by the DeviceIndex and the missing elements (interface without
Primary IPv6 address) are kept in the list.
---------
Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
Co-authored-by: Ayoub Mrini <ayoubmrini424@gmail.com>
SD Managers take over responsibility for SD metrics registration
---------
Signed-off-by: Paulin Todev <paulin.todev@gmail.com>
Signed-off-by: Björn Rabenstein <github@rabenste.in>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
We haven't updated golint-ci in our CI yet, but this commit prepares
for that.
There are a lot of new warnings, and it is mostly because the "revive"
linter got updated. I agree with most of the new warnings, mostly
around not naming unused function parameters (although it is justified
in some cases for documentation purposes – while things like mocks are
a good example where not naming the parameter is clearer).
I'm pretty upset about the "empty block" warning to include `for`
loops. It's such a common pattern to do something in the head of the
`for` loop and then have an empty block. There is still an open issue
about this: https://github.com/mgechev/revive/issues/810 I have
disabled "revive" altogether in files where empty blocks are used
excessively, and I have made the effort to add individual
`// nolint:revive` where empty blocks are used just once or twice.
It's borderline noisy, though, but let's go with it for now.
I should mention that none of the "empty block" warnings for `for`
loop bodies were legitimate.
Signed-off-by: beorn7 <beorn@grafana.com>
* Common client in EC2 and Lightsail
Signed-off-by: Levi Harrison <git@leviharrison.dev>
* Azure -> AWS
Signed-off-by: Levi Harrison <git@leviharrison.dev>
Signed-off-by: Levi Harrison <git@leviharrison.dev>
* PromQL: Fix start and end keywords masking label and metric names
This commit fixes an issue with the "at modifier" that introduced two
new keywords: `start` and `end`. In grouping options and in metric
names, these keywords took precedence over metric or label names, so
that those metrics and labels could no longer be referenced.
Signed-off-by: Clayton Peters <clayton.peters@man.com>
* Add in additional tests for metrics and/or labels called start/end.
Signed-off-by: Clayton Peters <clayton.peters@man.com>
* *: Cut 2.29.0-rc.0
Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
* VERSION: bump to 2.29.0-rc.0
Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
* Remove experimental wording on size-based retention
Followup of #9004
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
* Fix PR reference in changelog
Signed-off-by: George Brighton <george@gebn.co.uk>
* Describe EC2 availability zone IDs at most once per refresh (#9142)
Signed-off-by: George Brighton <george@gebn.co.uk>
* Describe EC2 availability zones at most once per SD load
Closes#9142.
Signed-off-by: George Brighton <george@gebn.co.uk>
* Incorporate feedback
Signed-off-by: George Brighton <george@gebn.co.uk>
* Integrate feedback
Signed-off-by: George Brighton <george@gebn.co.uk>
* Add a compatibility note for macOS users.
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
* *: Cut v2.29.0-rc.1
Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
* Fix `kuma_sd` targetgroup reporting (#9157)
* Bundle all xDS targets into a single group
Signed-off-by: austin ce <austin.cawley@gmail.com>
* *: cut v2.29.0-rc.2
Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
* Rename links
Signed-off-by: Levi Harrison <git@leviharrison.dev>
* bump codemirror-promql to 0.17.0
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
* *: cut v2.29.0
Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
* tsdb: align atomically accessed int64 (#9192)
This prevents a panic in 32-bit archs:
https://pkg.go.dev/sync/atomic#pkg-note-BUGFixed#9190
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
* Release 2.29.1 (#9193)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
Co-authored-by: Clayton Peters <clayton.peters@man.com>
Co-authored-by: Frederic Branczyk <fbranczyk@gmail.com>
Co-authored-by: George Brighton <george@gebn.co.uk>
Co-authored-by: Austin Cawley-Edwards <austin.cawley@gmail.com>
Co-authored-by: Levi Harrison <git@leviharrison.dev>
Co-authored-by: Augustin Husson <husson.augustin@gmail.com>