Caution
Grafana Agent has reached End-of-Life (EOL) on November 1, 2025. Agent is no longer receiving vendor support and will no longer receive security or bug fixes. Current users of Agent Static mode, Agent Flow mode, and Agent Operator should proceed with migrating to Grafana Alloy. If you have already migrated to Alloy, no further action is required. Read more about why we recommend migrating to Grafana Alloy.
otelcol.exporter.prometheus
otelcol.exporter.prometheus accepts OTLP-formatted metrics from other
otelcol components, converts metrics to Prometheus-formatted metrics,
and forwards the resulting metrics to prometheus components.
NOTE:
otelcol.exporter.prometheusis a custom component unrelated to theprometheusexporter from OpenTelemetry Collector.Conversion of metrics are done according to the OpenTelemetry Metrics Data Model specification.
Multiple otelcol.exporter.prometheus components can be specified by giving them
different labels.
Usage
otelcol.exporter.prometheus "LABEL" {
forward_to = [...]
}Arguments
otelcol.exporter.prometheus supports the following arguments:
By default, OpenTelemetry resources are converted into target_info metrics.
OpenTelemetry instrumentation scopes are converted into otel_scope_info
metrics. Set the include_scope_info and include_target_info arguments to
false, respectively, to disable the custom metrics.
When include_scope_labels is true the otel_scope_name and
otel_scope_version labels are added to every converted metric sample.
When include_target_info is true, OpenTelemetry Collector resources are converted into target_info metrics.
Note
OTLP metrics can have a lot of resource attributes. Setting
resource_to_telemetry_conversiontotruewould convert all of them to Prometheus labels, which may not be what you want. Instead of usingresource_to_telemetry_conversion, most users need to useotelcol.processor.transformto convert OTLP resource attributes to OTLP metric datapoint attributes before usingotelcol.exporter.prometheus. See Creating Prometheus labels from OTLP resource attributes for an example.
Exported fields
The following fields are exported and can be referenced by other components:
input accepts otelcol.Consumer data for metrics. Other telemetry signals are ignored.
Metrics sent to the input are converted to Prometheus-compatible metrics and
are forwarded to the forward_to argument.
The following are dropped during the conversion process:
- Metrics that use the delta aggregation temporality
Component health
otelcol.exporter.prometheus is only reported as unhealthy if given an invalid
configuration.
Debug information
otelcol.exporter.prometheus does not expose any component-specific debug
information.
Example
Basic usage
This example accepts metrics over OTLP and forwards it using
prometheus.remote_write:
otelcol.receiver.otlp "default" {
grpc {}
output {
metrics = [otelcol.exporter.prometheus.default.input]
}
}
otelcol.exporter.prometheus "default" {
forward_to = [prometheus.remote_write.mimir.receiver]
}
prometheus.remote_write "mimir" {
endpoint {
url = "http://mimir:9009/api/v1/push"
}
}Create Prometheus labels from OTLP resource attributes
This example uses otelcol.processor.transform to add extra key1 and key2 OTLP metric datapoint attributes from the
key1 and key2 OTLP resource attributes.
otelcol.exporter.prometheus then converts key1 and key2 to Prometheus labels along with any other OTLP metric datapoint attributes.
This avoids the need to set resource_to_telemetry_conversion to true,
which could have created too many unnecessary metric labels.
otelcol.receiver.otlp "default" {
grpc {}
output {
metrics = [otelcol.processor.transform.default.input]
}
}
otelcol.processor.transform "default" {
error_mode = "ignore"
metric_statements {
context = "datapoint"
statements = [
`set(attributes["key1"], resource.attributes["key1"])`,
`set(attributes["key2"], resource.attributes["key2"])`,
]
}
output {
metrics = [otelcol.exporter.prometheus.default.input]
}
}
otelcol.exporter.prometheus "default" {
forward_to = [prometheus.remote_write.mimir.receiver]
}
prometheus.remote_write "mimir" {
endpoint {
url = "http://mimir:9009/api/v1/push"
}
}Compatible components
otelcol.exporter.prometheus can accept arguments from the following components:
- Components that export Prometheus
MetricsReceiver
otelcol.exporter.prometheus has exports that can be consumed by the following components:
- Components that consume OpenTelemetry
otelcol.Consumer
Note
Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.



