To export your application metrics to Dynatrace using the OTLP metrics exporter
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.
The following is an example of setting up the exporter in JavaScript. Note that the url
and <TOKEN>
fields are only examples.
npm install --save @opentelemetry/exporter-metrics-otlp-proto
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-proto');// configure API endpoint and authentication tokenconst exporter = new OTLPMetricExporter({// directly in code for illustration purpose only. Consider using environment variablesurl: "https://myenv123.live.dynatrace.com/api/v2/otlp/v1/metrics",headers: {Authorization: "Api-Token <TOKEN>"},temporalityPreference: AggregationTemporality.DELTA});