Commit graph

245 commits

Author SHA1 Message Date
Jimmi Dyson c81610813e Kubernetes SD: Use node name as instance label 2016-01-11 16:48:23 +01:00
Julius Volz f4d79f1376 Fix SD mechanism source prefix handling.
The prefixed target provider changed a pointerized target group that was
reused in the wrapped target provider, causing an ever-increasing chain
of source prefixes in target groups from the Consul target provider.

We now make this bug generally impossible by switching the target group
channel from pointer to value type and thus ensuring that target groups
are copied before being passed on to other parts of the system.

I tried to not let the depointerization leak too far outside of the
channel handling (both upstream and downstream) because I tried that
initially and caused some nasty bugs, which I want to minimize.

Fixes https://github.com/prometheus/prometheus/issues/1083
2016-01-11 16:48:22 +01:00
Julius Volz aba06b3ed9 Fix watching multiple Zookeeper paths in serverset SD.
Fix https://github.com/prometheus/prometheus/issues/1137
2016-01-11 16:48:22 +01:00
Matt Jibson 1c8b75b98b Add SD for Amazon EC2 instances 2016-01-11 16:48:22 +01:00
Fabian Reinartz f4ddf1a1d8 Switch to common/log 2016-01-11 16:48:21 +01:00
Jimmi Dyson 88c6da77f9 Kubernetes SD example: separate out cluster level components & services 2016-01-11 16:48:20 +01:00
Julius Volz af661ad76c Fix target manager CPU busyloop caused by bad done-channel handling.
Unfortunately this isn't nicely testable, as it's timing-dependent and
one would have to detect a stray goroutine doing a CPU busyloop...

Fixes https://github.com/prometheus/prometheus/issues/1114
2016-01-11 16:48:20 +01:00
Brian Brazil 10b6d43b3e retrieval: Reduce flakiness of TestTargetRunScraperScrapes 2016-01-11 16:48:20 +01:00
Brian Brazil 0f77856095 retrieval: Add URL parameters to fullLabels too
Move all the special cases into one map, rather than
spreading the logic around.
2016-01-11 16:48:19 +01:00
Brian Brazil a7a1200f28 Retrieval: Show error message for failed test scrape
This is flaky, and I suspect it was due the to I/O timeout that I've
already fixed. In case that wasn't it, display the error should it
happen again.
2016-01-11 16:48:19 +01:00
Brian Brazil 1c5fbd568c retrieval: Reduce flakiness of TestTargetManagerChan
This will increase test time by a few hundred ms,
this is the 2nd most common cause of flakiness.
2016-01-11 16:48:19 +01:00
Brian Brazil 99935fdc48 retrieval: Reduce flakiness of target tests
Bump timeouts of tests where we don't want I/O timeouts.

Adjust the full channel test to be much more reliable,
by reducing the ingestion timeout from 1ms to 0.
2016-01-11 16:48:19 +01:00
Fabian Reinartz 2346d9927b Fix nil panic on consul error 2016-01-11 16:48:19 +01:00
Fabian Reinartz 1d8cb6b3e1 Update expfmt.NewDecoder usage 2016-01-11 16:48:18 +01:00
Julius Volz 8d80bf4696 Fix some dead code, missing error checks, shadowings.
I applied
https://medium.com/@jgautheron/quality-pipeline-for-go-projects-497e34d6567
and was greeted with a deluge of warnings, most of which were not
applicable or really fixable realistically. These are some of the first
ones I decided to fix.
2016-01-11 16:48:15 +01:00
Jimmi Dyson 0ae051994d Clean up kubernetes http response bodies 2016-01-11 16:48:14 +01:00
Anders Daljord Morken bedf8ee2a6 Close HTTP connections on HTTP errors too.
Move defer resp.Body.Close() up to make sure it's called even when the
HTTP request returns something other than 200 or Decoder construction
fails. This avoids leaking and eventually running out of file descriptors.
2016-01-11 16:48:14 +01:00
Fabian Reinartz fedfe44366 Use go1.5.1 2016-01-11 16:48:14 +01:00
Jimmi Dyson 609db27948 Move TLS options to scrape config
Fixes #1013, fixes #989
2016-01-11 16:48:14 +01:00
Jimmi Dyson 852dfd99e2 Kubernetes SD improvements
* Support multiple masters with retries against each master as required.
* Scrape masters' metrics.
* Add role meta label for node/service/master to make it easier for relabeling.
2016-01-11 16:48:13 +01:00
Fabian Reinartz 4be0f57447 Remove attachment of global labels upon ingestion 2016-01-11 16:48:13 +01:00
Fabian Reinartz 013dd09a42 Fix map initialization 2016-01-11 16:48:12 +01:00
Julius Volz 811ab05e0e Change config regexes to full-string matches.
This anchors all regular expressions entered via the config to match a
full string vs. a substring.

THIS IS A BREAKING CHANGE!

Fixes part of https://github.com/prometheus/prometheus/issues/996
2016-01-11 16:48:12 +01:00
Fabian Reinartz 8a0b506ea8 Fix draining of file watcher events 2016-01-11 16:48:12 +01:00
Daniel Lundin 103aca942d serverset: extract shard number from serverset data 2016-01-11 16:48:12 +01:00
Julius Volz 20d0bf4d65 Fix flakey FileSD test.
When the test ends, all files matching the watcher's glob are removed
via defer. In that moment, the draining goroutine may still be running
and then detect no files matching the configured glob just before the
test exits.

This is now solved by waiting for the draining goroutine to finish
before leaving the test function and thus causing the deferred file
removal.
2016-01-11 16:48:12 +01:00
Julius Volz 2ad4987e09 Fix "go vet" errors.
I ignored all errors of the type "composite literal uses unkeyed
fields". Most of them are wrong because of
https://github.com/golang/go/issues/9171.
2016-01-11 16:48:11 +01:00
Julius Volz bb0ba8d68f Fix most golint warnings.
This is with `golint -min_confidence=0.5`.

I left several lint warnings untouched because they were either
incorrect or I felt it was better not to change them at the moment.
2016-01-11 16:48:11 +01:00
Fabian Reinartz 0830b0cd70 Move metric modifications into SampleAppenders 2016-01-11 16:48:11 +01:00
Fabian Reinartz d6d88f8950 Add missing license headers 2015-08-24 19:19:21 +02:00
Julius Volz d36a7f4e6f Fix busylooping in case of no target providers.
merge() closes the channel that handleUpdates() reads from when there
are zero configured target providers in the configuration. In that case,
the for-select loop in handleUpdates() entered a busy loop. It should
exit when the upstream channel is closed.
2015-08-24 16:42:28 +02:00
Fabian Reinartz 3a0145c09e Reenable blocked appending tests 2015-08-22 09:47:57 +02:00
Fabian Reinartz 438e232c9b Fix grouping of import blocks 2015-08-22 09:42:45 +02:00
Fabian Reinartz 6d0f58dcf3 sanitize scrape health recording code 2015-08-21 23:01:08 +02:00
Fabian Reinartz 25bf5fdaf5 Timeout sample appends 2015-08-21 18:04:35 +02:00
Fabian Reinartz 11a577fcd0 Switch to common/expfmt for extraction 2015-08-21 13:33:38 +02:00
Fabian Reinartz 306e8468a0 Switch from client_golang/model to common/model 2015-08-21 13:33:38 +02:00
Sharif Nassar 6cb519fe82 Add Consul ServiceID to the discovery meta labels. 2015-08-20 14:04:42 -07:00
Fabian Reinartz 0f5022c091 Add missing Kubernetes doc strings 2015-08-18 14:37:28 +02:00
Fabian Reinartz f592740bac Only exit static target provider on done 2015-08-18 11:51:53 +02:00
Julius Volz b4adf2723d Merge pull request #994 from robbiet480/consul-datacenter-name
Pass through current agent Consul datacenter name
2015-08-18 01:09:24 +02:00
Robbie Trencheny 48e461f7db Pass through current agent Consul datacenter name
Instead of only filling __meta_consul_dc when datacenter is set in
consul_sd_config this change fills the label based on what the agent
reports it's current data center is, if datacenter isn't manually set,
otherwise it uses whatever datacenter was set to.
2015-08-17 16:00:26 -07:00
Fabian Reinartz d0a90964c1 Fix license header 2015-08-17 19:51:12 +02:00
Fabian Reinartz eabbdc6603 Add missing license headers 2015-08-17 19:49:10 +02:00
Julius Volz 47a96bff1a Update constant names in comments. 2015-08-17 15:05:06 +02:00
Brian Brazil e1d5eb52f2 retrieval: Don't include unmatched source of regex in replacement.
ReplaceAllString only replaces the matching part of the regex,
the unmatched bits around it are left in place. This is not the
expected or desired behaviour as the replacement string should
be everything.

This may break users dependant on this behaviour, but
what they're doing is still possible.
2015-08-17 00:31:56 +01:00
Fabian Reinartz 3c6dd161d7 Scrape all services on empty services list. 2015-08-14 17:39:41 +02:00
Fabian Reinartz 9b9ff66212 Merge pull request #977 from prometheus/fabxc/target-dedup
Improve target discovery pipeline
2015-08-14 16:38:16 +02:00
Fabian Reinartz 8fa9ec278b Add application labels as meta labels
Removes built-in conditional scraping based on application's
'prometheus' label.
2015-08-14 15:34:02 +02:00
Fabian Reinartz f269943950 Adjust Kubernetes SD to pipeline changes 2015-08-14 13:30:27 +02:00