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
451ae47c
Commit
451ae47c
authored
Aug 20, 2015
by
Brian Brazil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document label_replace
parent
8bf820ff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
functions.md
content/docs/querying/functions.md
+16
-0
No files found.
content/docs/querying/functions.md
View file @
451ae47c
...
...
@@ -166,6 +166,22 @@ 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.
## `label_replace()`
For each timeseries in
`v`
,
`label_replace(v instant-vector, dst_label string, replacement string,
src_label string, regex string)`
matches the regular expression
`regex`
against
the label
`src_label`
. If it matches, then the timeseries is returned with the
label
`dst_label`
replaced by the expansion of
`replacement`
.
`$1`
is replaced
with the first matching subgroup,
`$2`
with the second etc. If the regular
expression doesn't match then the timeseries is not returned.
This example will return a vector with each time series having a
`foo`
label with the value
`a`
added to it:
```
label_replace(up{job="api-server",service="a:c"}, "foo", "$1", "service", "(.*):.*")
```
## `ln()`
`ln(v instant-vector)`
calculates the natural logarithm for all elements in
`v`
.
...
...
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