Class: Datadog::OpenTelemetry::SDK::LogsExporter

Inherits:
OpenTelemetry::Exporter::OTLP::Logs::LogsExporter
  • Object
show all
Defined in:
lib/datadog/opentelemetry/sdk/logs_exporter.rb

Constant Summary collapse

METRIC_EXPORT_ATTEMPTS =
"otel.logs_export_attempts"
METRIC_EXPORT_SUCCESSES =
"otel.logs_export_successes"
METRIC_EXPORT_FAILURES =
"otel.logs_export_failures"
METRIC_LOG_RECORDS =
"otel.log_records"

Instance Method Summary collapse

Instance Method Details

#export(log_records, timeout: nil) ⇒ Object



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

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