• Home
  • Extend
  • OpenTelemetry
  • Getting started
  • Metrics
  • Ingest OpenTelemetry metrics
  • Send metrics via OTLP (OpenTelemetry Protocol) metrics exporter

Send metrics via OTLP (OpenTelemetry Protocol) metrics exporter

To export your application metrics to Dynatrace using the OTLP metrics exporter

  1. Add the OTLP exporter library as a dependency to your application.
  2. Register and configure the exporter through the OpenTelemetry SDK.

OTLP Metrics endpoint

Configure your exporter to send metrics to your Dynatrace environment URL and an API token with the Ingest metrics permission. We recommend that you limit the token scope to only this permission.

  • To learn how to obtain an API token, see Tokens and authentication
  • To determine your metric ingestion endpoint, see Export with OTLP
  • To learn how to send metrics from your application via OTLP to a collector, see Send metrics via the OpenTelemetry collector

OpenTelemetry Metrics

Example - Install the OTLP metrics exporter using NPM

The following is an example of setting up the exporter in JavaScript. Note that the url and <TOKEN> fields are only examples.

shell
npm install --save @opentelemetry/exporter-metrics-otlp-proto
typescript
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-proto'); // configure API endpoint and authentication token const exporter = new OTLPMetricExporter({ // directly in code for illustration purpose only. Consider using environment variables url: "https://myenv123.live.dynatrace.com/api/v2/otlp/v1/metrics", headers: { Authorization: "Api-Token <TOKEN>" }, temporalityPreference: AggregationTemporality.DELTA });
Related topics
  • Metrics

    Learn about OpenTelemetry metrics.