Scrape data from Prometheus

The following configuration example shows how you configure a Collector instance to scrape data from an existing Prometheus setup and import it as OTLP request into Dynatrace.

Prerequisites

Demo configuration

receivers:
prometheus:
config:
scrape_configs:
- job_name: 'node-exporter'
scrape_interval: 60s
static_configs:
- targets: ['prometheus-prometheus-node-exporter:9100']
- job_name: opentelemetry-collector
scrape_interval: 60s
static_configs:
- targets:
- 127.0.0.1:8888
processors:
cumulativetodelta:
exporters:
otlphttp:
endpoint: ${env:DT_ENDPOINT}
headers:
Authorization: "Api-Token ${env:DT_API_TOKEN}"
service:
pipelines:
metrics:
receivers: [prometheus]
processors: [cumulativetodelta]
exporters: [otlphttp]
Configuration validation

Validate your settings to avoid any configuration issues.

Components

For our configuration, we configure the following components.

Receivers

Under receivers, we specify the prometheus receiver as active receiver component for our Collector instance. We configure the receiver with the two jobs node-exporter and opentelemetry-collector under scrape_configs, to fetch data from the specified hosts once a minute (scrape_interval: 60s).

For a full list of configuration parameters, see the Prometheus documentation.

Processors

Under processors, we specify the cumulativetodelta processor to convert the metrics emitted by the Prometheus receiver to their delta aggregation format.

Exporters

Under exporters, we specify the default otlphttp exporter and configure it with our Dynatrace API URL and the required authentication token.

For this purpose, we set the following two environment variables and reference them in the configuration values for endpoint and Authorization.

Service pipeline

Under service, we assemble our receiver, processor, and exporter objects into a metrics pipeline, which will execute the Prometheus jobs, convert their metrics to delta values, and ingest the data into Dynatrace.

Limits and limitations

Metrics are ingested using the OpenTelemetry protocol (OTLP) via the Dynatrace OTLP API and are subject to the API's limits and restrictions. For more information see: