Commit graph

421 commits

Author SHA1 Message Date
Alfred Krohmer fc8004eeec
EC2 SD: fix error handling of NewSessionWithOptions (#8356)
Last change in 4efca5a introduced a problem where NewDiscovery would
just return a nil value, which is not handled well and didn't allow for
fixing configuration issues at runtime without a reload.

Signed-off-by: Alfred Krohmer <alfred.krohmer@logmein.com>
2021-01-26 11:27:30 +00:00
Björn Rabenstein 997bb7134f
Merge pull request #8338 from prometheus/release-2.24
Merge release back (or forward?) into master.
2021-01-04 18:13:09 +01:00
Frederic Branczyk 19b0ec3baf
Merge pull request #8273 from fcddk/fcddk-k8s-enpoints-label
K8s SD: add endpoints labels metadata
2021-01-04 17:25:27 +01:00
Matt Berther 31e86ed4bc prevent adding empty target when CNAME is encountered
Signed-off-by: Matt Berther <mattberther@users.noreply.github.com>
2021-01-04 15:51:41 +01:00
Frederic Branczyk 611fa967cd
Merge pull request #8285 from ashumkin/label-selector
discovery/kubernetes: Fix valid label selector causing config error
2020-12-28 16:00:06 +01:00
Alfred Krohmer 4efca5ab70
EC2 service discovery: reuse EC2 client instead of recreating it every time (#8311)
This also caches credentials that are obtained e.g. via IRSA on AWS EKS.
Previously, every refresh cycle would request the credentials again.

Signed-off-by: Alfred Krohmer <alfred.krohmer@logmein.com>
2020-12-22 15:47:44 +00:00
fcddk b270a1d6bf import strutil package
import strutil package

Signed-off-by: root <likerj@inspur.com>
2020-12-16 16:27:03 +08:00
fcddk 617c56f55a add endponits labels metadata
add endponits labels metadata

Signed-off-by: root <likerj@inspur.com>
2020-12-16 16:07:49 +08:00
Alexey Shumkin 73ddf603af
discovery/kubernetes: Fix valid label selector causing config error
Label selector can be
"set-based"(https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#set-based-requirement)
but such a selector causes Prometheus start failure with the "unexpected
error: parsing YAML file ...: invalid selector: 'foo in (bar,baz)';
can't understand 'baz)'"-like error.

This is caused by the `fields.ParseSelector(string)` function that
simply splits an expression as a CSV-list, so a comma confuses such a
parsing method and lead to the error.

Use `labels.Parse(string)` to use a valid lexer to parse a selector
expression.

Closes #8284.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
2020-12-16 10:56:01 +03:00
Matt Berther acee998df6
CNAME responses can occur with "Type: A" dns_sd_config requests (#8216)
Signed-off-by: Matt Berther <mattberther@users.noreply.github.com>
2020-12-01 09:32:15 +00:00
Muhammad Falak R Wani 587fd740be
discovery: ec2: expose IPv6 as label (#7086)
* discovery: ec2: expose IPv6 as label

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
2020-11-20 17:13:52 +00:00
Julien Pivotto f8ba0ed906
Rebase docker swarm test (#8163)
Fix master tests

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-11-09 18:08:08 +05:30
Julien Pivotto 3509647462
Docker swarm: add filtering of services (#8074)
* Docker swarm: add filtering of services

Add filters on all docker swarm roles (nodes, tasks and services).

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-11-09 12:41:02 +01:00
Julien Pivotto 6c56a1faaa
Testify: move to require (#8122)
* Testify: move to require

Moving testify to require to fail tests early in case of errors.

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

* More moves

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-29 09:43:23 +00:00
Julien Pivotto 1282d1b39c
Refactor test assertions (#8110)
* Refactor test assertions

This pull request gets rid of assert.True where possible to use
fine-grained assertions.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-27 11:06:53 +01:00
Julien Pivotto 4e5b1722b3
Move away from testutil, refactor imports (#8087)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-22 11:00:08 +02:00
Viren Negi 8dbfa14607
Add UserAgent to Hetzner Robot SD (#8008)
Fix #8003

Signed-off-by: Viren Negi <meetme2meat@gmail.com>
2020-10-05 13:34:41 +02:00
Viren Negi d253251266
Add UserAgent header to Eureka client (#8006)
Signed-off-by: Viren Negi <meetme2meat@gmail.com>
2020-10-02 21:09:56 +02:00
Julien Pivotto 184a871638
Eureka: Fix service discovery when compiled in 32-bit (#7961)
Java timestamps are causing issues when unmarshalling with a 32 bit
prometheus. It appears that we do not use those fields, so let's remove
them.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-09-22 17:53:26 +02:00
Lukas Kämmerling c49d8680ce
Fix Hetzner Robot SD decoding with non HTTP 2xx (#7872)
* Fix Hetzner Robot SD trying to decode response when a non 2xx HTTP code was returned

Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2020-08-31 13:24:39 +02:00
kangwoo 7c0d5ae4e7
Add Eureka Service Discovery (#3369)
Signed-off-by: kangwoo <kangwoo@gmail.com>
2020-08-26 17:36:59 +02:00
johncming a5beb627ff
some fixies for consul sd. (#7799)
* discovery/consul: make duration more accurate.

Signed-off-by: johncming <johncming@yahoo.com>

* discovery/consul: fix bug when context done.

Signed-off-by: johncming <johncming@yahoo.com>
2020-08-25 15:46:14 +02:00
Lukas Kämmerling b6955bf1ca
Add hetzner service discovery (#7822)
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
2020-08-21 15:49:19 +02:00
Andy Bursavich 4e6a94a27d
Invert service discovery dependencies (#7701)
This also fixes a bug in query_log_file, which now is relative to the config file like all other paths.

Signed-off-by: Andy Bursavich <abursavich@gmail.com>
2020-08-20 13:48:26 +01:00
Frederic Branczyk 06e2c2f804
Merge pull request #6838 from brancz/endpointslice
discovery/kubernetes: EndpointSlice discovery
2020-08-12 16:42:49 +02:00
Julien Pivotto 9da53391d1
Merge pull request #7739 from prometheus/release-2.20
Merge release-2.20 into the main branch after Consul fix
2020-08-04 20:15:43 +02:00
johncming 01d096567b
discovery: simplify code. (#7725)
Signed-off-by: johncming <johncming@yahoo.com>
2020-08-03 10:29:59 +01:00
Julien Pivotto 3a7120bc07 Consul: Reduce WatchTimeout to 2m and set it as timeout for requests
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-08-03 00:42:55 +02:00
johncming 3c5ff27959
Update http header User-Agent in k8s and swarm discovery. (#7614)
* discovery: update k8s and swarm user agent.

Signed-off-by: johncming <johncming@yahoo.com>
2020-07-31 00:18:38 +02:00
Julien Pivotto 3e0ec3f8e1 Minor change
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-29 22:14:23 +02:00
Julien Pivotto 924e7239b7
Docker Swarm SD: Support tasks and service without published ports (#7686)
* Support tasks and service without published ports

Mimics k8s discovery behaviour.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-29 20:56:30 +02:00
Julien Pivotto 88bdb13c55
DNS SD: add srv record target and port meta labels (#7678)
* DNS SD: add srv record target and port meta labels

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-28 22:09:01 +02:00
Julien Pivotto e76c436e9c
Goleak in discoveries, scrape, rules (#7662)
* Add go leak tests for discoveries with goroutines

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

* Add go leak tests in rules

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

* Add go leak tests in scrape tests

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-27 09:38:08 +01:00
Julien Pivotto e07415227a
discovery: check for nil triton_sd_config (#7671)
* discovery: check for nil triton_sd_config

Note: this was discovered thanks to the added test.
The test is pretty low-level but also effective.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-26 01:20:40 +02:00
Julien Pivotto 93e9c010f3
Add more Go leak tests (#7652)
* Implement go leak test for promql

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

* Implement go leak test for Consul SD

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

* Implement go leak test in discovery manager

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-24 10:10:20 +01:00
Julien Pivotto 89d2f5ec1d
Merge pull request #7635 from roidelapluie/sdtests2
Tests for digitalocean and Docker Swarm configs
2020-07-22 10:56:37 +02:00
Julien Pivotto 52cdcc2a3b
Add a check-list for new SD's (#7634)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-22 00:07:33 +02:00
Julien Pivotto a197508d09 Add docker swarm test
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-22 00:04:36 +02:00
Björn Rabenstein 79620c78db
Merge pull request #7604 from roidelapluie/swarmsocket
Docker swarm: enable unix socket
2020-07-20 13:11:06 +02:00
johncming 6da680c7e4 discovery/config: add swarmsd config validation.
Signed-off-by: johncming <johncming@yahoo.com>
2020-07-19 22:50:22 +02:00
Julien Pivotto 49f48d8f65 Fix comment
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-17 17:48:05 +02:00
Julien Pivotto 968c86d642 Fix comment
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-17 17:41:02 +02:00
Julien Pivotto 45644c82f6 Docker swarm: enable unix socket
Fixes #7603

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-17 17:38:49 +02:00
Julien Pivotto 93ecf0e14c
Refactor dockerswarm refresh for testing (#7541)
We were missing testing on the behaviour of the configuration
unmarshalling.

This PR adds a refresh command that can be used to test that we
use the correct refresh function.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-09 13:01:08 +02:00
Julien Pivotto 27867412a7
openstack tests: use new test.Cleanup function (#7514)
Since we dependend on go1.14 now, we can use T.Cleanup
https://golang.org/pkg/testing/#T.Cleanup

This provides a nicer approach to shut down the test server.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-06 20:24:16 +02:00
John Bampton 98a69b77d1
Fix spelling (#7512)
Signed-off-by: John Bampton <jbampton@users.noreply.github.com>
2020-07-04 14:54:26 +02:00
Julien Pivotto e1f9816a33
Openstack: Reduce timeouts (#7507)
Set saner values for openstack timeouts

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-02 22:50:32 +02:00
Steffen Neubauer 9c9b872087
OpenStack SD: Add availability config option, to choose endpoint type (#7494)
* OpenStack SD: Add availability config option, to choose endpoint type

In some environments Prometheus must query OpenStack via an alternative
endpoint type (gophercloud calls this `availability`.

This commit implements this option.

Co-Authored-By: Dennis Kuhn <d.kuhn@syseleven.de>
Signed-off-by: Steffen Neubauer <s.neubauer@syseleven.de>
2020-07-02 15:17:56 +01:00
Julien Pivotto aa452d8ab4
digitalocean: use a safer pagination method (#7498)
this method is documented here: https://github.com/digitalocean/godo

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-02 00:13:39 +02:00
Hu Shuai a94b570dc6
Add a unit test for newAzureResourceFromID in discovery/azure/azure.go. (#7484)
This PR is about adding a unit test for newAzureResourceFromID in discovery/azure/azure.go.

Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
2020-06-30 11:11:57 +01:00