Commit graph

585 commits

Author SHA1 Message Date
Julien Pivotto 96d5a32659
Update go to 1.19, set min version to 1.18 (#11279)
* Update go to 1.19, set min version to 1.18

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>

* Update golangci-lint

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-09-07 11:30:48 +02:00
Julien Pivotto 15fa34936b
PuppetDB SD: Add __meta_puppetdb_query label (#11238)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-09-01 17:05:54 +02:00
Cosrider bef6556ca5
delete redundant alias (#11180)
Signed-off-by: Cosrider <cosrider7@gmail.com>

Signed-off-by: Cosrider <cosrider7@gmail.com>
2022-08-31 15:50:38 +02:00
Renato Costa d521933053
Fix incorrect use of loop variable in parallel test (#11205)
This fixes an occurrence of a loop variable being captured in a
parallel test (`TestInitialUpdate`). Prior to this commit, only the
last test case declared in that test would actually execute. To work
around this problem, we create a copy of the range variable before the
paralllel test, as suggested in the documentation for the `testing`
package:

https://pkg.go.dev/testing#hdr-Subtests_and_Sub_benchmarks

The test immediately after the one fixed here (`TestInvalidFile`)
followed the same pattern but correctly created a copy of the loop
variable, illustrating how easy it is to forget to do this in
practice.

Issue was automatically found using the `loopvarcapture` linter.

Signed-off-by: Renato Costa <renato@cockroachlabs.com>

Signed-off-by: Renato Costa <renato@cockroachlabs.com>
2022-08-25 12:23:29 +02:00
Karl Piplies 3782cb40d5 add loadbalancerip to service labels
Signed-off-by: Karl Piplies <karl.piplies@mercedes-benz.com>
2022-08-10 12:40:11 +02:00
David Leadbeater d677ec489e
Support using MX records for DNS discovery (#10099)
It's currently possible to use blackbox_exporter to probe MX records
themselves. However it's not possible to do an end-to-end test, like is
possible with SRV records. This makes it possible to use MX records as a
source of hostnames in the same way as SRV records.

Signed-off-by: David Leadbeater <dgl@dgl.cx>
2022-08-03 11:19:26 +02:00
Abirdcfly 465558e93a
fix minor code unreachability error (#11040)
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-08-02 11:21:59 +00:00
Frederic Branczyk 414c3e549c
Merge pull request #11002 from yngwiewang/feature/k8s-service-port-number
feat:(kubernetes_sd): add __meta_kubernetes_service_port_number (#10945)
2022-07-22 16:13:55 +02:00
Robert Fratto 97be65387d discovery/kubernetes: fix broken tests
Signed-off-by: Robert Fratto <robertfratto@gmail.com>
2022-07-18 09:10:12 -04:00
Robert Fratto 823d24d1e9 discovery/kubernetes: add container image as metadata
This commits adds a __meta_kubernetes_pod_container_image as a new
metadata label. This can be used to alert on mismatched versions of
targets who don't have a build_info metric, as well as injecting it into
log lines for other consumers of discovery/kubernetes (e.g., Promtail).

Signed-off-by: Robert Fratto <robertfratto@gmail.com>
2022-07-18 08:35:12 -04:00
yngwiewang 1abbf5a5c5 add __meta_kubernetes_service_port_number (#10945)
Signed-off-by: yngwiewang <yngwiewang@163.com>
2022-07-09 17:04:25 +08:00
Julien Pivotto 466f053a6e nomad: Use failuresCount counter
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-06-30 14:19:58 +02:00
Julien Pivotto d9347bf128 nomad: Fix documentation and comments.
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-06-30 14:19:55 +02:00
Bram Vogelaar 4456dcc26e feat(nomad): add nomad service discovery
Signed-off-by: Bram Vogelaar <bram@attachmentgenie.com>
2022-06-30 14:17:08 +02:00
Filip Petkovski 05da373dcb
kubernetes_sd: Allow attaching node labels for endpoint role
The Kubernetes service discovery can only add node labels to
targets from the pod role.

This commit extends this functionality to the endpoints and
endpointslices roles.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
2022-06-16 12:22:55 +02:00
Sebastian Poxhofer 3f9a9d1e62
chore(discoveryManager): expose Discoverer refresh function (#10531)
Signed-off-by: secustor <sebastian@poxhofer.at>
2022-06-13 21:06:15 +02:00
Julien Pivotto e4a09f2b4b
uyuni: Use default HTTP client and set relative paths (#10814)
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-06-08 11:29:44 +02:00
Filip Petkovski 7a78897d0b
Improve reliability of Kubernetes SD tests (#10761)
The tests for Kubernetes SD rely on comparing target groups by first
serializing them to JSON. However, the target group MarshalJSON function
only serializes the __address__ label, which makes eliminates all other
labels from the comparison.

This commit implements a separate marshaling function intended for use in
Kubernetes SD tests. The function serializes all target labels, making
comparisons much more reliable. The commit also fixes all tests that
started to fail due to the newly introduced change.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
2022-06-07 16:19:40 +01:00
Julien Pivotto 143a760e76
Hetzner SD: Implement set directory (#10813)
Makes path relative to Prometheus config file.

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-06-05 07:54:43 +02:00
Matthieu MOREL f43749e82f
refactor (discovery): move from github.com/pkg/errors to 'errors' and 'fmt' (#10807)
Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>

Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2022-06-03 13:47:14 +02:00
David Leadbeater 57f4aab27d
Update godoc links and remove note about TSDB versioning (#10754)
Signed-off-by: David Leadbeater <dgl@dgl.cx>
2022-05-26 18:34:43 +10:00
Julien Pivotto 1afe72f0af vultr: ram is in mb, not bytes
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-05-24 18:38:06 +02:00
Julien Pivotto c9d4e5fc94 vultr: minor fixups
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-05-24 18:38:06 +02:00
David Dymko 3ef153b00c vultr integration
Signed-off-by: David Dymko <dymkod@gmail.com>
2022-05-24 18:38:06 +02:00
Felix Ehrenpfort ce3bc818a8
Add service discovery for IONOS Cloud (#10514)
* Add service discovery for IONOS Cloud

Signed-off-by: Felix Ehrenpfort <felix@ehrenpfort.de>
2022-05-20 14:57:23 +02:00
TJ Hoplock c40e269c3e
feat: add linode SD failure count metric (#10673)
This commit introduces a new metric to count the number of failed
requests to Linode's API when using Linode SD. Resolves #10672, inspired
by #10476.

_Note_: this doens't count failures when polling the `/account/events`
endpoint, as a `401` there is how we determine if the supplied token has
the needed API scopes to do event polling vs full refreshes each
interval.

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
2022-05-11 16:54:08 +02:00
Matthieu MOREL e2ede285a2
refactor: move from io/ioutil to io and os packages (#10528)
* refactor: move from io/ioutil to io and os packages
* use fs.DirEntry instead of os.FileInfo after os.ReadDir

Signed-off-by: MOREL Matthieu <matthieu.morel@cnp.fr>
2022-04-27 11:24:36 +02:00
David Heap 685493187e
Support numerical labels in PuppetDB service discovery (#10633)
Fixes #10626 where previously only bool and string were supported

Signed-off-by: David Heap <david.heap@tnp.net.uk>
2022-04-26 17:39:33 +05:30
nixargh e76c6aac50 Fix #10507: explicitly include gcp auth from k8s.io to kubernetes discovery
Signed-off-by: nixargh <nixargh@protonmail.com>
2022-04-01 14:56:37 +03:00
David N Perkins ed0c68224e
Azure SD Failure metric and 404 Handling (#10476)
* For Azure sd, added failure counter and skipping of 404's from Nic lookup

Signed-off-by: David N Perkins <David.N.Perkins@ibm.com>
2022-03-31 14:50:17 +02:00
Sylvain Rabot c31a3e4c92
Build with Go 1.18 (#10501)
* Build with Go 1.18
* Update golangci-lint version

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
2022-03-31 00:16:54 +02:00
Julien Pivotto 98039cddfa
Update Prometheus common (#10492)
* Update Prometheus common

- Oauth2 supports proxy URL
- HTTP2 can be disabled

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2022-03-30 12:49:03 +02:00
David N Perkins b13aec9167
Merge pull request #10365 from David-N-Perkins/azure-resource-group-filter
Azure Service Discovery resource group filter
2022-03-29 01:21:23 +02:00
Robert Fratto 44a5e705be
discovery: Expose custom HTTP client options to discoverers (#10462)
* discovery: expose HTTP client options to discoverers

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* discovery/http: use HTTP client options for created client

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* scrape: use a list of HTTP client options instead of just dial context

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* discovery: rephrase comment

Signed-off-by: Robert Fratto <robertfratto@gmail.com>
2022-03-24 18:16:59 -04:00
Furkan 2939966634
Kubernetes SD: Support discovery.k8s.io/v1 EndpointSlice
Fixes #9498

Signed-off-by: Furkan <furkan.turkal@trendyol.com>
Signed-off-by: Erkan Zileli <erkan.zileli@trendyol.com>
Co-authored-by: Batuhan Apaydin <batuhan.apaydin@trendyol.com>
2022-03-19 00:42:16 +03:00
fpetkovski 16bd0d7d5c
Index pods by node name
Signed-off-by: fpetkovski <filip.petkovsky@gmail.com>
2022-03-10 15:34:56 +01:00
fpetkovski fa798d3042
Allow attaching node metadata
Signed-off-by: fpetkovski <filip.petkovsky@gmail.com>
2022-03-10 08:40:52 +01:00
Ujjwal Goyal 9e7ae4d963
Use containers labels instead of task labels from Docker Swarm SD (#9187) (#10311)
* Remove task labels from Docker Swarm SD (#9187)

Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>

Add container labels to Docker Swarm SD (#9187)

Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>

* Reorder labels in configuration doc

Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>
2022-03-08 14:49:20 +01:00
David N Perkins 097b359b41
Added a failure counter to the HTTP service discovery (#10372)
* Added a failure counter to the http service discovery

Signed-off-by: David N Perkins <David.N.Perkins@ibm.com>
2022-03-08 14:10:45 +01:00
Łukasz Mierzwa a4317bf0ec
Run gofumpt on all files (#10392)
* Run gofumpt on all files

Getting golangci-lint errors when building on my laptop, possibly because I have newer version of gofumpt then what it was formatted with.
Run gofumpt -w -extra on all files as it will be needed in the future anyway.

* Update golangci-lint to v1.44.2

v1.44.0 upgraded gofumpt so bumping version in CI will help keep formatting correct for everyone

* Address golangci-lint error

Getting 'error-strings: error strings should not be capitalized or end with punctuation or a newline' from revive here.
Drop new line.

Signed-off-by: Łukasz Mierzwa <l.mierzwa@gmail.com>
2022-03-03 17:21:05 +01:00
cui fliter c9b56d1a49
all: fix some typos (#10389)
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-03-03 12:03:07 +00:00
Chris Marchbanks 3e0a0a5d59
Fix Scaleway test
The upgraded client adds order=creation_date_desc to the query
parameters causing the tests to fail. Instead of checking the full URI,
just check that the path is correct.

Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
2022-02-22 12:18:43 -07:00
David N Perkins fcb6f18122
Uyuni login less often (#10072)
* Initial implementation of caching the uyuni login token

Signed-off-by: David N Perkins <David.N.Perkins@ibm.com>
2022-02-15 16:38:38 +01:00
Julien Pivotto 9a2e93228e
Switch to grafana/regexp everywhere (#10268)
Let's have a consistent library for regexp.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2022-02-13 00:58:27 +01:00
Julien Pivotto b0d70557b7
Merge pull request #10285 from prometheus/release-2.33 2022-02-12 00:02:24 +01:00
Julien Pivotto 002ceb7232 Fix panic in Azure SD when no public interface is set.
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2022-02-11 21:25:45 +01:00
johncming 37c6ef9661
discovery/digitalocean: make do api be aware of discovery context. (#10281)
Signed-off-by: johncming <johncming@yahoo.com>
2022-02-11 09:23:51 +01:00
Levi Harrison 1b3443ede1
Azure: Fix panic when IP Address isn't set (#10280) 2022-02-11 00:31:18 +01:00
Björn Rabenstein 5851557a28
Merge pull request #10250 from prometheus/beorn7/cleaning-up-cherrypicking-fallout
Merge release-2.33 forward into main
2022-02-02 17:22:18 +01:00
Robert Fratto 516579a97e
discovery/targetgroup: support marshaling to JSON (#10229)
* discovery/targetgroup: support marshaling to JSON

targetgroup.Group is able to be marshaled to and from YAML, but not with
JSON. JSON is used for the http_sd API representation, so users
implementing the API were required to implement their own type which is
expected by the JSON unmarshaler.

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* fix lint error

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* Update discovery/targetgroup/targetgroup.go

Co-authored-by: Julius Volz <julius.volz@gmail.com>
Signed-off-by: Robert Fratto <robertfratto@gmail.com>

* s/Json/JSON

Signed-off-by: Robert Fratto <robertfratto@gmail.com>

Co-authored-by: Julius Volz <julius.volz@gmail.com>
2022-02-02 17:20:18 +01:00