Skip to content

[DO NOT MERGE] feat(tracing): Warn when traces_sample_rate is 0 - #8269

Closed
wedamija wants to merge 1 commit into
masterfrom
danf/warn-zero-traces-sample-rate
Closed

wedamija wants to merge 1 commit into
masterfrom
danf/warn-zero-traces-sample-rate

Conversation

@wedamija

@wedamija wedamija commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Description

Warn at init when traces_sample_rate is 0 and no traces_sampler is set.

Many new setups, a lot of them written by AI coding agents, turn tracing on but set the sample rate to 0, usually through a setting that defaults to 0 and never gets set. These apps send no traces, nothing tells anyone, and most of them stay that way. The warning tells the developer, or the agent running the app, that no traces will be sent and how to fix it.

It only shows when the rate is explicitly 0. People who want 0 on purpose, for example to only continue traces sampled upstream, can hide it.

This is a draft to get opinions on the idea. Please don't merge it.

Issues

None.

🤖 Generated with Claude Code

A lot of new setups, many of them written by AI coding agents, configure
tracing but set traces_sample_rate to 0, often through a setting or
environment variable that defaults to 0 and is never set. The SDK then
instruments every request, starts no traces and sends no performance data,
and nothing tells anyone. Most of these setups stay that way.

Warn at init when traces_sample_rate is 0 and no traces_sampler is set. It
uses warnings.warn rather than the SDK logger, because the logger only
writes when debug is on. The message says how to send traces, and that the
warning can be hidden with warnings.filterwarnings when 0 is intentional
(for example, to only continue traces sampled upstream).

There's no warning when traces_sample_rate isn't set, is None, or is above
0, or when a traces_sampler is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wedamija wedamija closed this Nov 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 139324 passed | ⏭️ 7861 skipped | Total: 147185 | Pass Rate: 94.66% | Execution Time: 426m 47s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +102
Passed Tests 📈 +102
Failed Tests —
Skipped Tests —

All tests are passing successfully.

✅ Patch coverage is 100.00% (2 of 2 changed executable lines covered; target 80%).
Project statement coverage is 90.21% (unchanged from base (26ef571) to head (84120af)).

Changed files with executable lines (1)
File Patch coverage Changed executable lines
sentry_sdk/client.py 100.00% 2/2 covered
Coverage diff
@@            Coverage Diff             @@
##        master     #8269       +/-##
==========================================
  Coverage    90.21%    90.21%        —%
==========================================
  Files          203       203         —
  Tracked lines     27335     27337        +2
  Branches     10246     10248        +2
==========================================
+ Hits         24660     24661        +1
- Misses        2675      2676        +1
- Partials      1560      1561        +1

Generated by Coverage Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant