Skip to content

WIP: baggage span tags #4716

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

rachelyangdog
Copy link

What does this PR do?

Motivation:

Change log entry

Additional Notes:

How to test the change?

@rachelyangdog rachelyangdog requested a review from a team as a code owner June 5, 2025 15:22
@rachelyangdog rachelyangdog marked this pull request as draft June 5, 2025 15:22
Copy link

github-actions bot commented Jun 5, 2025

👋 Hey @DataDog/ruby-guild, please fill "Change log entry" section in the pull request description.

If changes need to be present in CHANGELOG.md you can state it this way

**Change log entry**

Yes. A brief summary to be placed into the CHANGELOG.md

(possible answers Yes/Yep/Yeah)

Or you can opt out like that

**Change log entry**

None.

(possible answers No/Nope/None)

Visited at: 2025-06-05 15:22:27 UTC

@datadog-datadog-prod-us1
Copy link
Contributor

Datadog Report

Branch report: rachel.yang/baggage-span-tags
Commit report: 3595efc
Test service: dd-trace-rb

❌ 22 Failed (0 Known Flaky), 222 Passed, 0 Skipped, 8.22s Total Time

❌ Failed Tests (22)

This report shows up to 5 failed tests.

  • Datadog::Tracing::Contrib::ActiveSupport::Configuration::Settings Option cache_servicewhen without service_name - rspec - Details

    Expand for error
     uninitialized constant Datadog::Tracing::Contrib::SpanAttributeSchema
     
     Failure/Error:
       Contrib::SpanAttributeSchema.fetch_service_name(
         '',
         Ext::SERVICE_CACHE
       )
     
     NameError:
       uninitialized constant Datadog::Tracing::Contrib::SpanAttributeSchema
     ...
    
  • Datadog::Tracing::Contrib::ActiveSupport::Configuration::Settings Option cache_servicewhen without service_name v0 but uses env var - rspec - Details

    Expand for error
     uninitialized constant Datadog::Tracing::Contrib::SpanAttributeSchema
     
     Failure/Error:
       Contrib::SpanAttributeSchema.fetch_service_name(
         '',
         Ext::SERVICE_CACHE
       )
     
     NameError:
       uninitialized constant Datadog::Tracing::Contrib::SpanAttributeSchema
     ...
    
  • Datadog::Tracing::Contrib::Dalli::Configuration::Settings behaves like service name setting Option service_namewhen without service_name v0 - rspec - Details

    Expand for error
     uninitialized constant Datadog::Tracing::Contrib::SpanAttributeSchema
     
     Failure/Error:
       Contrib::SpanAttributeSchema.fetch_service_name(
         Ext::ENV_SERVICE_NAME,
         Ext::DEFAULT_PEER_SERVICE_NAME
       )
     
     NameError:
       uninitialized constant Datadog::Tracing::Contrib::SpanAttributeSchema
     ...
    
  • Datadog::Tracing::Contrib::Dalli::Configuration::Settings behaves like service name setting Option service_namewhen without service_name v0 but uses env var - rspec - Details

    Expand for error
     uninitialized constant Datadog::Tracing::Contrib::SpanAttributeSchema
     
     Failure/Error:
       Contrib::SpanAttributeSchema.fetch_service_name(
         Ext::ENV_SERVICE_NAME,
         Ext::DEFAULT_PEER_SERVICE_NAME
       )
     
     NameError:
       uninitialized constant Datadog::Tracing::Contrib::SpanAttributeSchema
     ...
    
  • Datadog::Tracing::Contrib::Faraday::Configuration::Settings behaves like service name setting Option service_namewhen without service_name v0 - rspec

return if baggage_hash.nil? || baggage_hash.empty?

# Fetch configuration: which keys to tag
raw_config = ENV[ENV_BAGGAGE_SPAN_TAGS] # is this how I get the configuration?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You receive the value for baggage_span_tags in the initialize method of this class, so it doesn't have to be resolve every time. The caller then will provide the value.

Comment on lines +177 to +188
if raw_config.nil?
# Default list: "user.id,session.id,account.id"
Set.new(%w[user.id session.id account.id])
elsif raw_config.strip == ''
# Explicitly disabled
return
elsif raw_config.strip == '*'
# Wildcard: allow all keys
:all
else
Set.new(raw_config.split(',').map(&:strip))
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of configuration processing should be done at the setting side, so it only needs to be done once. Take a look at after_set to see how you can manipulate the setting at declaration time:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants