Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add telemetry for opentracing #3170

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/datadog/core/telemetry/collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def additional_payload_variables
options['logger.instance'] = configuration.logger.instance.class.to_s
options['appsec.enabled'] = configuration.dig('appsec', 'enabled') if configuration.respond_to?('appsec')
options['tracing.opentelemetry.enabled'] = !defined?(Datadog::OpenTelemetry::LOADED).nil?
options['tracing.opentracing.enabled'] = !defined?(Datadog::OpenTracer::LOADED).nil?
options.compact!
options
end
Expand Down
9 changes: 9 additions & 0 deletions lib/datadog/opentracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,12 @@

# Modify the OpenTracing module functions
::OpenTracing.singleton_class.prepend(Datadog::OpenTracer::GlobalTracer)

module Datadog
# Datadog OpenTracing integration.
# DEV: This module should be named `Datadog::OpenTracing` to match the gem (`opentracing`).
module OpenTracer
# Used by Telemetry to decide if OpenTracing instrumentation is enabled
LOADED = true
end
end
8 changes: 8 additions & 0 deletions spec/datadog/core/telemetry/collector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,14 @@

it { is_expected.to include('tracing.opentelemetry.enabled' => true) }
end

context 'when OpenTracing is enabled' do
before do
stub_const('Datadog::OpenTracer::LOADED', true)
end

it { is_expected.to include('tracing.opentracing.enabled' => true) }
end
end

describe '#dependencies' do
Expand Down
Loading