mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
Fix documented metrics labels to work for k8s 1.16+
This commit is contained in:
parent
2c1be65011
commit
dce6abfba9
3 changed files with 26 additions and 26 deletions
|
|
@ -6,44 +6,44 @@ metadata:
|
||||||
data:
|
data:
|
||||||
config.yaml: |
|
config.yaml: |
|
||||||
rules:
|
rules:
|
||||||
- seriesQuery: '{__name__=~"^container_.*",container_name!="POD",namespace!="",pod_name!=""}'
|
- seriesQuery: '{__name__=~"^container_.*",container!="POD",namespace!="",pod!=""}'
|
||||||
seriesFilters: []
|
seriesFilters: []
|
||||||
resources:
|
resources:
|
||||||
overrides:
|
overrides:
|
||||||
namespace:
|
namespace:
|
||||||
resource: namespace
|
resource: namespace
|
||||||
pod_name:
|
pod:
|
||||||
resource: pod
|
resource: pod
|
||||||
name:
|
name:
|
||||||
matches: ^container_(.*)_seconds_total$
|
matches: ^container_(.*)_seconds_total$
|
||||||
as: ""
|
as: ""
|
||||||
metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}[1m])) by (<<.GroupBy>>)
|
metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>,container!="POD"}[1m])) by (<<.GroupBy>>)
|
||||||
- seriesQuery: '{__name__=~"^container_.*",container_name!="POD",namespace!="",pod_name!=""}'
|
- seriesQuery: '{__name__=~"^container_.*",container!="POD",namespace!="",pod!=""}'
|
||||||
seriesFilters:
|
seriesFilters:
|
||||||
- isNot: ^container_.*_seconds_total$
|
- isNot: ^container_.*_seconds_total$
|
||||||
resources:
|
resources:
|
||||||
overrides:
|
overrides:
|
||||||
namespace:
|
namespace:
|
||||||
resource: namespace
|
resource: namespace
|
||||||
pod_name:
|
pod:
|
||||||
resource: pod
|
resource: pod
|
||||||
name:
|
name:
|
||||||
matches: ^container_(.*)_total$
|
matches: ^container_(.*)_total$
|
||||||
as: ""
|
as: ""
|
||||||
metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}[1m])) by (<<.GroupBy>>)
|
metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>,container!="POD"}[1m])) by (<<.GroupBy>>)
|
||||||
- seriesQuery: '{__name__=~"^container_.*",container_name!="POD",namespace!="",pod_name!=""}'
|
- seriesQuery: '{__name__=~"^container_.*",container!="POD",namespace!="",pod!=""}'
|
||||||
seriesFilters:
|
seriesFilters:
|
||||||
- isNot: ^container_.*_total$
|
- isNot: ^container_.*_total$
|
||||||
resources:
|
resources:
|
||||||
overrides:
|
overrides:
|
||||||
namespace:
|
namespace:
|
||||||
resource: namespace
|
resource: namespace
|
||||||
pod_name:
|
pod:
|
||||||
resource: pod
|
resource: pod
|
||||||
name:
|
name:
|
||||||
matches: ^container_(.*)$
|
matches: ^container_(.*)$
|
||||||
as: ""
|
as: ""
|
||||||
metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}) by (<<.GroupBy>>)
|
metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>,container!="POD"}) by (<<.GroupBy>>)
|
||||||
- seriesQuery: '{namespace!="",__name__!~"^container_.*"}'
|
- seriesQuery: '{namespace!="",__name__!~"^container_.*"}'
|
||||||
seriesFilters:
|
seriesFilters:
|
||||||
- isNot: .*_total$
|
- isNot: .*_total$
|
||||||
|
|
@ -80,9 +80,9 @@ data:
|
||||||
resource: node
|
resource: node
|
||||||
namespace:
|
namespace:
|
||||||
resource: namespace
|
resource: namespace
|
||||||
pod_name:
|
pod:
|
||||||
resource: pod
|
resource: pod
|
||||||
containerLabel: container_name
|
containerLabel: container
|
||||||
memory:
|
memory:
|
||||||
containerQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>}) by (<<.GroupBy>>)
|
containerQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>}) by (<<.GroupBy>>)
|
||||||
nodeQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>,id='/'}) by (<<.GroupBy>>)
|
nodeQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>,id='/'}) by (<<.GroupBy>>)
|
||||||
|
|
@ -92,9 +92,9 @@ data:
|
||||||
resource: node
|
resource: node
|
||||||
namespace:
|
namespace:
|
||||||
resource: namespace
|
resource: namespace
|
||||||
pod_name:
|
pod:
|
||||||
resource: pod
|
resource: pod
|
||||||
containerLabel: container_name
|
containerLabel: container
|
||||||
window: 1m
|
window: 1m
|
||||||
externalRules:
|
externalRules:
|
||||||
- seriesQuery: '{__name__=~"^.*_queue_(length|size)$",namespace!=""}'
|
- seriesQuery: '{__name__=~"^.*_queue_(length|size)$",namespace!=""}'
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,13 @@ might look like:
|
||||||
```yaml
|
```yaml
|
||||||
rules:
|
rules:
|
||||||
# this rule matches cumulative cAdvisor metrics measured in seconds
|
# this rule matches cumulative cAdvisor metrics measured in seconds
|
||||||
- seriesQuery: '{__name__=~"^container_.*",container_name!="POD",namespace!="",pod_name!=""}'
|
- seriesQuery: '{__name__=~"^container_.*",container!="POD",namespace!="",pod!=""}'
|
||||||
resources:
|
resources:
|
||||||
# skip specifying generic resource<->label mappings, and just
|
# skip specifying generic resource<->label mappings, and just
|
||||||
# attach only pod and namespace resources by mapping label names to group-resources
|
# attach only pod and namespace resources by mapping label names to group-resources
|
||||||
overrides:
|
overrides:
|
||||||
namespace: {resource: "namespace"},
|
namespace: {resource: "namespace"},
|
||||||
pod_name: {resource: "pod"},
|
pod: {resource: "pod"},
|
||||||
# specify that the `container_` and `_seconds_total` suffixes should be removed.
|
# specify that the `container_` and `_seconds_total` suffixes should be removed.
|
||||||
# this also introduces an implicit filter on metric family names
|
# this also introduces an implicit filter on metric family names
|
||||||
name:
|
name:
|
||||||
|
|
@ -48,7 +48,7 @@ rules:
|
||||||
# This is a Go template where the `.Series` and `.LabelMatchers` string values
|
# This is a Go template where the `.Series` and `.LabelMatchers` string values
|
||||||
# are available, and the delimiters are `<<` and `>>` to avoid conflicts with
|
# are available, and the delimiters are `<<` and `>>` to avoid conflicts with
|
||||||
# the prometheus query language
|
# the prometheus query language
|
||||||
metricsQuery: "sum(rate(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}[2m])) by (<<.GroupBy>>)"
|
metricsQuery: "sum(rate(<<.Series>>{<<.LabelMatchers>>,container!="POD"}[2m])) by (<<.GroupBy>>)"
|
||||||
```
|
```
|
||||||
|
|
||||||
Discovery
|
Discovery
|
||||||
|
|
@ -83,7 +83,7 @@ For example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# match all cAdvisor metrics that aren't measured in seconds
|
# match all cAdvisor metrics that aren't measured in seconds
|
||||||
seriesQuery: '{__name__=~"^container_.*_total",container_name!="POD",namespace!="",pod_name!=""}'
|
seriesQuery: '{__name__=~"^container_.*_total",container!="POD",namespace!="",pod!=""}'
|
||||||
seriesFilters:
|
seriesFilters:
|
||||||
- isNot: "^container_.*_seconds_total"
|
- isNot: "^container_.*_seconds_total"
|
||||||
```
|
```
|
||||||
|
|
@ -211,5 +211,5 @@ For example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# convert cumulative cAdvisor metrics into rates calculated over 2 minutes
|
# convert cumulative cAdvisor metrics into rates calculated over 2 minutes
|
||||||
metricsQuery: "sum(rate(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}[2m])) by (<<.GroupBy>>)"
|
metricsQuery: "sum(rate(<<.Series>>{<<.LabelMatchers>>,container!="POD"}[2m])) by (<<.GroupBy>>)"
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,13 @@ rules:
|
||||||
# can be found in pkg/config/default.go
|
# can be found in pkg/config/default.go
|
||||||
|
|
||||||
# this rule matches cumulative cAdvisor metrics measured in seconds
|
# this rule matches cumulative cAdvisor metrics measured in seconds
|
||||||
- seriesQuery: '{__name__=~"^container_.*",container_name!="POD",namespace!="",pod_name!=""}'
|
- seriesQuery: '{__name__=~"^container_.*",container!="POD",namespace!="",pod!=""}'
|
||||||
resources:
|
resources:
|
||||||
# skip specifying generic resource<->label mappings, and just
|
# skip specifying generic resource<->label mappings, and just
|
||||||
# attach only pod and namespace resources by mapping label names to group-resources
|
# attach only pod and namespace resources by mapping label names to group-resources
|
||||||
overrides:
|
overrides:
|
||||||
namespace: {resource: "namespace"},
|
namespace: {resource: "namespace"},
|
||||||
pod_name: {resource: "pod"},
|
pod: {resource: "pod"},
|
||||||
# specify that the `container_` and `_seconds_total` suffixes should be removed.
|
# specify that the `container_` and `_seconds_total` suffixes should be removed.
|
||||||
# this also introduces an implicit filter on metric family names
|
# this also introduces an implicit filter on metric family names
|
||||||
name:
|
name:
|
||||||
|
|
@ -27,19 +27,19 @@ rules:
|
||||||
# This is a Go template where the `.Series` and `.LabelMatchers` string values
|
# This is a Go template where the `.Series` and `.LabelMatchers` string values
|
||||||
# are available, and the delimiters are `<<` and `>>` to avoid conflicts with
|
# are available, and the delimiters are `<<` and `>>` to avoid conflicts with
|
||||||
# the prometheus query language
|
# the prometheus query language
|
||||||
metricsQuery: "sum(rate(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}[2m])) by (<<.GroupBy>>)"
|
metricsQuery: "sum(rate(<<.Series>>{<<.LabelMatchers>>,container!="POD"}[2m])) by (<<.GroupBy>>)"
|
||||||
|
|
||||||
# this rule matches cumulative cAdvisor metrics not measured in seconds
|
# this rule matches cumulative cAdvisor metrics not measured in seconds
|
||||||
- seriesQuery: '{__name__=~"^container_.*_total",container_name!="POD",namespace!="",pod_name!=""}'
|
- seriesQuery: '{__name__=~"^container_.*_total",container!="POD",namespace!="",pod!=""}'
|
||||||
resources:
|
resources:
|
||||||
overrides:
|
overrides:
|
||||||
namespace: {resource: "namespace"},
|
namespace: {resource: "namespace"},
|
||||||
pod_name: {resource: "pod"},
|
pod: {resource: "pod"},
|
||||||
seriesFilters:
|
seriesFilters:
|
||||||
# since this is a superset of the query above, we introduce an additional filter here
|
# since this is a superset of the query above, we introduce an additional filter here
|
||||||
- isNot: "^container_.*_seconds_total$"
|
- isNot: "^container_.*_seconds_total$"
|
||||||
name: {matches: "^container_(.*)_total$"}
|
name: {matches: "^container_(.*)_total$"}
|
||||||
metricsQuery: "sum(rate(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}[2m])) by (<<.GroupBy>>)"
|
metricsQuery: "sum(rate(<<.Series>>{<<.LabelMatchers>>,container!="POD"}[2m])) by (<<.GroupBy>>)"
|
||||||
|
|
||||||
# this rule matches cumulative non-cAdvisor metrics
|
# this rule matches cumulative non-cAdvisor metrics
|
||||||
- seriesQuery: '{namespace!="",__name__!="^container_.*"}'
|
- seriesQuery: '{namespace!="",__name__!="^container_.*"}'
|
||||||
|
|
@ -52,7 +52,7 @@ rules:
|
||||||
# Group will be converted to a form acceptible for use as a label automatically.
|
# Group will be converted to a form acceptible for use as a label automatically.
|
||||||
template: "<<.Resource>>"
|
template: "<<.Resource>>"
|
||||||
# if we wanted to, we could also specify overrides here
|
# if we wanted to, we could also specify overrides here
|
||||||
metricsQuery: "sum(rate(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}[2m])) by (<<.GroupBy>>)"
|
metricsQuery: "sum(rate(<<.Series>>{<<.LabelMatchers>>,container!="POD"}[2m])) by (<<.GroupBy>>)"
|
||||||
|
|
||||||
# this rule matches only a single metric, explicitly naming it something else
|
# this rule matches only a single metric, explicitly naming it something else
|
||||||
# It's series query *must* return only a single metric family
|
# It's series query *must* return only a single metric family
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue