Documentation

Prometheus output data format

Use the prometheus output data format (serializer) to convert Telegraf metrics into the Prometheus text exposition format.

When used with the prometheus input plugin, set metric_version = 2 in the input to properly round-trip metrics.

Configuration

[[outputs.file]]
  files = ["stdout"]
  data_format = "prometheus"

  ## Optional: Enable batch serialization for improved efficiency.
  ## This is an output plugin option that affects how the serializer
  ## receives metrics.
  # use_batch_format = false

  ## Serializer options (prometheus-specific)
  # prometheus_export_timestamp = false
  # prometheus_sort_metrics = false
  # prometheus_string_as_label = false
  # prometheus_compact_encoding = false

Serializer options

OptionTypeDefaultDescription
prometheus_export_timestampbooleanfalseInclude timestamp on each sample
prometheus_sort_metricsbooleanfalseSort metric families and samples (useful for debugging)
prometheus_string_as_labelbooleanfalseConvert string fields to labels
prometheus_compact_encodingbooleanfalseOmit HELP metadata to reduce payload size

Metric type mappings

Use prometheus_metric_types to explicitly set metric types, overriding Telegraf’s automatic type detection. Supports glob patterns.

[[outputs.file]]
  files = ["stdout"]
  data_format = "prometheus"

  [outputs.file.prometheus_metric_types]
    counter = ["*_total", "*_count"]
    gauge = ["*_current", "*_ratio"]

Metric naming

Prometheus metric names are created by joining the measurement name with the field key.

Special case: When the measurement name is prometheus, it is not included in the final metric name.

Labels

Prometheus labels are created from Telegraf tags. String fields are ignored by default and do not produce Prometheus metrics. Set prometheus_string_as_label = true to convert string fields to labels. Set log_level = "trace" to see serialization issues.

Histograms and summaries

Histogram and summary metrics require special consideration. These metric types accumulate state across observations:

  • Histograms count observations in configurable buckets
  • Summaries calculate quantiles over a sliding time window

Use prometheus_client for histograms and summaries

Serializers process metrics in batches and have no memory of previous batches. When histogram or summary data arrives across multiple batches, the serializer cannot combine them correctly.

For example, a histogram with 10 buckets might arrive as:

  • Batch 1: buckets 1-5
  • Batch 2: buckets 6-10

The serializer outputs each batch independently, producing two incomplete histograms instead of one complete histogram.

The prometheus_client output plugin maintains metric state in memory and produces correct output regardless of batch boundaries.

# Recommended for histogram/summary metrics
[[outputs.prometheus_client]]
  listen = ":9273"

Use the serializer for counters and gauges

For counters and gauges, the prometheus serializer works well. Enable use_batch_format = true in your output plugin for more efficient output.

[[outputs.file]]
  files = ["stdout"]
  data_format = "prometheus"
  use_batch_format = true

Was this page helpful?

Thank you for your feedback!


InfluxDB 3.9: Performance upgrade preview

InfluxDB 3 Enterprise 3.9 includes a beta of major performance upgrades with faster single-series queries, wide-and-sparse table support, and more.

InfluxDB 3 Enterprise 3.9 includes a beta of major performance and feature updates.

Key improvements:

  • Faster single-series queries
  • Consistent resource usage
  • Wide-and-sparse table support
  • Automatic distinct value caches for reduced latency with metadata queries

Preview features are subject to breaking changes.

For more information, see:

Telegraf Enterprise now in public beta

Get early access to the Telegraf Controller and provide feedback to help shape the future of Telegraf Enterprise.

See the Blog Post

The upcoming Telegraf Enterprise offering is for organizations running Telegraf at scale and is comprised of two key components:

  • Telegraf Controller: A control plane (UI + API) that centralizes Telegraf configuration management and agent health visibility.
  • Telegraf Enterprise Support: Official support for Telegraf Controller and Telegraf plugins.

Join the Telegraf Enterprise beta to get early access to the Telegraf Controller and provide feedback to help shape the future of Telegraf Enterprise.

For more information:

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On May 27, 2026, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2