Ingesting Prometheus metrics into Uptrace
There are 2 ways to ingest Prometheus metrics into Uptrace:
- Using Prometheus Remote Write with the Uptrace endpoint.
- Using the OpenTelemetry Collector Prometheus receiver and the OTLP exporter.
Prometheus remote write
TIP
Prometheus remote write is recommended over OTLP when using Uptrace as a Grafana data source.
Prometheus Remote Write allows Prometheus to send its collected metrics data to a long-term storage solution such as Uptrace.
You can configure Prometheus Remote Write using the following endpoint:
remote_write:
- url: 'https://api.uptrace.dev/api/v1/prometheus/write'
headers: { 'uptrace-dsn': 'https://token@api.uptrace.dev/project_id' }
remote_write:
- url: 'http://localhost:14318/api/v1/prometheus/write'
headers: { 'uptrace-dsn': 'http://project2_secret_token@localhost:14318?grpc=14317' }
OpenTelemetry Collector
OpenTelemetry Collector is a proxy service between your application and a distributed tracing tool. Collector receives telemetry data, transforms the data, and then exports it to tracing tools that can store the data permanently.
Collector can also act as an agent that pulls telemetry data from monitored systems, for example, Redis or filesystem metrics.
Prometheus receiver
Prometheus uses a pull model for data collection. In a pull-based model, Prometheus acts as a client, actively retrieving metrics from the targets (servers, applications, or other data sources) it monitors.
You can use OpenTelemetry Collector instead of Prometheus to pull metrics using the prometheus_simple receiver:
receivers:
prometheus_simple:
collection_interval: 10s
endpoint: '172.17.0.5:9153'
metrics_path: '/metrics'
use_service_account: false
tls:
ca_file: '/path/to/ca'
cert_file: '/path/to/cert'
key_file: '/path/to/key'
insecure_skip_verify: true
And then export the metrics to Uptrace using OpenTelemetry protocol:
exporters:
otlp:
endpoint: https://otlp.uptrace.dev:4317
headers:
headers: { 'uptrace-dsn': 'https://token@api.uptrace.dev/project_id' }
service:
pipelines:
metrics:
receivers: [prometheus_simple]
exporters: [otlp]
exporters:
otlp:
endpoint: http://localhost:14317
headers:
headers: { 'uptrace-dsn': 'http://project2_secret_token@localhost:14318?grpc=14317' }
service:
pipelines:
metrics:
receivers: [prometheus_simple]
exporters: [otlp]
See OpenTelemetry Prometheus Metrics for details.