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
6412fad0
Commit
6412fad0
authored
Oct 10, 2015
by
Brian Brazil
Committed by
Julius Volz
Oct 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document the instant rate.
Hamming up the "angry" meaning just a tad.
parent
760ebcf3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
functions.md
content/docs/querying/functions.md
+27
-1
No files found.
content/docs/querying/functions.md
View file @
6412fad0
...
...
@@ -159,6 +159,31 @@ increase(http_requests_total{job="api-server"}[5m])
human readability. Use
`rate`
in recording rules so that increases are tracked
consistently on a per-second basis.
## `irate()`
`irate(v range-vector)`
calculates the per-second instant rate of increase of
the time series in the range vector. This is based on the last two data points.
Breaks in monotonicity (such as counter resets due to target restarts) are
automatically adjusted for.
The following example expression returns the per-second rate of HTTP requests
looking up to 5 minutes back for the two most recent data points, per time
series in the range vector:
```
irate(http_requests_total{job="api-server"}[5m])
```
`irate`
should only be used when graphing volatile, fast-moving counters.
Use
`rate`
for alerts and slow-moving counters, as brief changes
in the rate can reset the
`FOR`
clause and graphs consisting entirely of rare
spikes are hard to read.
Note that when combining
`irate()`
with an aggregation operator (e.g.
`sum()`
)
or a function aggregating over time (any function ending in
`_over_time`
),
always take a
`irate()`
first, then aggregate. Otherwise
`irate()`
cannot detect
counter resets when your target restarts.
## `label_replace()`
For each timeseries in
`v`
,
`label_replace(v instant-vector, dst_label string, replacement string,
...
...
@@ -216,7 +241,8 @@ over the last 5 minutes, per time series in the range vector:
rate(http_requests_total{job="api-server"}[5m])
```
`rate`
should only be used with counters.
`rate`
should only be used with counters. It is best suited for alerting,
and for graphing of slow-moving counters.
Note that when combining
`rate()`
with an aggregation operator (e.g.
`sum()`
)
or a function aggregating over time (any function ending in
`_over_time`
),
...
...
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