-
Couldn't load subscription status.
- Fork 4k
release-25.2: sql: add probabilistic transaction tracing #156282
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
release-25.2: sql: add probabilistic transaction tracing #156282
Conversation
|
Thanks for opening a backport. Before merging, please confirm that it falls into one of the following categories (select one):
Add a brief release justification to the PR description explaining your selection. Also, confirm that the change does not break backward compatibility and complies with all aspects of the backport policy. All backports must be reviewed by the TL and EM for the owning area. |
|
✅ PR #156282 is compliant with backport policy Confidence: high 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thanks!
So that tests can verify unstructured logs as part of their functionality, we introduce a new, generic logspy, to complement the common structured logspy. Fixes: none Epic: none Release note: none
Previously, tracing transactions in CRDB could be enabled using a single cluster setting: `sql.trace.txn.enable_threshold`, which, if it was non-zero, would enable tracing on all transactions and only keep and emit the traces for transactions which exceeded the execution time threshold. This has proven to be difficult to use as it reuquires paying tracing cost on the entire workload. This change modifies the transaction tracing capabilities of CRDB to incorporate a sample rate. A new cluster setting is introduced, named `sql.trace.txn.sample_rate` which is zero by default. When set to a positive number between 0 and 1, this will set the probability of a transaction having tracing enabled. For tracing to emit a trace for a transaction, both settings will now need to be set and will need to both trigger for successful output to the `SQL_EXEC` logging channel. Transactions first pass through the sample rate filter which governs whether a trace is captured, then they will be evaluated through the `enable_threshold` which governs whether the trace is emitted to the logs. Epic: None Resolves: CRDB-51662 Release note (ops change, sql change): In order to selectively capture traces for transactions running in an active workload without haing to capture them via statement diagnostic bundles, customers can now use the `sql.trace.txn.sample_rate` cluster setting to enable tracing for a fraction of their workload. The `sql.trace.txn.enable_threshold` will still need to be set to a positive value to provide a filter for how slow a transaction needs to be after being sampled to merit emitting a trace. Traces are emitted to the `SQL_EXEC` logging channel.
4fb4c0c to
f7bf9ad
Compare
|
blathers backport staging-v25.2.8 |
|
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error updating backport branch to sha a75f51012faea901ee6e28a869bb4b79a6f1fccf: PATCH https://api.github.com/repos/dhartunian/cockroach/git/refs/heads/blathers/backport-staging-v25.2.8-156282: 422 Reference cannot be updated [] Backport to branch staging-v25.2.8 failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
|
Noting that I've approved and reviewed this backport. |
|
blathers backport staging-v25.2.8 |
|
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating backport branch refs/heads/blathers/backport-staging-v25.2.8-156282: POST https://api.github.com/repos/dhartunian/cockroach/git/refs: 422 Reference already exists [] Backport to branch staging-v25.2.8 failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Backport 1/1 commits from #148542.
/cc @cockroachdb/release
Previously, tracing transactions in CRDB could be enabled using a single cluster setting:
sql.trace.txn.enable_threshold, which, if it was non-zero, would enable tracing on all transactions and only keep and emit the traces for transactions which exceeded the execution time threshold. This has proven to be difficult to use as it reuquires paying tracing cost on the entire workload.This change modifies the transaction tracing capabilities of CRDB to incorporate a sample rate. A new cluster setting is introduced, named
sql.trace.txn.sample_ratewhich is zero by default. When set to a positive number between 0 and 1, this will set the probability of a transaction having tracing enabled.For tracing to emit a trace for a transaction, both settings will now need to be set and will need to both trigger for successful output to the
SQL_EXEClogging channel. Transactions first pass through the sample rate filter which governs whether a trace is captured, then they will be evaluated through theenable_thresholdwhich governs whether the trace is emitted to the logs.Epic: None
Resolves: CRDB-51662
Release note (ops change, sql change): In order to selectively capture traces for transactions running in an active workload without haing to capture them via statement diagnostic bundles, customers can now use the
sql.trace.txn.sample_ratecluster setting to enable tracing for a fraction of their workload. Thesql.trace.txn.enable_thresholdwill still need to be set to a positive value to provide a filter for how slow a transaction needs to be after being sampled to merit emitting a trace. Traces are emitted to theSQL_EXEClogging channel.Release justification: critical observability need that has been approved. disabled by default.