cockroachdb / cockroachdb/cockroach

pkg/sql: Increase log sampling rate for SQL internal errors

Open
#117,883 0 comments 0 reactions 0 assignees View on GitHub
A-observability-inf A-sql-logging-and-telemetry C-enhancement T-observability
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Is your feature request related to a problem? Please describe.**
`planner.maybeLogStatementInternal` performs sampling to determine if a statement should be logged. Right now, the same sampling logic is applied to both successful executions as well as executions that experienced an internal error.

This can make it difficult to spot internal errors that happen with a very low frequency, as they are unlikely to be sampled. This means they would go unnoticed, which could be a missed opportunity to fix a bug or improve SQL execution.

**Describe the solution you'd like**
It would be nice if internal errors (e.g. `pgerror.GetPGCode(err) == pgcode.Internal || errors.HasAssertionFailure(err)`) had their own, more aggressive sampling rate, than successful executions. This would increase the probability that we catch one-off errors related to SQL execution.

Jira issue: CRDB-35402

Epic CRDB-32141

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.