Open natikgadzhi opened 9 months ago
Merging #2181 (d8891f3) into master (49a628e) will decrease coverage by
30.97%
. The diff coverage is100.00%
.
Added the unit tests, and moved the changelog entry to Unreleased.
Just passing by here — I'll clean this up today so we can get it merged! Sorry for the delay.
@sl0thentr0py, thank you for the guidance <3
I've pushed up the code, with two gotchas where I'd love your input and preference:
IGNORED_HTTP_METHODS
in the three classes that use it. In theory, we could just put it in module Sentry
, and use it with Sentry::IGNORED_HTTP_METHODS
, but I think having it in the same file is a bit more readable. Want me to DRY it out?Hmmmmmmmm
1) Sentry::Client#event_from_transaction correct dynamic_sampling_context when head SDK
Failure/Error:
expect(event.dynamic_sampling_context).to eq({
"environment" => "development",
"public_key" => "12345",
"sample_rate" => "1.0",
"sampled" => "true",
"transaction" => "test transaction",
"trace_id" => transaction.trace_id
})
expected: {"environment"=>"development", "public_key"=>"12345", "sample_rate"=>"1.0", "sampled"=>"true", "trace_id"=>"f86126d5bfb14f5d8716c5459fe6495b", "transaction"=>"test transaction"}
got: {"environment"=>"development", "public_key"=>"12345", "sample_rate"=>"0.5", "sampled"=>"true", "trace_id"=>"f86126d5bfb14f5d8716c5459fe6495b", "transaction"=>"test transaction"}
(compared using ==)
Diff:
@@ -1,6 +1,6 @@
"environment" => "development",
"public_key" => "12345",
-"sample_rate" => "1.0",
+"sample_rate" => "0.5",
"sampled" => "true",
"trace_id" => "f86126d5bfb14f5d8716c5459fe6495b",
"transaction" => "test transaction",
# ./spec/sentry/client_spec.rb:183:in `block (3 levels) in <top (required)>'
Summary
This pull request makes it so HTTP OPTIONS and HEAD requests will not be sampled (traced).
Closes #1864. Based on the approach in https://github.com/getsentry/sentry-javascript/pull/5485
Changes
capture_exceptions
rack app middleware. It felt like the right spot for this, instead of shoving another check inTransaction.set_initial_sample_decision
, because it depends directly on an HTTP request, and thus is rather specific to Rack env.capture_exceptions_spec.rb
is scary. I'll write them up tomorrow.Open questions