Commit a38ac1d8 authored by Julius Volz's avatar Julius Volz

Improve query language basics docs.

parent 09f53a6f
...@@ -15,39 +15,15 @@ browser, or consumed by external systems via the HTTP API. ...@@ -15,39 +15,15 @@ browser, or consumed by external systems via the HTTP API.
This document is meant as a reference. For learning, it might be easier to This document is meant as a reference. For learning, it might be easier to
start with a couple of [examples](/docs/using/querying/examples). start with a couple of [examples](/docs/using/querying/examples).
## Basic Concepts
### Time series
Data in Prometheus is stored as time series, which are uniquely identified by a
metric name and a set of arbitrary label/value pairs. Each time series can have
one or more data points attached to it. Data points are timestamp/value pairs.
#### Metric name
The metric name of a time series (e.g. `http_requests_total`) specifies the
general feature of a system that is measured. It may contain alpha-numeric
characters, plus underscores and colons.
#### Labels
The label/value pairs which identify a time series allow later filtering and
aggregation by these dimensions (e.g. `endpoint`, `response_code`, `instance`). Label keys
are identifiers (alpha-numeric characters plus underscores, but no colons),
while their values may be arbitrary strings.
#### Data points
Each time series can have one or more data points attached to it, which are
timestamp/value pairs. Values are always encoded as floating-point numbers
(currently 64-bit precision).
## Expression Language Data Types ## Expression Language Data Types
In Prometheus' expression language, an expression or sub-expression can In Prometheus's expression language, an expression or sub-expression can
evaluate to one of four types: evaluate to one of four types:
* **string** * **Instant vector** - a set of time series containing a single sample for each time series, all sharing the same timestamp
* **scalar** - simple numeric floating point value * **Range vector** - a set of time series containing a range of data points over time for each time series
* **instant vector** - vector of multiple time series, containing a single sample for each time series, with all samples sharing the same (instant) timestamp * **Scalar** - a simple numeric floating point value
* **range vector** - vector of multiple time series, containing a range of data points over time for each time series * **String** - a simple string value; currently unused
Depending on the use-case (e.g. when graphing vs. displaying the output of an Depending on the use-case (e.g. when graphing vs. displaying the output of an
expression), only some of these types are legal as the result from a expression), only some of these types are legal as the result from a
...@@ -134,15 +110,15 @@ a `job` label set to `prometheus`: ...@@ -134,15 +110,15 @@ a `job` label set to `prometheus`:
## Operators ## Operators
Prometheus supports many binary and aggregation operators. These are described Prometheus supports many binary and aggregation operators. These are described
in detail in the [[Expression Language Operators] page. in detail in the [expression language operators](/docs/querying/operators) page.
## Functions ## Functions
Prometheus supports several functions to operate on data. These are described Prometheus supports several functions to operate on data. These are described
in detail in the [[Expression Language Functions]] page. in detail in the [expression language functions](/docs/querying/functions) page.
## Gotchas ## Gotchas
TODO: TODO: explain staleness and inerpolation
* staleness and interpolation
* ... TODO: explain avoiding slow queries
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