Commit graph

140 commits

Author SHA1 Message Date
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 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
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
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
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
Matt T. Proud 30b1cf80b5 WIP - Snapshot of Moving to Client Model. 2013-06-25 15:52:42 +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 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
Julius Volz d8110fcd9c Send sample arrays instead of single samples over channels. 2013-04-29 17:24:17 +02: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
Julius Volz d4ff85db5a Add instance label to health (up) timeseries. 2013-04-24 21:50:49 +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 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
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
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
Julius Volz 80cdb0121d Add support for configured job base labels. 2013-01-18 01:10:09 +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 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
Renamed from retrieval/type.go (Browse further)