Commit Graph

593 Commits

Author SHA1 Message Date
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
Julien Pivotto 9621c2c0cc
Fix race with targets update during ApplyConfig (#9656)
I ended up extending the lock so refTargets remains valid for the
duration of the update.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-11-05 01:13:04 +01:00
Mateusz Gozdek ea924746b3
discovery/kubernetes: improve test logic for waiting for discoverers (#9584)
When running tests in parallel, 10 milliseconds may not be enough for
all discoverers to register, which will make test flaky.

This commit changes the waiting logic to wait for number of discoverers
to stop increasing during given time frame, which should be large enough
for single discoverer to register in test environment.

A following run passes with this commit:

go test -failfast -race -count 100 -v ./discovery/kubernetes/

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
2021-11-02 22:17:32 +01:00
Mateusz Gozdek b7bdf6fab2 Fix imports formatting
According to
2829908806 (r58457095).

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
2021-11-02 19:52:34 +01:00
Mateusz Gozdek 1a6c2283a3 Format Go source files using 'gofumpt -w -s -extra'
Part of #9557

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
2021-11-02 19:52:34 +01:00
lzhfromustc d42be7be76
test:Fix two potential goroutine leaks (#8964)
Signed-off-by: lzhfromustc <lzhfromustc@gmail.com>
2021-10-29 15:44:32 -07:00
Julien Pivotto 73255e15f6 Address golint failures from revive
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-10-23 00:53:11 +02:00
Levi Harrison 89a6ebd799
Add common HTTP client to Azure SD (#9267)
* Add `proxy_url` option to Azure SD

Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-10-20 23:09:58 +02:00
Vladimir Kononov 1043d2b594
Discovery: abstain from restarting providers if possible (#9321) (#9349)
* Abstain from restarting discovery providers if possible (#9321)

Signed-off-by: Vladimir Kononov <krya-kryak@users.noreply.github.com>
2021-10-20 10:16:20 +02:00
Julien Pivotto 432005826d
Add a feature flag to enable the new discovery manager (#9537)
* Add a feature flag to enable the new manager

This PR creates a copy of the legacy manager and uses it by default.

It is a companion PR to #9349. With this PR, users can enable the new
discovery manager and provide us with any feedback / side effects that
the new behaviour might have.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-10-20 10:15:54 +02:00
Julien Pivotto 68bc92b520
uyuni: small fixes for comments (#9538)
* uyuni: small fixes for comments

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-10-19 23:38:44 +02:00
Julien Pivotto 2a574bf8c2
Uyuni: enable HTTP2 again (#9539)
PR #9398 re-introduced HTTP2 in Prometheus. Uyuni SD can use the client
without disabling it.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-10-19 21:26:39 +02:00
Witek Bedyk cda2dbbef6
Add Uyuni service discovery (#8190)
* Add Uyuni service discovery

Signed-off-by: Witek Bedyk <witold.bedyk@suse.com>

Co-authored-by: Joao Cavalheiro <jcavalheiro@suse.de>
Co-authored-by: Marcelo Chiaradia <mchiaradia@suse.com>
Co-authored-by: Stefano Torresi <stefano@torresi.io>
Co-authored-by: Julien Pivotto <roidelapluie@gmail.com>
2021-10-19 01:00:44 +02:00
akatsadimas ee77a6212f discovery/kubernetes: issue overcapacity warning for endpoint rather than endpointslice
Signed-off-by: akatsadimas <nkatsadim@gmail.com>
2021-10-08 23:17:04 +03:00
akatsadimas dd2e666a8d discovery/kubernetes: Warn user in case of endpoint over-capacity
Signed-off-by: akatsadimas <nkatsadim@gmail.com>
2021-10-07 00:01:46 +03:00
Julien Pivotto 63b3e4e5ec
Enable HTTP2 again (#9398)
We are re-enabling HTTP 2 again. There has been a few bugfixes upstream
in go, and we have also enabled ReadIdleTimeout.

Fix #7588
Fix #9068

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-09-26 23:16:12 +02:00
Julien Pivotto 1681a8d539
Azure: Fix panic when no computername is set (#9387)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-09-25 00:30:18 +02:00
Julien Pivotto 8920024323 Add PuppetDB service discovery
We have been Puppet user for 10 years and we are users of
https://github.com/camptocamp/prometheus-puppetdb-sd

However, that file_sd implementation contains business logic and
assumptions around e.g. the modules which you are using.

This pull request adds a simple PuppetDB service discovery, which will
enable more use cases than the upstream sd.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-09-16 16:54:26 +02:00
Julien Pivotto b1bdde46c3 kubernetes ingress: adjust comment style
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-08-30 22:34:24 +02:00
Philip Gough 0af7250c52 discovery:kube: Support wildcard matching for ingress rules
This change sets the scheme to https when a rule specified by Ingress
matches a wildcard DNS entry in the ingress TLS hosts

Signed-off-by: Philip Gough <philip.p.gough@gmail.com>
2021-08-26 14:32:11 +01:00
Takashi Kusumi 3ab8559d1c Kubernetes SD: Fix golint issue
Signed-off-by: Takashi Kusumi <tkusumi@zlab.co.jp>
2021-08-24 17:30:33 +09:00
Takashi Kusumi 40981c422b Kubernetes SD: Introduce ingressAdaptor
Signed-off-by: Takashi Kusumi <tkusumi@zlab.co.jp>
2021-08-20 17:06:17 +09:00
Takashi Kusumi 6634a570cf Kubernetes SD: Support networking.k8s.io/v1 Ingress
Signed-off-by: Takashi Kusumi <tkusumi@zlab.co.jp>
2021-08-16 08:35:42 +09:00
Julien Pivotto cab96a06ef
Merge release 2.29 in main (#9196)
* 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-BUG

Fixed #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>
2021-08-12 18:38:06 +02:00
Austin Cawley-Edwards 5df37892aa
Fix `kuma_sd` targetgroup reporting (#9157)
* Bundle all xDS targets into a single group

Signed-off-by: austin ce <austin.cawley@gmail.com>
2021-08-06 01:29:15 +02:00
TJ Hoplock 7baf084092
optimize Linode SD by polling for event changes during refresh (#8980)
* optimize Linode SD by polling for event changes during refresh

Most accounts are fairly "static", in the sense that they're not cycling
through instances constantly. So rather than do a full refresh every
interval and potentially make several behind-the-scenes paginated API
calls, this will now poll the `/account/events/` endpoint every minute
with a list of events that we care about. If a matching event is found,
we then do a full refresh.

Co-authored-by: William Smith <wsmith@linode.com>
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
Signed-off-by: William Smith <wsmith@linode.com>
2021-08-04 12:05:49 +02:00
Julien Pivotto 03bee3b5df
Merge pull request #9125 from LeviHarrison/docker_sd-host-networking
docker_sd: Support host network mode
2021-08-04 01:14:39 +02:00
Levi Harrison c1b1b826ce HostNetworkHost -> HostNetworkingHost
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-08-03 05:58:49 -06:00
Julien Pivotto 24165adadc
Merge pull request #9112 from darshanime/add_computer_name
Add computer name to azure sd
2021-07-30 09:58:49 +02:00
Frederic Branczyk a266d4d2c5
Update Go dependencies
Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
2021-07-29 09:11:04 +02:00
darshanime 898afa2fd9 Add nil checks
Signed-off-by: darshanime <deathbullet@gmail.com>
2021-07-28 19:23:17 +05:30
jinglina ed24e51e7c
remove redundant type conversion (#9126)
Signed-off-by: jinglina <jinglinax@163.com>
2021-07-28 13:33:46 +05:30
Levi Harrison 89f154d643 Added tests
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-07-27 23:33:28 -04:00
Levi Harrison 41be43647b
Implemented host_network_host setting
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-07-27 23:20:04 -04:00
Julien Pivotto dcba645366
Merge pull request #8978 from jfreeland/feat/additional-gce-interfaces
feat: explicit gce interface ipv4 address metadata
2021-07-26 19:38:59 +02:00
darshanime c8a2ffdb72 Add computer name to azure sd
Signed-off-by: darshanime <deathbullet@gmail.com>
2021-07-25 22:07:44 +05:30
Julien Pivotto 79d354ad2e
Merge pull request #8844 from austince/feat/discovery-xds
Add base xDS REST SD and kuma_sd implementation
2021-07-23 09:46:36 +02:00
George Brighton bc0e76c8a3
Add AZ ID label to discovered EC2 targets (#8896)
* Add AZ ID to EC2 SD

Signed-off-by: George Brighton <george@gebn.co.uk>
2021-07-23 09:42:03 +02:00
austin ce 0544bdd6af
Add tests for xDS discovery
Signed-off-by: austin ce <austin.cawley@gmail.com>
2021-07-21 12:55:02 -04:00
austin ce d0ffe2ed3e
Add base xDS discovery and kuma SD implementation
Signed-off-by: austin ce <austin.cawley@gmail.com>
2021-07-21 12:55:02 -04:00
Joey Freeland 5d0a12855b Update discovery/gce/gce.go
Co-authored-by: Julien Pivotto <roidelapluie@gmail.com>
Signed-off-by: Joey Freeland <joey@free.land>
2021-07-06 07:57:29 -04:00
Lukas Kämmerling 263847e64a
hcloud discovery: Add new labelpresent label (#9028)
* Add new labelpresent label

Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2021-07-03 01:51:50 +02:00
Julius Volz 179b2155d1
Fix: Use json.Unmarshal() instead of json.Decoder (#9033)
* Fix: Use json.Unmarshal() instead of json.Decoder

See https://ahmet.im/blog/golang-json-decoder-pitfalls/

json.Decoder is for JSON streams, not single JSON objects / bodies.

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Revert modifications to targetgroup parsing

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-07-02 09:38:14 +01:00
Julius Volz 441e6cd7d6
Merge release-2.28 back into main (#9035)
* Cut v2.28.0-rc.0 (#8954)

* Cut v2.28.0-rc.0

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Changelog fixup

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Address review comments

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Downgrade some features to enhancements

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Adjust release date to today

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Migrate HTTP SD docs from docs repo (#8972)

See discussion in https://github.com/prometheus/docs/pull/1975

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Cut Prometheus v2.28.0 (#8973)

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* HTTP SD: Allow charset in content type (#8981)

* Added content type regex

Signed-off-by: Levi Harrison <git@leviharrison.dev>
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* fixed disappeared target groups in http_sd #9019

Signed-off-by: servak <fservak@gmail.com>

* Add a testcase for http-sd

Signed-off-by: servak <fservak@gmail.com>

* HTTP SD: Simplify logic of disappeared targetgroups (#9026)

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

* Fix logging after the move to go-kit/log (#9021)

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

* Cut Prometheus v2.28.1 (#9034)

Signed-off-by: Julius Volz <julius.volz@gmail.com>

Co-authored-by: Levi Harrison <git@leviharrison.dev>
Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu>
Co-authored-by: servak <fservak@gmail.com>
2021-07-01 18:02:13 +02:00
Joey Freeland 8017dd7242 chore: always append interface ipv4 with api interface name
Signed-off-by: Joey Freeland <joey@free.land>
2021-06-29 09:01:34 -07:00
Levi Harrison 78d5a6d083
HTTP SD: Allow charset in content type (#8981)
* Added content type regex

Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-06-28 08:46:53 +02:00
Ben Kochie 7cb55d5732
Merge pull request #8802 from mwasilew2/yaml-linting
Adds yamllinting to Makefile.common
2021-06-24 15:59:35 +02:00
Julien Pivotto d8219f29f4
Merge pull request #8983 from roidelapluie/httpsdtests
HTTP SD: Add tests
2021-06-23 12:29:27 +02:00
Julien Pivotto 1deac8f570 HTTP SD: Add tests
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-06-23 09:40:50 +02:00
Joey Freeland 77e25cf2e5 feat: gce metadata for additional interfaces
Signed-off-by: Joey Freeland <joey@free.land>
2021-06-21 21:37:04 -07:00
Julius Volz 8d98750e8f
Simplify float formatting for HTTP SD refresh interval (#8961)
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-06-18 11:49:30 +02:00
Levi Harrison 4a4882d4c7 Replace godoc.org links
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-06-17 07:18:51 -04:00
3Xpl0it3r a0bac4b488
add kubeconfig support in discovery module (#8811)
Signed-off-by: 3Xpl0it3r <shouc.wang@hotmail.com>
2021-06-17 12:41:50 +02:00
Frederic Branczyk 039b651450
Merge pull request #8916 from Evesy/main
Add class label to kubernetes ingress discovery
2021-06-14 13:40:08 +02:00
Michal Wasilewski 3f686cad8b
fixes yamllint errors
Signed-off-by: Michal Wasilewski <mwasilewski@gmx.com>
2021-06-12 12:47:47 +02:00
Levi Harrison faed8df31d
Enable reading consul token from file (#8926)
* Adopted common http client

Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-06-12 00:06:59 +02:00
Levi Harrison bf1ef2e0f4
Changed log package
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-06-11 15:23:58 -04:00
Julien Pivotto c0c22ed042
Merge pull request #8927 from LeviHarrison/move-to-go-kit/log
Migrate From `go-kit/kit/log` to `go-kit/log`
2021-06-11 21:15:56 +02:00
Levi Harrison b5f6f8fb36 Switched to go-kit/log
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-06-11 12:28:36 -04:00
Julien Pivotto 9444698ae2
http_sd (#8839)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-06-11 18:04:45 +02:00
Mike Eves ae081886fa Fix up tests
Signed-off-by: Mike Eves <michael.eves@autotrader.co.uk>
2021-06-11 15:49:13 +01:00
Mike Eves 7941b350ba Don't set label if ingressClassName is not set
Signed-off-by: Mike Eves <michael.eves@autotrader.co.uk>
2021-06-11 15:14:23 +01:00
Mike Eves 7e1111ff14 Update label from `class` to `class_name`
Signed-off-by: Mike Eves <michael.eves@autotrader.co.uk>
2021-06-11 13:45:41 +01:00
Austin Cawley-Edwards 301815e48b
Update prometheus-common and the consul HTTP client (#8913)
* Update to prometheus-common@v0.29.0

Signed-off-by: austin ce <austin.cawley@gmail.com>
2021-06-11 14:24:41 +02:00
Mike Eves 7e65ad3e43 Add class label to kubernetes ingress discovery
Signed-off-by: Mike Eves <michael.eves@autotrader.co.uk>
2021-06-11 11:27:15 +01:00
Frederic Hemberger 39a87fd9d2 consul_sd: Add namespace support for Consul Enterprise
Signed-off-by: Frederic Hemberger <mail@frederic-hemberger.de>
2021-06-09 16:35:02 +02:00
songjiayang b781b5cac5
Refactor file discovery init function (#8891)
* Refactor file discovery init function

Combine to one init function like other discovery.

Signed-off-by: songjiayang <songjiayang1@gmail.com>
2021-06-04 14:43:24 +02:00
TJ Hoplock dc22c65349
Add Linode Service Discovery (#8846)
* Add Linode Service Discovery

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
2021-06-01 20:32:36 +02:00
kongxs 632678a461
Fix spelling mistake (#8879)
* Fix spelling mistake

Signed-off-by: kjinan <2008kongxiangsheng@163.com>

* Update discovery/kubernetes/endpoints.go

Co-authored-by: Julien Pivotto <roidelapluie@gmail.com>
Signed-off-by: kjinan <2008kongxiangsheng@163.com>

Co-authored-by: Julien Pivotto <roidelapluie@gmail.com>
2021-06-01 00:49:29 +02:00
kcx2366425574 17e230a6f2 fix actuel to actual
Signed-off-by: kcx2366425574 <18279911430@163.com>
2021-05-31 15:40:05 +08:00
Julien Pivotto e1774b6f83 Fix the computation of prometheus_sd_discovered_targets
prometheus_sd_discovered_targets is wrongly calculated when there are
multiple SD configurations in place. One discovery manager can have
multiple groups coming from multiple service discoveries.

When multiple service discovery configs are used, we do not compute the
metric correctly, and instead just set the metric to one of the service
discoveries.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-05-14 22:38:37 +02:00
Julien Pivotto 2a4b8e12bb
Merge pull request #8766 from Nick-Triller/consul-sd-always-send-targetgroups
Send empty targetgroup if nothing discovered [consul_sd]
2021-04-30 10:27:41 +02:00
Hu Shuai 9d7d818629
Fix golint issues caused by typos (#8769)
Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
2021-04-29 10:05:33 +02:00