Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Unreleased

- Forward all `baggage` header items that are prefixed with `sentry-` [#2025](https://github.com/getsentry/sentry-ruby/pull/2025)

### Features

- Add new boolean option `config.enable_tracing` to simplify enabling performance tracing [#2005](https://github.com/getsentry/sentry-ruby/pull/2005)
Expand Down
13 changes: 1 addition & 12 deletions sentry-ruby/lib/sentry/baggage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@ class Baggage
SENTRY_PREFIX = 'sentry-'
SENTRY_PREFIX_REGEX = /^sentry-/.freeze

DSC_KEYS = %w(
trace_id
public_key
sample_rate
release
environment
transaction
user_id
user_segment
).freeze

# @return [Hash]
attr_reader :items

Expand Down Expand Up @@ -68,7 +57,7 @@ def freeze!
# hash to be used in the trace envelope header.
# @return [Hash]
def dynamic_sampling_context
@items.select { |k, _v| DSC_KEYS.include?(k) }
@items
end

# Serialize the Baggage object back to a string.
Expand Down
7 changes: 5 additions & 2 deletions sentry-ruby/spec/sentry/baggage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"sentry-public_key=49d0f7386ad645858ae85020e393bef3, "\
"sentry-sample_rate=0.01337, "\
"sentry-user_id=Am%C3%A9lie, "\
"sentry-foo=bar, "\
"other-vendor-value-2=foo;bar;"
end

Expand All @@ -36,7 +37,8 @@
"sample_rate" => "0.01337",
"public_key" => "49d0f7386ad645858ae85020e393bef3",
"trace_id" => "771a43a4192642f0b136d5159a501700",
"user_id" => "Amélie"
"user_id" => "Amélie",
"foo" => "bar"
})
end
end
Expand Down Expand Up @@ -66,7 +68,8 @@
"sentry-trace_id=771a43a4192642f0b136d5159a501700,"\
"sentry-public_key=49d0f7386ad645858ae85020e393bef3,"\
"sentry-sample_rate=0.01337,"\
"sentry-user_id=Am%C3%A9lie"
"sentry-user_id=Am%C3%A9lie,"\
"sentry-foo=bar"
)
end
end
Expand Down