Skip to content
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

Making performance trace sample rate configurable #1517

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions crates/symbolicator-service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ pub struct Config {
/// cached on disk. The path is created if it doesn't exist. Path must be UTF-8.
#[serde(default)]
pub _crash_db: Option<PathBuf>,

/// The sample rate for transactions. (0.0 - 1.0, defaults to 0.05)
pub transaction_sample_rate: f32,
}

impl Config {
Expand Down Expand Up @@ -556,6 +559,7 @@ impl Default for Config {
max_concurrent_requests: Some(200),
shared_cache: None,
_crash_db: None,
transaction_sample_rate: 0.05,
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions crates/symbolicator/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ pub fn execute() -> Result<()> {
release,
session_mode: sentry::SessionMode::Request,
auto_session_tracking: false,
traces_sampler: Some(Arc::new(|ctx| {
traces_sampler: Some(Arc::new(move |ctx| {
if Some(true) == ctx.sampled() {
1.0
} else if ctx.operation() != "http.server" {
// TODO: Think about what to do with this comment now:
tobias-wilfert marked this conversation as resolved.
Show resolved Hide resolved
// Symbolicator receives at peak:
// - ~3_000 `symbolicate_js`,
// - ~800 `symbolicater`, and
Expand All @@ -100,7 +101,8 @@ pub fn execute() -> Result<()> {
// we end up with ~200 sampled transactions per second, or ~12_000 per minute.
// We only do this for the "real" transactions and not the http frontend that
// just spawns these computations.
0.05

config.transaction_sample_rate
} else {
0.0
}
Expand Down
3 changes: 3 additions & 0 deletions local.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ cache_dir: cache
logging:
level: error

# The sample rate for transactions. (0.0 - 1.0, defaults to 0.05)
transaction_sample_rate: 0.05

# Configure some default symbol sources:
sources:
# You can use symsorter to correctly sort symbols into the local filesystem source:
Expand Down
Loading