OpenTelemetry Metrics
OpenTelemetry is an observability framework for cloud-native software. It is used to instrument frameworks and components and export telemetry data (traces, metrics, and logs) for analysis to gain insights into your software's performance and behavior.
Dynatrace is a key contributor to this open source project. To learn more about Dynatrace OpenTelemetry support, see Send data to Dynatrace with OpenTelemetry.
Dynatrace OpenTelemetry metrics exporters
To export your application metrics to Dynatrace using a Dynatrace-provided metrics exporter
- Add the exporter library as a dependency for your application
- Register and configure the exporter through the OpenTelemetry API to export metrics
Dynatrace provides you with OpenTelemetry metrics exporters for the languages listed below. The referenced repositories provide you with detailed instructions on how to set up your OpenTelemetry metric ingestion.
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.
Using Dynatrace-provided metrics exporters on a host with OneAgent installed is the easiest way to ingest OpenTelemetry-exposed metrics to Dynatrace.
Scenarios for OpenTelemetry metric ingestion
Depending on your setup, you can:
- Send metrics directly to OneAgent, if OneAgent and the exporter are on the same host
- Send metrics to Dynatrace Metrics API, if OneAgent doesn't coexist with the exporter on the same host
- Send metrics through OpenTelemetry collector
- Send metrics through OpenTelemetry collector using AWS Distro for OpenTelemetry
Send metrics directly to OneAgent
With OneAgent on the same host, the host ID and host name context are automatically added to each metric as dimensions. This way, the metrics are automatically booked to the respective entities in Dynatrace. For more information, see Metric ingestion.
Additionally, the exporters automatically enrich the metrics with process-related metadata using the method described in Enrich metrics with Dynatrace-specific dimensions.
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
With OneAgent on the same host, the host ID and host name context are automatically added to each metric as dimensions. This way, the metrics are automatically booked to the respective entities in Dynatrace. For more information, see Metric ingestion.
The exporters also support the process-related metadata enrichment documented in Enrich metrics with Dynatrace-specific dimensions.
Send metrics to Dynatrace Metrics API
If you can't install OneAgent on the same host with the metrics exporter, you can send metrics to the Dynatrace API ingestion endpoint.
In this case, automatic topology awareness and zero configuration aren't available out of the box. However, you can manually enrich your metrics with Dynatrace-specific metadata by adding a topology-related dimension, such as host ID or host name. For more information, see Dimension format in the metrics ingestion protocol reference documentation.
Metrics endpoint
You'll need to configure your exporter with your Dynatrace environment URL as the metrics endpoint and the 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 learn your metric ingestion endpoint, see Metric v2 API
- Optionally, add a custom prefix to ingested metrics keys, so that you're able to quickly find your metrics in Data explorer.
Example - Install the Dynatrace OpenTelemetry Metrics Exporter using NPM
The following is an example for setting up the exporter in JavaScript. Note that the url
and APIToken
fields are only examples.
npm install @dynatrace/opentelemetry-exporter-metrics
const { MeterProvider } = require('@opentelemetry/metrics');
const { DynatraceMetricExporter } = require('@dynatrace/opentelemetry-exporter-metrics');
// configure API endpoint and authentication token
const exporter = new DynatraceMetricExporter
({
// This is only required if the OneAgent is not installed on the same host
// url: 'https://myenv123.live.dynatrace.com/api/v2/metrics/ingest',
// APIToken: 'token123'’, // hard-coded for illustration only, should be read from config or env vars
prefix: 'MyPrefix', // optional
});
You can find more examples for supported languages in Dynatrace OpenTelemetry metrics exporters repositories:
OpenTelemetry collector
The OpenTelemetry collector exporter provides you with a vendor-agnostic implementation showing how to receive, process, and export telemetry data. It comes with its own protocol (OTLP) and removes the need to run a dedicated exporter inside the application.
For more information, see OpenTelemetry collector
AWS Distro for OpenTelemetry
AWS provides a secure, production-ready, AWS-supported distribution of the OpenTelemetry project.
The Dynatrace metrics exporter is part of the collector component. For more information, see Dynatrace Exporter in the AWS Distro for OpenTelemetry documentation.