Document that string fields do not produce prometheus metrics (#7644)

This commit is contained in:
Daniel Nelson 2020-06-18 11:03:11 -07:00 committed by GitHub
parent 5b84d3ba92
commit 8c017661dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View File

@ -3,10 +3,9 @@
This plugin starts a [Prometheus](https://prometheus.io/) Client, it exposes This plugin starts a [Prometheus](https://prometheus.io/) Client, it exposes
all metrics on `/metrics` (default) to be polled by a Prometheus server. all metrics on `/metrics` (default) to be polled by a Prometheus server.
## Configuration ### Configuration
```toml ```toml
# Publish all metrics to /metrics for Prometheus to scrape
[[outputs.prometheus_client]] [[outputs.prometheus_client]]
## Address to listen on. ## Address to listen on.
listen = ":9273" listen = ":9273"
@ -52,3 +51,9 @@ all metrics on `/metrics` (default) to be polled by a Prometheus server.
## Export metric collection time. ## Export metric collection time.
# export_timestamp = false # export_timestamp = false
``` ```
### Metrics
Prometheus metrics are produced in the same manner as the [prometheus serializer][].
[prometheus serializer]: /plugins/serializers/prometheus/README.md#Metrics

View File

@ -10,7 +10,7 @@ somewhat, but not fully, mitigated by using outputs that support writing in
"batch format". When using histogram and summary types, it is recommended to "batch format". When using histogram and summary types, it is recommended to
use only the `prometheus_client` output. use only the `prometheus_client` output.
## Configuration ### Configuration
```toml ```toml
[[outputs.file]] [[outputs.file]]
@ -35,6 +35,19 @@ use only the `prometheus_client` output.
data_format = "prometheus" data_format = "prometheus"
``` ```
### Metrics
A Prometheus metric is created for each integer, float, boolean or unsigned
field. Boolean values are converted to *1.0* for true and *0.0* for false.
The Prometheus metric names are produced by joining the measurement name with
the field key. In the special case where the measurement name is `prometheus`
it is not included in the final metric name.
Prometheus labels are produced for each tag.
**Note:** String fields are ignored and do not produce Prometheus metrics.
### Example ### Example
**Example Input** **Example Input**