Class: Datadog::OpenTelemetry::SDK::MetricsExporter

Inherits:
OpenTelemetry::Exporter::OTLP::Metrics::MetricsExporter
  • Object
show all
Defined in:
lib/datadog/opentelemetry/sdk/metrics_exporter.rb

Constant Summary collapse

METRIC_EXPORT_ATTEMPTS =
"otel.metrics_export_attempts"
METRIC_EXPORT_SUCCESSES =
"otel.metrics_export_successes"
METRIC_EXPORT_FAILURES =
"otel.metrics_export_failures"

Instance Method Summary collapse

Instance Method Details

#export(metrics, timeout: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/datadog/opentelemetry/sdk/metrics_exporter.rb', line 14

def export(metrics, timeout: nil)
  SDK.telemetry_inc(METRIC_EXPORT_ATTEMPTS, 1)
  result = super
  metric_name = (result == 0) ? METRIC_EXPORT_SUCCESSES : METRIC_EXPORT_FAILURES
  SDK.telemetry_inc(metric_name, 1)
  result
rescue => e
  Datadog.logger.error("Failed to export OpenTelemetry Metrics:  #{e.class}: #{e.message}")
  SDK.telemetry_inc(METRIC_EXPORT_FAILURES, 1)
  raise
end