dynatrace-oss / opentelemetry-metric-js

Dynatrace OpenTelemetry Metrics Exporter for JavaScript
https://www.dynatrace.com/integrations/opentelemetry/
Apache License 2.0
6 stars 2 forks source link

No unit or description seen when exporting metrics #9

Closed RubyKozel closed 11 months ago

RubyKozel commented 3 years ago

Hello,

I'm using the library to export custom metrics to dynatrace. The metrics are exported successfully, although when I'm creating the metric I specify a description and a unit to it, and I can't see it in Dynatrace. In fact, I see that the unit is 'Unspecified' and that there's no description to it.

Here's a code sample:

import { Meter, MeterProvider } from "@opentelemetry/metrics";
import { DynatraceMetricExporter } from '@dynatrace/opentelemetry-exporter-metrics';
const exporter = new DynatraceMetricExporter({
        url: apiurl + "/v2/metrics/ingest",
        APIToken,
        logger,
        tags: getCustomTags()
});

const meter = new MeterProvider({ exporter, interval: 60000 }).getMeter('my-custom-meter');
const counter = meter.createCounter('active.session.max.size', {
   description: 'Active Session Max Size'
   unit: 'Count'
});

counter.add(1, getLabels());

In dynatrace, I can see my metric, but it lacks the description and the unit: image

Can you kindly suggest what I'm doing wrong?

Thanks!

arminru commented 3 years ago

Hi @RubyKozel, thanks for your report!

Your example is actually fine but the OTel JS exporter currently does not support specifying units. You can, however, define the unit using the metadata configuration for metrics either via the UI or API as described here: https://www.dynatrace.com/support/help/shortlink/metrics-browser#metadata-for-custom-metrics. From your screenshot it looks like you would be lacking permissions for that since the "Edit metadata" button which should be next to "Create chart" is missing, please check with your admin regarding this or open a support ticket to sort this out.

Best, Armin

RubyKozel commented 3 years ago

Hi @arminru Thanks for your response!

By OTel JS exporter, you mean the functionality that is provided by https://github.com/open-telemetry/opentelemetry-js-api ?

Do you know of any ETA for supporting this capability? Using the metadata for custom metrics API is more of a workaround than a solution here

danielkhan commented 3 years ago

Hi @RubyKozel,

the metrics ingest API in Dynatrace does not support specifying units at this point - as such this exporter doesn't either. Extending the metrics interface of Dynatrace is out of scope for the team working on this exporter, yet we will loop in the metrics team to find out the current status. Please give me a few more days.

RubyKozel commented 3 years ago

Hi @danielkhan Sure, take your time, I will follow up on this issue for updates

Thanks for the support!

arminru commented 11 months ago

Hi @RubyKozel!

In 2022, we introduced an OTLP Metrics ingest endpoint in Dynatrace, which supports ingesting units and description and also makes this exporter here obsolete, as any OTel SDK and the collector can natively export to it out of the box.

You can find more details here:

This exporter is deprecated in favor of the OTLP metrics ingest and as such no new features will be implemented.