Skip to content

Commit

Permalink
fix(tracing): Set max spans to the default amount when tracing is ena…
Browse files Browse the repository at this point in the history
…bled (#669)
  • Loading branch information
relaxolotl authored Jan 24, 2022
1 parent 2e4314b commit ef36a87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/sentry_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ sentry_options_set_traces_sample_rate(
sample_rate = 1.0;
}
opts->traces_sample_rate = sample_rate;

if (sample_rate > 0 && opts->max_spans == 0) {
opts->max_spans = SENTRY_SPANS_MAX;
}
}

/**
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/test_tracing.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ SENTRY_TEST(basic_spans)
{
sentry_options_t *options = sentry_options_new();
sentry_options_set_traces_sample_rate(options, 1.0);
sentry_options_set_max_spans(options, 3);
sentry_init(options);

// Starting a child with no active transaction should fail
Expand Down Expand Up @@ -404,7 +403,6 @@ SENTRY_TEST(spans_on_scope)
{
sentry_options_t *options = sentry_options_new();
sentry_options_set_traces_sample_rate(options, 1.0);
sentry_options_set_max_spans(options, 3);
sentry_init(options);

sentry_transaction_context_t *opaque_tx_cxt
Expand Down

0 comments on commit ef36a87

Please sign in to comment.