Commit graph

385 commits

Author SHA1 Message Date
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
Julien Pivotto 59de58d380
Docker Swarm service discovery (#7420)
* Docker Swarm service discovery

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-06-26 12:25:58 +02:00
Pierre Souchay 1508678001
Use 10m timeouts for watches (#7423)
use ?wait=10m will give results as fast as usual when data is changing
but will perform far less requests when services do not change.

On large infrastructure, this will reduce quite a lot the number of
qps on Consul servers while having the same performance for freshness
of results.

Signed-off-by: Pierre Souchay <p.souchay@criteo.com>
2020-06-20 20:22:45 +01:00
Julien Pivotto fb9a1a872e
DigitalOcean: limit refresh timeout (#7425)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-06-20 09:45:28 +02:00
Julien Pivotto c61141ce51
Add DigitalOcean service discovery (#7407)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-06-18 17:04:41 +02:00
Martin Lee b5d61fb66c
Add AMI to labels scraped during service discovery. (#7386)
Signed-off-by: Martin Lee <martin@martinlee.org>
2020-06-11 18:25:58 +01:00
Frederic Branczyk 7b1c0d6b66
discovery/kubernetes: Fix incorrect premature break of reading results
Previously `max` results stopped reading from results in tests
prematurely, as it stopped when `max` number of items were received from
the channel instead of `max` number of unique target groups received.
This caused flaky tests where the same target group was received
multiple times, as Kubernetes informers may emit the same event multiple
times.

Before this patch, running this test repeatedly failed eventually. After
this patch I have run the test many thousand times without failure.

```bash
go test -run TestEndpointsDiscoveryNamespaces -count 1000 -test.v
```

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
2020-06-11 16:08:28 +02:00
Tariq Ibrahim 06a6621b6c
update kubernetes to v1.18.x and update ingress apiVersion
Signed-off-by: Tariq Ibrahim <tariq181290@gmail.com>
2020-06-01 08:26:50 -07:00
Jop Zinkweg 1f69c38ba4
Add discovery support for triton compute nodes (#7250)
Added optional configuration item role, defaults to 'container' (backwards-compatible).
Setting role to 'cn' will discover compute nodes instead.

Human-friendly compute node hostname discovery depends on cmon 1.7.0:
c1a2aeca36

Adjust testcases to use discovery config per case as two different types are now supported.

Updated documentation:
* new role setting
* clarify what the name 'container' covers as triton uses different names in different locations

Signed-off-by: jzinkweg <jzinkweg@gmail.com>
2020-05-22 16:19:21 +01:00
Guangming Wang 5b4006ac86
cleanup: remove unnacessary nil check before range (#7194)
Signed-off-by: Guangming Wang <guangming.wang@daocloud.io>
2020-05-02 07:25:44 +01:00
ZouYu 2b7437d60e
Fix some warnings: 'redundant type from array, slice, or map composite literal' (#7109)
Signed-off-by: ZouYu <zouy.fnst@cn.fujitsu.com>
2020-04-15 11:17:41 +01:00
Marek Slabicki 8224ddec23
Capitalizing first letter of all log lines (#7043)
Signed-off-by: Marek Slabicki <thaniri@gmail.com>
2020-04-11 09:22:18 +01:00
ZouYu f494426f73
fix warning redundant type from array, slice, or map composite literal (#7106)
Signed-off-by: ZouYu <zouy.fnst@cn.fujitsu.com>
2020-04-09 11:29:19 +01:00
Tariq Ibrahim 0730d6eb74
remove deprecated methods from the MetricProvider interface
Signed-off-by: Tariq Ibrahim <tariq181290@gmail.com>
2020-04-06 09:23:58 -07:00
Deepjyoti Mondal c38ca2ca95
Fix #6999 : Add architecture meta label for EC2 (#7000)
This PR adds architecture meta labels for EC2 instances

Signed-off-by: Deepjyoti Mondal <djmdeveloper060796@gmail.com>
2020-03-28 20:41:37 +00:00
coding3min 4dfbf328f2
[OpenStack SD] Add HypervisorID meta labels about id (#6962)
Add extra meta labels which will be useful in the case
Prometheus discovery hypervisor .

Signed-off-by: pzqu <pzqu@qq.com>

Co-authored-by: pzqu <pzqu@example.com>
2020-03-11 08:38:14 +00:00
Alex Gaganov df92a00838
Expose EC2 instance lifecycle as label (#6914)
Signed-off-by: Alex Gaganov <alex.gaganov@fiverr.com>
2020-03-03 08:03:16 +00:00
Julien Pivotto c67f81937c
discovery: updateGroup should not create targets[poolKey] in the loop (#6903)
We can assume that not all target groups are nil in normal scernarios,
so we can create targets[poolKey] outside the loop.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-03-02 07:35:02 +00:00
Mathilde Gilles 9b9c58aea8
[Consul] Add health label to metrics (#5313)
Label metrics with the target health using consul's /health endpoint.

Signed-off-by: Mathilde Gilles <m.gilles@criteo.com>
2020-02-25 13:32:30 +00:00
Frederic Branczyk d06f1034db discovery/kubernetes: Fix race in test setup
Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
2020-02-25 10:33:41 +01:00
李国忠 029b45aa30
add service type metadata to kubernetes_sd_config service role #6496 (#6684)
* [service discovery] add service type metadata to kubernetes_sd_config service role

Signed-off-by: fuling <fuling.lgz@alibaba-inc.com>

* [fix] ServiceType -> string

Signed-off-by: fuling <fuling.lgz@alibaba-inc.com>

* [fix] fix testcase

Signed-off-by: fuling <fuling.lgz@alibaba-inc.com>

* [style]

Signed-off-by: fuling <fuling.lgz@alibaba-inc.com>

* [doc] add service type

Signed-off-by: fuling <fuling.lgz@alibaba-inc.com>

* [doc] sort

Signed-off-by: fuling <fuling.lgz@alibaba-inc.com>
2020-02-25 09:22:14 +01:00
Simon Pasquier 06c1a07d5a discovery/kubernetes: remove extraneous parameters from send()
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-02-18 17:36:57 +01:00
Aleksandra Gacek 8e53c19f9c discovery/kubernetes: expose label_selector and field_selector
Close #6807

Co-authored-by @shuttie
Signed-off-by: Aleksandra Gacek <algacek@google.com>
2020-02-15 14:57:56 +01:00
Grebennikov Roman b4445ff03f discovery/kubernetes: expose label_selector and field_selector
Closes #6096

Signed-off-by: Grebennikov Roman <grv@dfdx.me>
2020-02-15 14:57:38 +01:00
Simon Pasquier fe76ccbfe3
discovery/consul: fix logging of tags (#6783)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-02-13 13:11:44 +01:00
Ben Ye 1a18594176
keep kubernetes metrics in global vars (#6765)
Signed-off-by: yeya24 <yb532204897@gmail.com>
2020-02-06 15:52:57 +00:00
Ben Ye 60527de355
keep consul service metrics in global variables (#6764)
Signed-off-by: yeya24 <yb532204897@gmail.com>
2020-02-06 05:48:58 +00:00
Julien Pivotto cf42888e4d Fix order of testutil.Equals (#6695)
Equals takes the expected value as first parameter, and the actual value
as second parameter.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-01-27 12:21:59 +00:00
johncming 17683d074c discovery: fix bug that use rlock for read. (#5928)
Signed-off-by: johncming <johncming@yahoo.com>
2020-01-22 09:57:37 +00:00
Julien Pivotto 2b2eb79e8b Add windows tests for query logger (#6653)
* Add windows tests
* Do not rely on time.Time in timer

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-01-20 13:17:11 +00:00
Josh Soref 91d76c8023 Spelling (#6517)
* spelling: alertmanager

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: attributes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: autocomplete

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bootstrap

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: caught

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: chunkenc

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compaction

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: corrupted

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deletable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: expected

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: fine-grained

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialized

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: iteration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: javascript

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: number

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overlapping

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: possible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: postings

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: procedure

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: programmatic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: queuing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: querier

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: repairing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: received

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: reproducible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: retention

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: sample

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: segements

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: semantic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: software [LICENSE]

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: staging

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: timestamp

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unfortunately

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: uvarint

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: subsequently

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: ressamples

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2020-01-02 15:54:09 +01:00
Simon Pasquier 75470f86b4 discovery/kubernetes: fix client metrics
The Kubernetes client records workqueue duration and latency metrics as
seconds so there's no need to convert the values from microseconds to
seconds anymore.

The cache metrics (prometheus_sd_kubernetes_cache_*) are removed because
they aren't used anymore by the client though still exposed by its API.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-11-29 12:34:36 +01:00
Callum Styan 7bf17b654c As per dev summit, SD moratorium has been lifted. (#6324)
Signed-off-by: Callum Styan <callumstyan@gmail.com>
2019-11-21 00:22:15 +00:00
Jean-Baptiste Le Duigou 5973227434 adding additional unit tests for getDataCenter() in consul (#6192)
* adding additional unit tests for getDataCenter() in consul

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>

* Consult Tests : update comments to start with uppercase and end with point

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>

* Consult Test : using table-driven tests

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>

* Consul Test : cleaner syntax

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>

* Consul Test : even cleaner syntax

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>

* Consul Test : update comments

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>

* Fixing naming convention by removing underscore in function name

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>

* Removing duplicated test case for getDatacenter()

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>
2019-11-15 14:52:39 +01:00
Yao Zengzeng 1afa476b8a minor fix for making map (#6076)
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
2019-10-25 20:06:00 -06:00
Simon Pasquier 3acc3e856c
Adding unit test for target group (#6141)
* adding unit test for target group

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>

* Improve unit tests for target group

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>

* Fix imports

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>

* Improve test by asserting on whole Target Group object

Signed-off-by: Jean-Baptiste Le Duigou <jb.leduigou@gmail.com>
2019-10-18 16:24:26 +02:00