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
19bb6bc9
Commit
19bb6bc9
authored
Mar 13, 2015
by
Julius Volz
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #51 from fabxc/fabxc/vector_matching
Fix usage of include labels in group modifiers.
parents
901ee888
e618f76a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
22 deletions
+21
-22
operators.md
content/docs/querying/operators.md
+21
-22
No files found.
content/docs/querying/operators.md
View file @
19bb6bc9
...
@@ -95,15 +95,15 @@ The `on` keyword allows reducing the set of considered labels to a provided list
...
@@ -95,15 +95,15 @@ The `on` keyword allows reducing the set of considered labels to a provided list
Example input:
Example input:
method:http_errors:rate5m{method="get", code="500"} 24
method:http_errors:rate5m{
source="internal",
method="get", code="500"} 24
method:http_errors:rate5m{method="get", code="404"} 30
method:http_errors:rate5m{
source="external",
method="get", code="404"} 30
method:http_errors:rate5m{
method="put", code="500
"} 3
method:http_errors:rate5m{
source="internal", method="put", code="501
"} 3
method:http_errors:rate5m{method="post", code="500"} 6
method:http_errors:rate5m{
source="internal",
method="post", code="500"} 6
method:http_errors:rate5m{method="post", code="404"} 21
method:http_errors:rate5m{
source="external",
method="post", code="404"} 21
method:http_requests:rate5m{
domain="example.com",
method="get"} 600
method:http_requests:rate5m{method="get"} 600
method:http_requests:rate5m{
domain="example.com",
method="del"} 34
method:http_requests:rate5m{method="del"} 34
method:http_requests:rate5m{
domain="example.com",
method="post"} 120
method:http_requests:rate5m{method="post"} 120
Example query:
Example query:
...
@@ -125,10 +125,9 @@ left/right determines which vector has the higher cardinality.
...
@@ -125,10 +125,9 @@ left/right determines which vector has the higher cardinality.
<vector expr> <bin-op> on(<label list>) group_left(<label list>) <vector expr>
<vector expr> <bin-op> on(<label list>) group_left(<label list>) <vector expr>
<vector expr> <bin-op> on(<label list>) group_right(<label list>) <vector expr>
<vector expr> <bin-op> on(<label list>) group_right(<label list>) <vector expr>
The label list provided with the group modifier contains additional labels to be included in
The label list provided with the group modifier contains additional labels from the "many"-side
the result metrics. A label can only appear in one of the lists. Every time
to be included in the result metrics. A label can only appear in one of the lists. Every time
series of the result vector must be uniquely identifiable by the labels from both lists
series of the result vector must be uniquely identifiable by the labels from both lists combined.
combined.
_Grouping modifiers can only be used for
[
comparison/filtering
](
#comparison-/-filter-binary-operators
)
_Grouping modifiers can only be used for
[
comparison/filtering
](
#comparison-/-filter-binary-operators
)
and
[
arithmetic
](
#arithmetic-binary-operators
)
operations as
`and`
and
`or`
operations
and
[
arithmetic
](
#arithmetic-binary-operators
)
operations as
`and`
and
`or`
operations
...
@@ -136,18 +135,18 @@ match with all possible entries in the right vector by default._
...
@@ -136,18 +135,18 @@ match with all possible entries in the right vector by default._
Example query:
Example query:
method:http_errors:rate5m / on(method) group_left(code,
domain
) method:http_requests:rate5m
method:http_errors:rate5m / on(method) group_left(code,
source
) method:http_requests:rate5m
In this case the left vector contains more than one entry per
`method`
label value. Thus,
In this case the left vector contains more than one entry per
`method`
label value. Thus,
we indicate this using
`group_left`
and provide
`code`
as the label that ensures that
we indicate this using
`group_left`
. To ensure that the result vector entries are unique, additional
the result vector entries are unique. The
`domain`
label name simply requests to include the
labels have to be provided. Either
`code`
or
`source`
satisfy this requirement, but both
label into the result elements. The elements from the right side are now matched with multipl
e
can be added for a more detailed result. The elements from the right sid
e
elements with the same
`method`
label on the left:
are now matched with multiple
elements with the same
`method`
label on the left:
{
domain="example.com
", method="get", code="500"} 0.04 // 24 / 600
{
source="internal
", method="get", code="500"} 0.04 // 24 / 600
{
domain="example.com
", method="get", code="404"} 0.05 // 30 / 600
{
source="external
", method="get", code="404"} 0.05 // 30 / 600
{
domain="example.com
", method="post", code="500"} 0.1 // 12 / 120
{
source="internal
", method="post", code="500"} 0.1 // 12 / 120
{
domain="example.com
", method="post", code="404"} 0.175 // 21 / 120
{
source="external
", method="post", code="404"} 0.175 // 21 / 120
_Many-to-one and one-to-many matching are advanced use cases that should be carefully considered.
_Many-to-one and one-to-many matching are advanced use cases that should be carefully considered.
Often a proper use of
`on(<labels>)`
provides the desired outcome._
Often a proper use of
`on(<labels>)`
provides the desired outcome._
...
...
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