Commit graph

286 commits

Author SHA1 Message Date
Brian Brazil 23255f1499 Fix negative Next Retrieval on status page.
Change-Id: Ifa754034660a251fee71f166dbf057697ec4e872
2014-05-12 15:24:34 +01:00
Bjoern Rabenstein 64811caaec Make Prometheus announce its new super-power: text format!
Change-Id: Ia2ddfb28999c145e4d46c395381a9bf89d43148c
2014-04-22 18:44:52 +02:00
Julius Volz 84df022025 Cleanup server address handling, support IPv6.
This fixes https://github.com/prometheus/prometheus/issues/377, as
IPv6 server addresses are now handled correctly.

Change-Id: Iebde7cfdadb0a52041472517e6fdcff4303a25ab
2014-03-09 23:31:30 +01:00
Julius Volz b382e8b7bd Remove overly verbose DNS-SD logging line.
Change-Id: Ie4534437ab88b9a6b99f5cb6c2f32c9588c1fff6
2014-01-24 16:09:41 +01:00
Julius Volz 0378c2ca1f Nonexistent labels in BY-clauses shouldn't propagate to result.
This fixes bug 2. of https://github.com/prometheus/prometheus/issues/374

Change-Id: Ia4a13153616bafce5bf10597966b071434422d09
2014-01-24 16:05:30 +01:00
Stuart Nelson 48a6326d25 Added DNS-SD lookup counter for successful/unsuccessful lookups
Change-Id: I0a71e994a989cecace280b5134a31ebc2ace7591
2013-12-16 08:48:56 -05:00
Julius Volz fb44580110 Cleanup/fix program termination sequence.
Change-Id: I2bc58a2583fb079c9ef383cfc7a5e0fbe613f1cd
2013-12-11 15:40:32 +01:00
Julius Volz 740d448983 Use custom timestamp type for sample timestamps and related code.
So far we've been using Go's native time.Time for anything related to sample
timestamps. Since the range of time.Time is much bigger than what we need, this
has created two problems:

- there could be time.Time values which were out of the range/precision of the
  time type that we persist to disk, therefore causing incorrectly ordered keys.
  One bug caused by this was:

  https://github.com/prometheus/prometheus/issues/367

  It would be good to use a timestamp type that's more closely aligned with
  what the underlying storage supports.

- sizeof(time.Time) is 192, while Prometheus should be ok with a single 64-bit
  Unix timestamp (possibly even a 32-bit one). Since we store samples in large
  numbers, this seriously affects memory usage. Furthermore, copying/working
  with the data will be faster if it's smaller.

*MEMORY USAGE RESULTS*
Initial memory usage comparisons for a running Prometheus with 1 timeseries and
100,000 samples show roughly a 13% decrease in total (VIRT) memory usage. In my
tests, this advantage for some reason decreased a bit the more samples the
timeseries had (to 5-7% for millions of samples). This I can't fully explain,
but perhaps garbage collection issues were involved.

*WHEN TO USE THE NEW TIMESTAMP TYPE*
The new clientmodel.Timestamp type should be used whenever time
calculations are either directly or indirectly related to sample
timestamps.

For example:
- the timestamp of a sample itself
- all kinds of watermarks
- anything that may become or is compared to a sample timestamp (like the timestamp
  passed into Target.Scrape()).

When to still use time.Time:
- for measuring durations/times not related to sample timestamps, like duration
  telemetry exporting, timers that indicate how frequently to execute some
  action, etc.

*NOTE ON OPERATOR OPTIMIZATION TESTS*
We don't use operator optimization code anymore, but it still lives in
the code as dead code. It still has tests, but I couldn't get all of them to
pass with the new timestamp format. I commented out the failing cases for now,
but we should probably remove the dead code soon. I just didn't want to do that
in the same change as this.

Change-Id: I821787414b0debe85c9fffaeb57abd453727af0f
2013-12-03 09:11:28 +01:00
Johannes 'fish' Ziemke 8c08a5031f Add search domain support to SRV lookups
This adds search domain support by trying to resolve a name by
appending each search domain configured in /etc/resolv.conf until
the query succeeds (NOERROR) and has at least one answer.

Change-Id: Ibdc5138c5d8cc049e11fab90c3d5243d5a06852c
2013-10-29 17:19:49 +01:00
Julius Volz 274934bcd3 Revert "Revert "Merge pull request #317 from prometheus/fix/miekg-dns-for-srv""
This reverts commit 88099328d1.

Change-Id: I7bf74de5fda458e2e6f9eea2eacd0e256f95bdee
2013-09-10 17:48:05 +02:00
Johannes 'fish' Ziemke 88099328d1 Revert "Merge pull request #317 from prometheus/fix/miekg-dns-for-srv"
This reverts commit e3bc6fc9dc, reversing
changes made to 1cf9e5840a.

Conflicts:
	retrieval/target_provider.go

Change-Id: Icb6e98fb30419e9e2fe9b686c243702ced372014
2013-08-30 16:32:51 +02:00
Julius Volz 788587426b Make scrape timeouts configurable per job.
Change-Id: I77a7514ad9e7969771f873d63d6353ec50082a62
2013-08-19 12:21:47 +02:00
Julius Volz d69b85e6c9 Add global label support via Ingesters. 2013-08-13 16:54:15 +02:00
Julius Volz 0003027dce Add needed trailing spaces in logs. 2013-08-12 18:22:48 +02:00
Julius Volz aa5d251f8d Use github.com/golang/glog for all logging. 2013-08-12 17:54:36 +02:00
Matt T. Proud a5141e4d0a Depointerize storage conf. and chain ingester.
The storage builders need to work with the assumption that they have
a copy of the underlying configuration data if any mutations are made.
2013-08-12 17:07:03 +02:00
Julius Volz f8b20f30ac Make retrieval work with client's new Ingester interface. 2013-08-12 15:15:41 +02:00
Julius Volz 3b970c5133 Add variable interpolation to notification messages.
This includes required refactorings to enable replacing the http client (for
testing) and moving the NotificationReq type definitions to the "notifications"
package, so that this package doesn't need to depend on "rules" anymore and
that it can instead use a representation of the required data which only
includes the necessary fields.
2013-08-12 12:29:08 +02:00
Julius Volz 35ee2cd3cb Add alertmanager notification support to Prometheus.
Alert definitions now also have mandatory SUMMARY and DESCRIPTION fields
that get sent along a firing alert to the alert manager.
2013-07-30 17:23:41 +02:00
Julius Volz 81f0b85013 Return [] instead of null for empty result vectors. 2013-07-25 12:16:32 +02:00
Julius Volz 331be19af6 Fix broken retrieval tests.
These have been broken since 06b4a40661
2013-07-25 12:15:00 +02:00
Matt T. Proud f7704af4f8 Code Review: Formatting comments. 2013-07-15 15:12:01 +02:00
Matt T. Proud 06b4a40661 Represent targets in a tabular interface.
This commit represents a target group's endpoints in a tabular fashion for better differentiation
of their state in a concise manner.
2013-07-15 15:12:01 +02:00
Matt T. Proud e20e6980e9 Completely extract response payload for decoding.
This commit forces the extraction framework to read the entire response payload
into a buffer before attempting to decode it, for the underlying Protocol Buffer
message readers do not block on partial messages.
2013-07-14 23:04:08 +02:00
Julius Volz 9a48f57b66 Continue scraping old targets on SD fail.
When we have trouble resolving the targets for a job via service
discovery, we shouldn't just stop scraping the targets we currently
have.
2013-07-12 22:38:42 +02:00
juliusv 24715f0ee5 Merge pull request #322 from prometheus/refactor/client/new-model
Include Accept header for telemetry request.
2013-06-27 09:52:00 -07:00
Matt T. Proud b8c7fd8c34 Include Accept header for telemetry request.
This pull request introduces a HTTP Accept header to indicate a
preference for Protocol Buffer-encoded messages.
2013-06-27 18:32:28 +02:00
Johannes 'fish' Ziemke 4bdf1adb6c Use github.com/miekg/dns for resolving SRV records 2013-06-26 16:04:25 +02:00
Matt T. Proud 30b1cf80b5 WIP - Snapshot of Moving to Client Model. 2013-06-25 15:52:42 +02:00
Julius Volz 91cf1e9a26 Fix DNS-SD target refresh condition. 2013-06-13 16:10:39 +02:00
Julius Volz d9b4f98b44 Integrate DNS-SD support for discovering job targets. 2013-06-12 18:11:48 +02:00
Julius Volz 1fe3d3b06b Remove obsolete argument from target handling code. 2013-06-11 17:54:58 +02:00
Julius Volz 558281890b Minor "go tool vet" cleanups 2013-06-07 15:34:41 +02:00
Matt T. Proud d4db3cf00b Code Review: Last replacement wins. 2013-06-05 16:29:05 +02:00
Matt T. Proud 9cde48754b Fix race conditions in TargetPool.
The race condition detector found a few anomalies whereby a
TargetPool could be read during a mutation.  This has been fixed.
2013-06-05 14:44:20 +02:00
Julius Volz dcfd09c801 Prepend "exporter_" to labels that already exist in exported metrics.
If the metrics exported by a process already contain any of a target's
base labels (such as "job" or "instance", but also any manually assigned
target-group label), don't overwrite that label, but instead add a new
label consisting of the original label name prepended with "exporter_".
This is to accomodate intermediate exporter jobs, which might indicate
e.g. the jobs and instances for which they are exporting data.
2013-06-02 22:48:46 +02:00
Julius Volz 081191afb8 Remember and display last scrape errors in web UI. 2013-05-21 15:31:27 +02:00
Matt T. Proud 8f4c7ece92 Destroy naked returns in half of corpus.
The use of naked return values is frowned upon.  This is the first
of two bulk updates to remove them.
2013-05-16 10:53:25 +03:00
Bernerd Schaefer 428d91c86f Rename test helper files to helpers_test.go
This ensures that these files are properly included only in testing.
2013-05-14 16:30:47 +02:00
Matt T. Proud 244a4a9cdb Update to go1.1.
This commit updates the documentation, Makefiles, formatting, and
code semantics to support the 1.1. runtime, which includes ...

1. ``make advice``,

2. ``make format``, and

3. ``go fix`` on various targets.
2013-05-14 12:39:08 +02:00
Julius Volz 9cea5d9df8 Convert the Prometheus configuration to protocol buffers. 2013-04-30 22:26:00 +02:00
Julius Volz d8110fcd9c Send sample arrays instead of single samples over channels. 2013-04-29 17:24:17 +02:00
Matt T. Proud 6fac20c8af Harden the tests against OOMs.
This commit employs explicit memory freeing for the in-memory storage
arenas.  Secondarily, we take advantage of smaller channel buffer sizes
in the test.
2013-04-29 11:46:01 +02:00
Bernerd Schaefer b8bc91d6c0 Target test uses correct telemetry headers 2013-04-29 10:36:08 +02:00
Bernerd Schaefer c98fc8a495 Merge pull request #196 from prometheus/fix/timeout-target-scrapes
Target uses HTTP transport with deadlines
2013-04-29 01:30:54 -07:00
Bernerd Schaefer b04cd28862 Merge pull request #192 from prometheus/feature/negotiate-telemetry-schema-through-mime-type
Use Content-Type data for telemetry versioning
2013-04-29 01:30:37 -07:00
Bernerd Schaefer 3929582892 Target uses HTTP transport with deadlines
Instead of externally handling timeouts when scraping a target, we set
timeouts on the HTTP connection. This ensures that we don't leak
goroutines on timeouts.

[fixes #181]
2013-04-29 09:46:40 +02:00
Matt T. Proud a48ab34dd0 Refresh Prometheus client API usage.
The client API has been updated per https://github.com/prometheus/client_golang/pull/9.
2013-04-28 19:40:30 +02:00
Bernerd Schaefer cf3e6ae084 Add LabelSet helper to fix go 1.0.3 build 2013-04-26 14:27:42 +02:00
Bernerd Schaefer dfd5c9ce28 Refactor processor for 0.0.2 schema
Primary changes:

* Strictly typed unmarshalling of metric values
* Schema types are contained by the processor (no "type entity002")

Minor changes:

* Added ProcessorFunc type for expressing processors as simple
  functions.
* Added non-destructive `Merge` method to `model.LabelSet`
2013-04-26 11:52:26 +02:00
Bernerd Schaefer 7c3e04c546 Add version 0.0.2 processor 2013-04-25 17:37:16 +02:00
Bernerd Schaefer 76731c80c6 Use Content-Type data for telemetry versioning
ProcessorForRequestHeader now looks first for a header like
`Content-Type: application/json; schema="prometheus/telemetry";
version="0.0.1"` before falling back to checking
`X-Prometheus-API-Version`.
2013-04-25 16:05:37 +02:00
Julius Volz d4ff85db5a Add instance label to health (up) timeseries. 2013-04-24 21:50:49 +02:00
Matt T. Proud f9e99bd08a Refresh SampleValue to 64-bit floating point.
We always knew that this needed to be fixed.
2013-04-21 20:31:50 +02:00
Julius Volz ae316415fe Add missing argument to Printf call. 2013-04-19 16:29:58 +02:00
Julius Volz 8c9e9632a8 Record scrape health timeseries per target. 2013-04-16 19:01:26 +02:00
Julius Volz a0d311c9e6 Constantize job name label. 2013-04-15 11:47:54 +02:00
Julius Volz a1ba23038e Fix scrape timestamps to reduce sample time jitter.
We're currently timestamping samples with the time at the end of a scrape
iteration. It makes more sense to use a timestamp from the beginning of the
scrape for two reasons:

a) this time is more relevant to the scraped values than the time at the
   end of the HTTP-GET + JSON decoding work.
b) it reduces sample timestamp jitter if we measure at the beginning, and
   not at the completion of a scrape.
2013-04-13 03:45:37 +02:00
Johannes 'fish' Ziemke 14407a076a Convert addresses pointing to localhost in status.
Until now, targets pointing to localhost in the status view are linked to localhost, so you can't follow those links by clicking on them.
This change converts the links to point to the hostname of the prometheus server.

Before:
<a href="http://localhost:9090/metrics.json">http://localhost:9090/metrics.json</a>

After:
<a href="http://hostname-of-prometheus-server:9090/metrics.json">http://localhost:9090/metrics.json</a>
2013-04-12 15:14:04 +02:00
Julius Volz 2b8f0b2cc7 Constantize metric name label name. 2013-03-26 16:20:23 +01:00
Matt T. Proud 5a9417f80a Include humanized target state strings.
In the current /status implementation, we cannot divine what the
target's state is but rather get an integer constant for it.  This
commit, stringifies the constants.
2013-03-21 11:52:42 +01:00
Julius Volz f1fc7d717a Allow replacing job targets via HTTP API.
This roughly comprises the following changes:

- index target pools by job instead of scrape interval
- make targets within a pool exchangable while preserving existing
  health state for targets
- allow exchanging targets via HTTP API (PUT)
- show target lists in /status (experimental, for own debug use)
2013-02-28 21:33:29 +01:00
Julius Volz 047eb219e4 Fix target health state update.
Right now, futureState is only used to give hints to the health scheduler, but
nowhere is this future state persisted into the target's state field, so we
don't actually track a target's state over time.
2013-02-25 02:52:52 +01:00
Julius Volz 5d55785936 Fix broken target scrape error propagation. 2013-02-21 19:48:54 +01:00
Julius Volz 3537edee9f Fix targetpool iteration deadlock. 2013-02-21 19:48:29 +01:00
Julius Volz c8761f3468 Correct order of deadline and interval arguments. 2013-02-06 00:08:31 +01:00
Tobias Schmidt 53eab86a4f Merge pull request #51 from prometheus/refactor/testability/update-to-time-provider
Swap ``time.Now`` with testable ``Time.Now``.
2013-02-01 04:54:43 -08:00
Matt T. Proud e01b6cdb44 Duration statistics for each target pool.
We have an open question of how long does it take for each target
pool to have the state retrieved from all participating elements.
This commit starts by providing insight into this.
2013-01-28 16:36:28 +01:00
Matt T. Proud 4cd153555e Swap `time.Now with testable Time.Now`. 2013-01-27 19:59:20 +01:00
Matt T. Proud ea54751431 Update import paths to new location.
This repository moved from matttproud/prometheus to
prometheus/prometheus, and all import paths need to be updated.
2013-01-27 18:49:45 +01:00
Matt T. Proud f2ded515b7 Support versioned telemetry providers.
client_golang was updated to support full label-oriented telemetry,
which introduced interface incompatibilities with the previous
version of Prometheus.  To alleviate this, a general fetching and
processing dispatching system has been created, which discriminates
and processes according to the version of input.
2013-01-27 17:45:50 +01:00
Matt T. Proud 88d15373c5 Upgrade Prometheus to new API. 2013-01-23 17:18:45 +01:00
juliusv 39b2e72eb0 Merge pull request #37 from matttproud/julius-base-labels
Add support for configured job base labels.
2013-01-21 16:55:17 -08:00
Julius Volz 6f937ee032 Add preliminary metric docstrings and empty base labels. 2013-01-18 01:37:50 +01:00
Julius Volz 80cdb0121d Add support for configured job base labels. 2013-01-18 01:10:09 +01:00
Matt T. Proud 190e4e3fa3 `TargetManager and TargetPool` ass pointers. 2013-01-15 17:06:17 +01:00
Matt T. Proud 9752f1e61d Refactor Target as interface for testability.
Future tests around the ``TargetPool`` and ``TargetManager`` and
friends will be a lot easier when the concrete behaviors of
``Target`` can be extracted out.  Plus, each ``Target``, I suspect,
will have its own resolution and query strategy.
2013-01-15 16:19:51 +01:00
Matt T. Proud 9af0faaefb Get `TargetPool` test working again. 2013-01-13 20:12:38 +01:00
Matt T. Proud d772c6c2b5 Refactor target scheduling to separate facility.
``Target`` will be refactored down the road to support various
nuanced endpoint types.  Thusly incorporating the scheduling
behavior within it will be problematic.  To that end, the scheduling
behavior has been moved into a separate assistance type to improve
conciseness and testability.

``make format`` was also run.
2013-01-13 20:12:38 +01:00
Matt T. Proud efe61c18fa Refactor target scheduling to separate facility.
``Target`` will be refactored down the road to support various
nuanced endpoint types.  Thusly incorporating the scheduling
behavior within it will be problematic.  To that end, the scheduling
behavior has been moved into a separate assistance type to improve
conciseness and testability.

``make format`` was also run.
2013-01-13 10:43:37 +01:00
Julius Volz 56384bf42a Add initial config and rule language implementation. 2013-01-07 23:43:36 +01:00
Matt T. Proud 52f52a7ee2 Include nascent instrumentation of stack. 2013-01-04 23:32:46 +01:00
Matt T. Proud 2922def8d0 Use the `TargetManager` for targets. 2013-01-04 17:17:23 +01:00
Julius Volz 45a3e0a182 Rename Target Frequency -> Interval. 2013-01-04 13:03:32 +01:00
Matt T. Proud 7a9777b4b5 Create `TargetPool` priority queue.
``TargetPool`` is a pool of targets pending scraping.  For now, it
uses the ``heap.Interface`` from ``container/heap`` to provide a
priority queue for the system to scrape from the next target.

It is my supposition that we'll use a model whereby we create a
``TargetPool`` for each scrape interval, into which ``Target``
instances are registered.
2013-01-04 12:17:31 +01:00
Matt T. Proud 3ac5d48b1a Impl' storage i'faces and fix non-idiomatic warts.
This change includes implementation of most major storage layer
features, albeit some imperfect.  It also includes nascent telemetry
bindings, too.
2013-01-04 10:39:38 +01:00