Send metrics via the Dynatrace OpenTelemetry metrics exporter
The Dynatrace metrics exporter has been deprecated in favor of native OTLP metrics exports. Support will be phased out towards the end of 2023, at which point no further updates will be available.
For more details on how to migrate to OTLP, see the migration guide.
To export your application metrics to Dynatrace using a Dynatrace-provided metrics exporter
- Add the exporter library as a dependency to your application.
- Register and configure the exporter through the OpenTelemetry API to export metrics.
Host with OneAgent
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
Metrics endpoint
Configure your exporter with 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.
npm install @dynatrace/opentelemetry-exporter-metrics
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: