Skip to content

feat: allow filtering errors recorded on spans - #94

Open
cangxing314 wants to merge 1 commit into
exaring:mainfrom
cangxing314:feat/span-error-filter
Open

cangxing314 wants to merge 1 commit into
exaring:mainfrom
cangxing314:feat/span-error-filter

Conversation

@cangxing314

Copy link
Copy Markdown

Fixes #85.

Expected client cancellations can mark database spans as failures, adding exception events alongside genuine PostgreSQL errors.

This adds an opt-in WithSpanErrorFilter predicate and uses it consistently for query, copy, batch, connect, prepare, and acquire spans. The README shows how to filter wrapped cancellations with errors.Is. The built-in no-rows exemption applies before the predicate, and database operation metrics use their regular error classification.

The regression tests cover wrapped cancellation, PostgreSQL errors with a SQLSTATE, the default behavior, and the operation error counter.

  • go test -count=1 -short ./... on Go 1.25 and 1.26
  • go vet ./...
  • golangci-lint run ./... with v2.12.2
  • go mod tidy -diff with LF-normalized manifests

Prepared with Codex assistance.

Signed-off-by: cangxing314 <2625399797@qq.com>
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.

No way to stop an expected error from failing a span

1 participant