From 6af66d2bc99098d2f3c0c67ab649a8b0db63c05f Mon Sep 17 00:00:00 2001 From: Maxwell Weru Date: Sat, 24 Aug 2024 18:36:31 +0300 Subject: [PATCH] Register span processor for sentry to fix OTel export (#1311) This should fix the OpenTelemetry export issue. It may be reverted in the future when `dependabot-core/updater` makes other changes. See https://docs.sentry.io/platforms/ruby/tracing/instrumentation/opentelemetry/ --- updater/lib/dependabot/opentelemetry.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/updater/lib/dependabot/opentelemetry.rb b/updater/lib/dependabot/opentelemetry.rb index 3d89b654..8862f143 100644 --- a/updater/lib/dependabot/opentelemetry.rb +++ b/updater/lib/dependabot/opentelemetry.rb @@ -30,6 +30,7 @@ def self.configure puts "OpenTelemetry is enabled, configuring..." require "opentelemetry/exporter/otlp" + require "sentry-opentelemetry" # OpenTelemetry instrumentation expects the related gem to be loaded. # While most are already loaded by this point in initialization, some are not. @@ -49,8 +50,14 @@ def self.configure config.use "OpenTelemetry::Instrumentation::Faraday" config.use "OpenTelemetry::Instrumentation::HTTP" config.use "OpenTelemetry::Instrumentation::Net::HTTP" + + # https://docs.sentry.io/platforms/ruby/tracing/instrumentation/opentelemetry/ + config.add_span_processor(::Sentry::OpenTelemetry::SpanProcessor.instance) end + # https://docs.sentry.io/platforms/ruby/tracing/instrumentation/opentelemetry/ + ::OpenTelemetry.propagation = ::Sentry::OpenTelemetry::Propagator.new + tracer end