• Home
  • Extend Dynatrace
  • Send data to Dynatrace with OpenTelemetry
  • OpenTelemetry metrics
  • Ingest metrics
  • Send metrics via the Dynatrace OpenTelemetry metrics exporter

Send metrics via the Dynatrace OpenTelemetry metrics exporter

To export your application metrics to Dynatrace using a Dynatrace-provided metrics exporter

  1. Add the exporter library as a dependency to your application.
  2. Register and configure the exporter through the OpenTelemetry API to export metrics.

Host with OneAgent

OpenTelemetry Metrics

Zero configuration

With the OneAgent on the same host, metrics are automatically sent to the OneAgent metric API. In this case, no endpoint or credentials have to be configured for the exporter.

Topology Awareness

The exporters also support the process-related metadata enrichment documented in Enrich metrics with Dynatrace-specific dimensions.

Host without OneAgent

Dynatrace OpenTelemetry Metrics Exporter

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.

Additionally, you can add a custom prefix to ingested metrics keys, so that you can find your metrics quickly in Data explorer.

  • To learn how to obtain an API token, see Tokens and authentication
  • To determine your metric ingestion endpoint, see Metric v2 API

Example - Install the Dynatrace OpenTelemetry 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 @dynatrace/opentelemetry-exporter-metrics
ts
const { DynatraceMetricExporter } = require('@dynatrace/opentelemetry-exporter-metrics'); // configure API endpoint and authentication token const exporter = new DynatraceMetricExporter ({ // directly in code for illustration purpose only. Consider using environment variables url: 'https://myenv123.live.dynatrace.com/api/v2/metrics/ingest', apiToken: '<TOKEN>'’, });

Dynatrace OpenTelemetry metrics exporter

The Dynatrace exporters are open source and available on GitHub. For detailed information on using a particular exporter, see the README file included in the root of each repository:

  • Java
  • JavaScript/Node.js
  • .NET
  • Go
  • Python
Related topics
  • OpenTelemetry metrics

    Learn how to extend observability in Dynatrace with OpenTelemetry metrics.