Skip to content

Commit

Permalink
Add sampled field to dynamic_sampling_context (#2092)
Browse files Browse the repository at this point in the history
  • Loading branch information
sl0thentr0py authored Aug 21, 2023
1 parent 8abb2d2 commit 86dfaea
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Features

- Make `:value` in `SingleExceptionInterface` writable, so that it can be modified in `before_send` under `event.exception.values[n].value` [#2072](https://github.com/getsentry/sentry-ruby/pull/2072)
- Add `sampled` field to `dynamic_sampling_context` [#2092](https://github.com/getsentry/sentry-ruby/pull/2092)
- Add new `config.trace_propagation_targets` option to set targets for which headers are propagated in outgoing HTTP requests [#2079](https://github.com/getsentry/sentry-ruby/pull/2079)

```rb
Expand Down
1 change: 1 addition & 0 deletions sentry-ruby/lib/sentry/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ def populate_head_baggage
items = {
"trace_id" => trace_id,
"sample_rate" => effective_sample_rate&.to_s,
"sampled" => sampled&.to_s,
"environment" => @environment,
"release" => @release,
"public_key" => @dsn&.public_key
Expand Down
1 change: 1 addition & 0 deletions sentry-ruby/spec/sentry/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def sentry_context
"environment" => "development",
"public_key" => "12345",
"sample_rate" => "1.0",
"sampled" => "true",
"transaction" => "test transaction",
"trace_id" => transaction.trace_id
})
Expand Down
1 change: 1 addition & 0 deletions sentry-ruby/spec/sentry/net/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
expect(request["baggage"]).to eq(
"sentry-trace_id=#{transaction.trace_id},"\
"sentry-sample_rate=1.0,"\
"sentry-sampled=true,"\
"sentry-environment=development,"\
"sentry-public_key=foobarbaz"
)
Expand Down
6 changes: 4 additions & 2 deletions sentry-ruby/spec/sentry/transaction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@
"public_key" => "12345",
"trace_id" => subject.trace_id,
"transaction"=>"foo",
"sample_rate" => "1.0"
"sample_rate" => "1.0",
"sampled" => "true"
})
end

Expand Down Expand Up @@ -592,7 +593,8 @@
"public_key" => "12345",
"trace_id" => subject.trace_id,
"transaction"=>"foo",
"sample_rate" => "1.0"
"sample_rate" => "1.0",
"sampled" => "true"
})
end
end
Expand Down

0 comments on commit 86dfaea

Please sign in to comment.