Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remove recommendation for prometheus metric_version=2 #11158

Merged
merged 2 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions plugins/inputs/prometheus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ in Prometheus format.
## value in both plugins to ensure metrics are round-tripped without
## modification.
##
## example: metric_version = 1;
## metric_version = 2; recommended version
## example: metric_version = 1;
## metric_version = 2;
# metric_version = 1

## Url tag name (tag containing scrapped url. optional, default is "url")
Expand Down Expand Up @@ -104,6 +104,35 @@ in Prometheus format.

`urls` can contain a unix socket as well. If a different path is required (default is `/metrics` for both http[s] and unix) for a unix socket, add `path` as a query parameter as follows: `unix:///var/run/prometheus.sock?path=/custom/metrics`

### Metric Format Configuration

The `metric_version` setting controls how telegraf translates prometheus format
metrics to telegraf metrics. There are two options.

With `metric_version = 1`, the prometheus metric name becomes the telegraf
metric name. Prometheus labels become telegraf tags. Prometheus values become
telegraf field values. The fields have generic keys based on the type of the
prometheus metric. This option produces metrics that are dense (not
sparse). Denseness is a useful property for some outputs, including those that
are more efficient with row-oriented data.

`metric_version = 2` differs in a few ways. The prometheus metric name becomes a
telegraf field key. Metrics hold more than one value and the field keys aren't
generic. The resulting metrics are sparse, but for some outputs they may be
easier to process or query, including those that are more efficient with
column-oriented data. The telegraf metric name is the same for all metrics in
the input instance. It can be set with the `name_override` setting and defaults
to "prometheus". To have multiple metric names, you can use multiple instances
of the plugin, each with its own `name_override`.
srebhan marked this conversation as resolved.
Show resolved Hide resolved

`metric_version = 2` uses the same histogram format as the [histogram
aggregator](../../aggregators/histogram/README.md)

The Example Outputs sections shows examples for both options.

When using this plugin along with the prometheus_client output, use the same
option in both to ensure metrics are round-tripped without modification.
reimda marked this conversation as resolved.
Show resolved Hide resolved

### Kubernetes Service Discovery

URLs listed in the `kubernetes_services` parameter will be expanded
Expand Down
2 changes: 1 addition & 1 deletion plugins/outputs/prometheus_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metrics on `/metrics` (default) to be polled by a Prometheus server.
## both plugins to ensure metrics are round-tripped without modification.
##
## example: metric_version = 1;
## metric_version = 2; recommended version
## metric_version = 2;
srebhan marked this conversation as resolved.
Show resolved Hide resolved
# metric_version = 1

## Use HTTP Basic Authentication.
Expand Down