Commit graph

565 commits

Author SHA1 Message Date
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
beorn7 35010daa90 Merge branch 'release-2.33' into beorn7/cleaning-up-cherrypicking-fallout 2022-02-02 16:49:40 +01:00
Julien Pivotto 9d63502204 k8s: improve 'own_namespace'
Fail configuration unmarshalling if kubeconfig or api url are set with
"own namespace"

Only read namespace file if needed.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2022-02-01 14:59:09 +01:00
Georg Gadinger c85efa02d9 Fix k8s target discovery when not running inside k8s
When using Kubernetes service discovery on a Prometheus instance that's
not running inside Kubernetes, the creation of the service discovery
fails with a "no such file or directory" error as the special
`/var/run/secrets/kubernetes.io/serviceaccount/namespace` file is not
there.  This commit moves the code that reads this file into the
if-branch where no `APIServer.URL` is given (that one basically makes
Prometheus assume it is running inside of a Kubernetes cluster).

Signed-off-by: Georg Gadinger <nilsding@nilsding.org>
2022-02-01 14:41:25 +01:00
Georg Gadinger 4663f814d6 Fix k8s target discovery when not running inside k8s
When using Kubernetes service discovery on a Prometheus instance that's
not running inside Kubernetes, the creation of the service discovery
fails with a "no such file or directory" error as the special
`/var/run/secrets/kubernetes.io/serviceaccount/namespace` file is not
there.  This commit moves the code that reads this file into the
if-branch where no `APIServer.URL` is given (that one basically makes
Prometheus assume it is running inside of a Kubernetes cluster).

Signed-off-by: Georg Gadinger <nilsding@nilsding.org>
2022-02-01 10:20:03 +01:00
Julien Pivotto 18d737de3e
Azure SD: Set Prometheus user agent (#10209)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2022-01-28 13:36:04 +01:00
Eng Zer Jun 3e67654d37
refactor: use T.TempDir() and B.TempDir to create temporary directory
The directory created by `T.TempDir()` and `B.TempDir()` is
automatically removed when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Reference: https://pkg.go.dev/testing#B.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-01-22 18:57:30 +08:00
Shihao Xia d26fd5c97b
fix potential goroutine leaks (#10057)
Signed-off-by: Shihao Xia <charlesxsh@hotmail.com>
2022-01-05 16:21:06 +05:30
fpetkovski de87515b24 Implement target discovery in own k8s namespace
This commit adds support for discovering targets from the same
Kubernetes namespace as the Prometheus pod itself. Own-namespace
discovery can be indicated by using "." as the namespace.

Fixes #9782

Signed-off-by: fpetkovski <filip.petkovsky@gmail.com>
2021-12-14 13:41:38 +01:00
Ed Schouten a3e9628e0c
Kubernetes service discovery: add provider ID label (#9603)
When using Kubernetes on cloud providers, nodes will have the
spec.providerID field populated to contain the cloud provider specific
name of the EC2/GCE/...  instance.

Let's expose this information as an additional label, so that it's
easier to annotate metrics and alerts to contain the cloud provider
specific name of the instance to which it pertains.

Signed-off-by: Ed Schouten <eschouten@apple.com>
2021-12-06 22:27:11 +01:00
Witek Bedyk 14986e52cf
Fix Uyuni SD initialization (#9924)
* Fix Uyuni SD initialization

The change prevents null pointer exception during SD initialization.

Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>
2021-12-04 21:14:47 +01:00
Augustin Husson d140df2335
replace gopkg.in/fsnotify/fsnotify.v1 by github.com/fsnotify/fsnotify (#9781)
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
2021-11-17 13:07:14 +01:00
Dieter Plaetinck 0fac9bb859
Add basic initial developer docs for TSDB (#9451)
* Add basic initial developer docs for TSDB

There's a decent amount of content already out there (blog posts,
conference talks, etc), but:
* when they get stale, they don't tend to get updated
* they still leave me with questions that I'ld like to answer
  for developers (like me) who want to use, or work with, TSDB

What I propose is developer docs inside the prometheus
repository.  Easy to find and harness the power of the community
to expand it and keep it up to date.

* perfect is the enemy of good.  Let's have a base and incrementally improve
* Markdown docs should be broad but not too deep.  Source code comments
  can complement them, and are the ideal place for implementation details.

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* use example code that works out of the box

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* Apply suggestions from code review

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* PR feedback

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* more docs

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* PR feedback

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* Apply suggestions from code review

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Apply suggestions from code review

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>

* feedback

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* Update tsdb/docs/usage.md

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>

* final tweaks

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* workaround docs versioning issue

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* Move example code to real executable, testable example.

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* cleanup example test and make sure it always reproduces

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* obtain temp dir in a way that works with older Go versions

Signed-off-by: Dieter Plaetinck <dieter@grafana.com>

* Fix Ganesh's comments

Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com>

Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com>
2021-11-17 15:51:27 +05:30
TJ Hoplock 377bdffdbe
feat: tune api requrest page sizes in linode SD (#9779) 2021-11-16 18:02:27 -05:00
TJ Hoplock e3d0333a3b
fix: linode SD tests (#9773)
* build(deps): bump github.com/linode/linodego from 1.1.0 to 1.2.1
* fix: linode SD tests

This fixes failing builds due to the version bump of linodego to
`v1.2.1`.

Fixes:
https://github.com/prometheus/prometheus/pull/9763

See also:
https://github.com/linode/linodego/issues/226
https://github.com/linode/linodego/pull/227
https://github.com/linode/linodego/releases/tag/v1.2.1

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
2021-11-16 23:42:30 +01:00
Mateusz Gozdek 0bfef847b0 discovery/consul: fix leaking goroutine from test
Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
2021-11-10 09:40:43 +01:00
Mateusz Gozdek 4ef8c7c1d8 discovery/xds: make each test use separate HTTP resource config
So tests can run in parallel without races.

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
2021-11-10 09:40:43 +01:00
Mateusz Gozdek fedcb8999b discovery/marathon: make test use separate instances of config
So tests can be executed in parallel without producing races.

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
2021-11-10 09:40:43 +01:00
beorn7 a1e595edac Fix two trivial lint warnings
Not sure why those show up for me locally but not if run by the CI.

Signed-off-by: beorn7 <beorn@grafana.com>
2021-11-08 22:32:13 +01:00
Conor Evans c28b9a0574
Add datacenter to Consul service discovery logs (#9668)
* add datacenter to consul service discovery logs

Signed-off-by: Conor Evans <coevans@tcd.ie>
2021-11-08 09:34:21 +01:00
Julien Pivotto b9c814fce6
Merge pull request #9681 from prometheus/release-2.31
merge back release 2.31
2021-11-05 21:21:04 +01:00