Commit fc783fd3 authored by Fabian Reinartz's avatar Fabian Reinartz Committed by GitHub

Merge pull request #491 from brian-brazil/mnr

Merge next release for 1.0
parents 360e9936 329a84af
......@@ -38,27 +38,6 @@ identifying for an alert instance. They are used to store longer additional
information such as alert descriptions or runbook links. The annotation values
can be templated.
#### Prometheus v0.16.2 and earlier
In previous Prometheus versions the rule syntax is as follows:
ALERT <alert name>
IF <expression>
[ FOR <duration> ]
[ WITH <label set> ]
SUMMARY <string>
DESCRIPTION <string>
[ RUNBOOK <string> ]
Annotations are not free form but fixed to a summary, a description, and a
runbook field. Labels are attached using the `WITH` rather than the `LABELS`
clause.
Label values in the `WITH` clause cannot be templated.
NOTE: **Note:** Old alerting rules can be converted to the new syntax using
[this script](https://gist.github.com/xbglowx/d798da98ff9937e33862b285d0121bde#gistcomment-1752515).
#### Templating
Label and annotation values can be templated using [console templates](../../visualization/consoles).
......
......@@ -462,19 +462,16 @@ create multiple target groups:
The following meta labels are available on targets during relabeling:
<<<<<<< HEAD
* All roles:
* `__meta_kubernetes_role`: the role of the target: one of `apiserver`,
`endpoint`, `node`, `pod`, `container` or `service`
* `__meta_kubernetes_role`: the role of the target: one of `endpoint`, `service`, `pod`, `container`, `node`, or `apiserver`
* Nodes:
* `__meta_kubernetes_node_label_<labelname>`: each node label from the
Kubernetes API
* `__meta_kubernetes_node_label_<labelname>`: each node label from the Kubernetes API
* Services and Endpoints:
* `__meta_kubernetes_service_namespace`: the namespace of the service
* `__meta_kubernetes_service_name`: the name of the service
* `__meta_kubernetes_service_label_<labelname>`: each service label from the
Kubernetes API
* `__meta_kubernetes_service_annotation_<annotationname>`: each service
annotation from the Kubernetes API
* `__meta_kubernetes_service_label_<labelname>`: each service label from the Kubernetes API
* `__meta_kubernetes_service_annotation_<annotationname>`: each service annotation from the Kubernetes API
* Pods and Containers:
* `__meta_kubernetes_pod_name`: the name of the pod
* `__meta_kubernetes_pod_namespace`: the namespace of the service
......@@ -501,6 +498,9 @@ See below for the configuration options for Kubernetes discovery:
api_servers:
- [<host>]
# The Kubernetes role of entities that should be discovered.
role: <role>
# Run in cluster. This will use the automounted CA certificate and bearer
# token file at /var/run/secrets/kubernetes.io/serviceaccount/ in the pod.
[ in_cluster: <boolean> ]
......@@ -530,7 +530,8 @@ tls_config:
[ retry_interval: <duration> | default = 1s ]
```
There are example Kubernetes SD configs on [GitHub](https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml).
Where `<role>` must be `endpoint`, `service`, `pod`, `container`, `node`, or `apiserver`.
### `<marathon_sd_config>`
......
......@@ -34,12 +34,6 @@ absent(sum(nonexistent{job="myjob"}))
This is useful for alerting on when no time series
exist for a given metric name and label combination.
## `bottomk()`
`bottomk(k integer, v instant-vector)` returns the `k` smallest elements of `v`
by sample value.
## `ceil()`
`ceil(v instant-vector)` rounds the sample values of all elements in `v` up to
......@@ -317,11 +311,6 @@ Same as `sort`, but sorts in descending order.
this does not actually return the current time, but the time at which the
expression is to be evaluated.
## `topk()`
`topk(k integer, v instant-vector)` returns the `k` largest elements of `v` by
sample value.
## `vector()`
`vector(s scalar)` returns the scalar `s` as a vector with no labels.
......
......@@ -19,6 +19,7 @@ The following binary arithmetic operators exist in Prometheus:
* `*` (multiplication)
* `/` (division)
* `%` (modulo)
* `^` (power/exponentiation)
Binary arithmetic operators are defined between scalar/scalar, vector/scalar,
and vector/vector value pairs.
......@@ -185,22 +186,31 @@ vector of fewer elements with aggregated values:
* `stddev` (calculate population standard deviation over dimensions)
* `stdvar` (calculate population standard variance over dimensions)
* `count` (count number of elements in the vector)
* `count_values` (count number of elements with the same value)
* `bottomk` (smallest k elements by sample value)
* `topk` (largest k elements by sample value)
These operators can either be used to aggregate over **all** label dimensions
or preserve distinct dimensions by including a `without` or `by` clause.
<aggr-op>(<vector expression>) [without|by (<label list>)] [keep_common]
<aggr-op>([parameter,] <vector expression>) [without|by (<label list>)] [keep_common]
`without` removes the listed labels from the result vector, while all other
labels are preserved the output. `by` does the opposite and drops labels that
are not listed in the `by` clause, even if their label values are identical
between all elements of the vector. The `keep_common` clause allows keeping
those extra labels (labels that are identical between elements, but not in the
`by` clause).
`parameter` is only required for `count_values`,`topk` and `bottomk`. `without`
removes the listed labels from the result vector, while all other labels are
preserved the output. `by` does the opposite and drops labels that are not
listed in the `by` clause, even if their label values are identical between all
elements of the vector. The `keep_common` clause allows keeping those extra
labels (labels that are identical between elements, but not in the `by`
clause).
Until Prometheus 0.14.0, the `keep_common` keyword was called `keeping_extra`.
The latter is still supported, but is deprecated and will be removed at some
point.
`count_values` outputs one time series per unique sample value. Each series has
an additional label. The name of that label is given by the aggregation
parameter, and the label value is the unique sample value. The value of each
time series is the number of times that sample value was present.
`topk` and `bottomk` are different from other aggregators in that a subset of
the input samples, including the original labels, are returned in the result
vector. `by` and `without` are only used to bucket the input vector.
Example:
......@@ -215,16 +225,26 @@ applications, we could simply write:
sum(http_requests_total)
To count the number of binaries running each build version we could write:
count_values("version", build_version)
To get the 5 largest HTTP requests counts across all instances we could write:
topk(5, http_requests_total)
## Binary operator precedence
The following list shows the precedence of binary operators in Prometheus, from
highest to lowest.
1. `*`, `/`, `%`
2. `+`, `-`
3. `==`, `!=`, `<=`, `<`, `>=`, `>`
4. `and`, `unless`
5. `or`
1. `^`
2. `*`, `/`, `%`
3. `+`, `-`
4. `==`, `!=`, `<=`, `<`, `>=`, `>`
5. `and`, `unless`
6. `or`
Operators on the same precedence level are left-associative. For example,
`2 * 3 % 2` is equivalent to `(2 * 3) % 2`.
`2 * 3 % 2` is equivalent to `(2 * 3) % 2`. However `^` is right associative,
so `2 * 3 ^ 2` is equivilent to `2 * (3 ^ 2)`.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment