You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Set environment variable before initializing metrics support
65
65
ENV['DD_METRICS_OTEL_ENABLED'] = 'true'
66
66
require 'opentelemetry/sdk'
67
-
require 'opentelemetry-metrics-sdk'
68
-
require 'opentelemetry/exporter/otlp_metrics'
69
67
require 'datadog/opentelemetry'
70
68
71
-
# IMPORTANT: Call Datadog.configure before OpenTelemetry::SDK.configure
72
-
# and keep both in the same file to ensure proper initialization order.
73
69
Datadog.configure do |c|
74
70
# Configure Datadog settings here
75
71
end
76
72
77
-
# Initialize OpenTelemetry SDK (required for metrics)
73
+
# Call after Datadog.configure to initialize metrics.
74
+
# Can be called multiple times to pick up configuration changes.
75
+
# Requires: opentelemetry/exporter/otlp_metrics and opentelemetry/exporter/otlp_metrics
78
76
OpenTelemetry::SDK.configure
79
77
```
80
78
81
79
1. Use the [OpenTelemetryMetricsAPI](https://opentelemetry.io/docs/languages/ruby/instrumentation/#metrics) to create and record metrics.
82
80
83
-
**Note:**Call`Datadog.configure`before `OpenTelemetry::SDK.configure`andkeep both in the same file. Configurationchanges require calling `OpenTelemetry::SDK.configure` again to take effect.
81
+
**Note:**Call`OpenTelemetry::SDK.configure`after `Datadog.configure`andcall it again whenever Datadog configuration changes to update the meter provider.
0 commit comments