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.
See Collector Deployment and Collector Configuration on how to set up your Collector with the configuration below.
receivers:prometheus:config:scrape_configs:- job_name: 'node-exporter'scrape_interval: 60sstatic_configs:- targets: ['prometheus-prometheus-node-exporter:9100']- job_name: opentelemetry-collectorscrape_interval: 60sstatic_configs:- targets:- 127.0.0.1:8888processors:cumulativetodelta:exporters:otlphttp:endpoint: ${env:DT_ENDPOINT}headers:Authorization: "Api-Token ${env:DT_API_TOKEN}"service:pipelines:metrics:receivers: [prometheus]processors: [cumulativetodelta]exporters: [otlphttp]
Validate your settings to avoid any configuration issues.
For our configuration, we configure the following components.
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.
Under processors, we specify the cumulativetodelta processor to convert the metrics emitted by the Prometheus receiver to their delta aggregation format.
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.
DT_ENDPOINT contains the base URL of the Dynatrace API endpoint (for example, https://{your-environment-id}.live.dynatrace.com/api/v2/otlp)DT_API_TOKEN contains the API tokenUnder 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.
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: