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

Fix OpenTelemetry internal loading #3400

Merged
merged 6 commits into from
Jan 26, 2024
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
3 changes: 3 additions & 0 deletions lib/datadog/opentelemetry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
# This file activates the integrations of all OpenTelemetry
# components supported by Datadog.

# Load Tracing
require_relative 'tracing'
require_relative 'tracing/contrib'

require_relative 'opentelemetry/api/context'

# DEV: Should this be a Contrib integration, that depends on the `opentelemetry-sdk`
Expand Down
5 changes: 3 additions & 2 deletions lib/datadog/opentelemetry/sdk/propagator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ def extract(
carrier, context: ::OpenTelemetry::Context.current,
getter: ::OpenTelemetry::Context::Propagation.text_map_getter
)
unless getter == ::OpenTelemetry::Context::Propagation.text_map_getter
if getter != ::OpenTelemetry::Context::Propagation.text_map_getter &&
getter != ::OpenTelemetry::Common::Propagation.rack_env_getter
Datadog.logger.error(
'Custom getter is not supported. Please inform the `ddtrace` team at ' \
"Custom getter #{getter} is not supported. Please inform the `ddtrace` team at " \
' https://github.com/DataDog/dd-trace-rb of your use case so we can best support you. Using the default ' \
'OpenTelemetry::Context::Propagation.text_map_getter as a fallback getter.'
)
Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/tracing/contrib/http/distributed/fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ module Distributed
#
# In case both variants are present, the verbatim match will be used.
class Fetcher < Tracing::Distributed::Fetcher
# DEV: Should we try to parse both verbatim an Rack-formatted headers,
# DEV: given Rack-formatted is the most common format in Ruby?
# @param [String] name the header name
# @return [String, nil] the header value or nil if not found
def [](name)
# Try to fetch with the plain key
value = super(name)
Expand Down
2 changes: 1 addition & 1 deletion sig/datadog/tracing/contrib/http/distributed/fetcher.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Datadog
module HTTP
module Distributed
class Fetcher < Tracing::Distributed::Fetcher
def []: (untyped name) -> untyped
def []: (String name) -> (String | nil)
end
end
end
Expand Down
Loading