You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document and fix recorded metric forwarding (#266)
This should address most of #104
- fix target cache lookup for recorded metrics
- update documentation with examples
Also: allow overriding docker FROM target with DOCKER_IMAGE_BASE env var
(helpful for testing and runtime scenarios where /bin/sh is needed)
This drops all series which do not have a `job` label `k8s` and all metrics that have a name starting with `cadvisor_`.
72
72
73
-
For equality filter on metric name you can use the simpler notation, e.g. `--include='metric_name{label="foo"}'`.
73
+
For equality filter on metric name you can use the simpler notation, e.g.,`--include='metric_name{label="foo"}'`.
74
74
75
75
The flag may be repeated to provide several sets of filters, in which case the metric will be forwarded if it matches at least one of them. Please note that inclusion filters only apply to Prometheus metrics proxied directly, and do not apply to [aggregated counters](#counter-aggregator).
76
76
@@ -95,6 +95,28 @@ static_metadata:
95
95
* All `static_metadata` entries must have `type` specified. This specifies the Stackdriver metric type and overrides the metric type chosen by the Prometheus client.
96
96
* If `value_type` is specified, it will override the default value type for counters and gauges. All Prometheus metrics have a default type of double.
97
97
98
+
#### Dealing with recording rules
99
+
100
+
The default Prometheus naming format for [recording rules](https://prometheus.io/docs/practices/rules/) is `level:metric:operations`, e.g., `instance:requests_total:sum`, but colons are not allowed in Stackdriver metric descriptor names. To forward a recorded Prometheus metric to Stackdriver, you must use the `metric_renames` feature to replace the colon characters:
101
+
102
+
```yaml
103
+
metric_renames:
104
+
- from: instance:requests_total:sum
105
+
to: recorded_instance_requests_total_sum
106
+
```
107
+
108
+
Additionally, the sidecar assumes that any recorded metrics are gauges. If this is not the case (e.g., for a Prometheus counter metric) you will need to specify that in `static_metadata`:
109
+
110
+
```yaml
111
+
static_metadata:
112
+
- metric: recorded_instance_requests_total_sum
113
+
type: counter
114
+
value_type: int64
115
+
help: an arbitrary help string
116
+
```
117
+
118
+
*Warning:* recorded metrics _must_ have minimally an "instance" and "job" label, otherwise they will not be forwarded.
119
+
98
120
#### Counter Aggregator
99
121
100
122
Counter Aggregator is an advanced feature of the sidecar that can be used to export a sum of multiple Prometheus counters to Stackdriver as a single CUMULATIVE metric.
0 commit comments