We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 401fa88 commit 03b0fc8Copy full SHA for 03b0fc8
src/sentry/mod.rs
@@ -29,7 +29,18 @@ pub fn init() -> ClientInitGuard {
29
30
let traces_sample_rate = env_optional("SENTRY_TRACES_SAMPLE_RATE").unwrap_or(0.0);
31
32
- let traces_sampler = move |_ctx: &TransactionContext| -> f32 { traces_sample_rate };
+ let traces_sampler = move |ctx: &TransactionContext| -> f32 {
33
+ let is_download_endpoint =
34
+ ctx.name().starts_with("/api/v1/crates/") && ctx.name().ends_with("/download");
35
+
36
+ if is_download_endpoint {
37
+ // Reduce the sample rate for the download endpoint, since we have significantly
38
+ // more traffic on that endpoint compared to the rest
39
+ traces_sample_rate / 10.
40
+ } else {
41
+ traces_sample_rate
42
+ }
43
+ };
44
45
let opts = ClientOptions {
46
auto_session_tracking: true,
0 commit comments