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
704b23ba
Commit
704b23ba
authored
Sep 03, 2016
by
Tobias Schmidt
Committed by
GitHub
Sep 03, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #534 from prometheus/dates
Document new date/time related functions.
parents
a873feb6
2e54e1ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
2 deletions
+40
-2
functions.md
content/docs/querying/functions.md
+40
-2
No files found.
content/docs/querying/functions.md
View file @
704b23ba
...
...
@@ -6,14 +6,19 @@ sort_rank: 3
# Functions
Some functions have default arguments, e.g.
`year(v=vector(time())
instant-vector)`
. This means that there is one argument
`v`
which is an instant
vector, which if not provided it will default to the value of the expression
`vector(time())`
.
## `abs()`
`abs(v vector)`
returns the input vector with all sample values converted to
`abs(v
instant-
vector)`
returns the input vector with all sample values converted to
their absolute value.
## `absent()`
`absent(v vector)`
returns an empty vector if the vector passed to it has any
`absent(v
instant-
vector)`
returns an empty vector if the vector passed to it has any
elements and a 1-element vector with the value 1 if the vector passed to it has
no elements.
...
...
@@ -63,6 +68,22 @@ vector as a scalar. This is in contrast to the `count()`
always returns a vector (an empty one if the input vector is empty) and allows
grouping by labels via a
`by`
clause.
## `day_of_month()`
`day_of_month(v=vector(time()) instant-vector)`
returns the day of the month
for each of the given times in UTC. Returned values are from 1 to 31.
## `day_of_week()`
`day_of_week(v=vector(time()) instant-vector)`
returns the day of the week for
each of the given times in UTC. Returned values are from 0 to 6, where 0 means
Sunday etc.
## `days_in_month()`
`days_in_month(v=vector(time()) instant-vector)`
returns number of days in the
month for each of the given times in UTC. Returned values are from 28 to 31.
## `delta()`
`delta(v range-vector)`
calculates the difference between the
...
...
@@ -162,6 +183,11 @@ more trends in the data is considered. Both `sf` and `tf` must be between 0 and
`holt_winters`
should only be used with gauges.
## `hour()`
`hour(v=vector(time()) instant-vector)`
returns the hour of the day
for each of the given times in UTC. Returned values are from 0 to 23.
## `idelta()`
`idelta(v range-vector)`
...
...
@@ -251,6 +277,12 @@ The special cases are equivalent to those in `ln`.
`log10(v instant-vector)`
calculates the decimal logarithm for all elements in
`v`
.
The special cases are equivalent to those in
`ln`
.
## `month()`
`month(v=vector(time()) instant-vector)`
returns the month of the year for each
of the given times in UTC. Returned values are from 1 to 12, where 1 means
January etc.
## `predict_linear()`
`predict_linear(v range-vector, t scalar)`
predicts the value of time series
...
...
@@ -325,6 +357,12 @@ expression is to be evaluated.
`vector(s scalar)`
returns the scalar
`s`
as a vector with no labels.
## `year()`
`year(v=vector(time()) instant-vector)`
returns the year
for each of the given times in UTC.
## `<aggregation>_over_time()`
The following functions allow aggregating each series of a given range vector
...
...
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