Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
docs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
docs
Commits
0bfaadbc
Commit
0bfaadbc
authored
Jan 23, 2015
by
juliusv
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14 from brian-brazil/deriv-delta
Document deriv, update/correct docs for rate and delta.
parents
77e02e8e
44f7959f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
17 deletions
+25
-17
functions.md
content/docs/querying/functions.md
+25
-17
No files found.
content/docs/querying/functions.md
View file @
0bfaadbc
...
@@ -37,28 +37,34 @@ allows grouping by labels via a `by` clause.
...
@@ -37,28 +37,34 @@ allows grouping by labels via a `by` clause.
## `delta()`
## `delta()`
`delta(v range-vector
, counter bool
)`
calculates the difference between the
`delta(v range-vector)`
calculates the difference between the
first and last value of each time series element in a range vector
`v`
,
first and last value of each time series element in a range vector
`v`
,
returning an instant vector with the given deltas and equivalent labels. If
returning an instant vector with the given deltas and equivalent labels.
`counter`
is set to
`1`
(
`true`
), the time series in the range vector are
The delta is interpolated to cover the full time range.
treated as monotonically increasing counters. Breaks in monotonicity (such as
counter resets due to target restarts) are automatically adjusted for. Setting
`counter`
to
`0`
(
`false`
) turns this behavior off.
Example which returns the total number of HTTP requests counted within the last
The following example expression returns the difference in CPU temperature
5 minutes, per time series in the range vector
:
between now and 2 hours ago
:
```
```
delta(
http_requests{job="api-server"}[5m], 1
)
delta(
cpu_temp_celsius{host="zeus"}[2h]
)
```
```
Example which returns the difference in CPU temperature between now and 2 hours
`delta`
should only be used with gauges.
ago:
## `deriv()`
`deriv(v range-vector)`
calculates the derivative of the time series in a range
vector
`v`
, using
[
simple linear regression
](
http://en.wikipedia.org/wiki/Simple_linear_regression
)
.
The following example expression returns the predicted CPU temperature in 5
minutes based on the previous hour of data:
```
```
delta(cpu_temp_celsius{host="zeus"}[2h], 0)
cpu_temp_celsius{host="zeus"} + deriv(cpu_temp_celsius{host="zeus"}[1h]) * 5 * 60
```
```
`deriv`
should only be used with gauges.
## `drop_common_labels()`
## `drop_common_labels()`
`drop_common_labels(instant-vector)`
drops all labels that have the same name
`drop_common_labels(instant-vector)`
drops all labels that have the same name
...
@@ -66,17 +72,19 @@ and value across all series in the input vector.
...
@@ -66,17 +72,19 @@ and value across all series in the input vector.
## `rate()`
## `rate()`
`rate(v range-vector)`
behaves like
`delta()`
, with two differences:
`rate(v range-vector)`
calculate the per-second average rate of increase of the
*
the returned delta is converted into a per-second rate, according to the respective interval
time series in the range vector. Breaks in monotonicity (such as counter
*
the
`counter`
argument is implicitly set to
`1`
(
`true`
)
resets due to target restarts) are automatically adjusted for.
Example call which
returns the per-second rate of HTTP requests as measured
The following example expression
returns the per-second rate of HTTP requests as measured
over the last 5 minutes, per time series in the range vector:
over the last 5 minutes, per time series in the range vector:
```
```
rate(http_requests{job="api-server"}[5m])
rate(http_requests
_total
{job="api-server"}[5m])
```
```
`rate`
should only be used with counters.
## `scalar()`
## `scalar()`
Given a single-element input vector,
`scalar(v instant-vector)`
returns the
Given a single-element input vector,
`scalar(v instant-vector)`
returns the
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment