feat: remove pool.acquire and prepare spans, preserve metrics#2
Open
DavidS-ovm wants to merge 2 commits intomainfrom
Open
feat: remove pool.acquire and prepare spans, preserve metrics#2DavidS-ovm wants to merge 2 commits intomainfrom
DavidS-ovm wants to merge 2 commits intomainfrom
Conversation
Remove span creation for pool.acquire and prepare operations to reduce trace noise. Metrics (db.client.operation.duration, error counts) are preserved for both operations. For prepare, the wall-clock duration is recorded as a pgx.prepare.duration attribute (Int64, milliseconds) on the parent query span instead of creating a separate child span. Pool acquire duration is better tracked through aggregate metrics (pgxpool.* from RecordStats) since contention is an environmental concern, not useful as individual trace spans. Made-with: Cursor
Update module path, instrumentation scope names, benchmark import, and README references from exaring/otelpgx to overmindtech/otelpgx. Made-with: Cursor
2511c8f to
65bf101
Compare
dylanratcliffe
pushed a commit
to overmindtech/cli
that referenced
this pull request
Mar 9, 2026
…ans) (#4103) ## Summary - Switch from `exaring/otelpgx` to `overmindtech/otelpgx` fork which removes `pool.acquire` and `prepare` span creation while preserving all metrics - Prepare duration is now recorded as a `pgx.prepare.duration` attribute (Int64, ms) on the parent query span - Remove the now-unnecessary `pool.acquire` sampling rule from `OvermindSampler` ## Linear Ticket - **Ticket**: [ENG-2943](https://linear.app/overmind/issue/ENG-2943/fork-otelpgx-remove-poolacquire-and-prepare-spans) — Fork otelpgx: remove pool.acquire and prepare spans - **Purpose**: Reduce trace noise by eliminating low-value `pool.acquire` and `prepare` child spans, while preserving `db.client.operation.duration` metrics for both operations - **Related**: [ENG-2941](https://linear.app/overmind/issue/ENG-2941) — complementary to the OTEL collector batch size fix ## Changes | File | Change | | --- | --- | | `go.mod` / `go.sum` | `exaring/otelpgx v0.10.0` replaced with `overmindtech/otelpgx` (commit `65bf101`) | | `go/dbkit/connect.go` | Import path updated to `github.com/overmindtech/otelpgx` | | `go/tracing/main.go` | Removed `pool.acquire` sampling rule from `NewOvermindSampler` (no longer needed) | The fork itself ([overmindtech/otelpgx#2](overmindtech/otelpgx#2)) contains the functional changes to otelpgx. ## Deviations from Approved Plan Implementation matches the approved plan -- no material deviations. All seven parts were implemented as described: 1. Fork created at `overmindtech/otelpgx` with two commits (functionality + rename) 2. `pool.acquire` span removed, metrics preserved, rationale documented 3. `prepare` span removed, `pgx.prepare.duration` attribute added to parent query span 4. Unused code cleaned up from simplified methods 5. Two tests added (`TestTraceAcquire_NoSpan`, `TestTracePrepare_NoSpan_SetsAttribute`) 6. Main repo updated (this PR) 7. Upstream PR suggestion deferred to post-validation (as planned) Made with [Cursor](https://cursor.com) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Moderate risk because it changes database OpenTelemetry instrumentation and sampling rules, which can affect trace volume/shape and observability expectations, but it is otherwise a small, localized dependency swap. > > **Overview** > Switches PostgreSQL tracing from `github.com/exaring/otelpgx` to the `github.com/overmindtech/otelpgx` fork, updating `dbkit.Connect` to use the new import and bumping module sums accordingly. > > Simplifies tracing sampling by removing the special-case sampler for `pool.acquire` spans (and the now-unused `SpanNameMatcher` helper), reflecting the fork’s reduced span creation. Adds a `//nolint:staticcheck` annotation for the Kubernetes `v1.Endpoints` adapter to suppress deprecation warnings while `EndpointSlice` migration is pending. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2c0f40d231fdad6a06ce4080b1b834cfed6dce42. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> GitOrigin-RevId: cd50535a27c2563fb4dd32592182711892177b7d
tphoney
pushed a commit
to overmindtech/cli
that referenced
this pull request
Mar 9, 2026
…ans) (#4103) ## Summary - Switch from `exaring/otelpgx` to `overmindtech/otelpgx` fork which removes `pool.acquire` and `prepare` span creation while preserving all metrics - Prepare duration is now recorded as a `pgx.prepare.duration` attribute (Int64, ms) on the parent query span - Remove the now-unnecessary `pool.acquire` sampling rule from `OvermindSampler` ## Linear Ticket - **Ticket**: [ENG-2943](https://linear.app/overmind/issue/ENG-2943/fork-otelpgx-remove-poolacquire-and-prepare-spans) — Fork otelpgx: remove pool.acquire and prepare spans - **Purpose**: Reduce trace noise by eliminating low-value `pool.acquire` and `prepare` child spans, while preserving `db.client.operation.duration` metrics for both operations - **Related**: [ENG-2941](https://linear.app/overmind/issue/ENG-2941) — complementary to the OTEL collector batch size fix ## Changes | File | Change | | --- | --- | | `go.mod` / `go.sum` | `exaring/otelpgx v0.10.0` replaced with `overmindtech/otelpgx` (commit `65bf101`) | | `go/dbkit/connect.go` | Import path updated to `github.com/overmindtech/otelpgx` | | `go/tracing/main.go` | Removed `pool.acquire` sampling rule from `NewOvermindSampler` (no longer needed) | The fork itself ([overmindtech/otelpgx#2](overmindtech/otelpgx#2)) contains the functional changes to otelpgx. ## Deviations from Approved Plan Implementation matches the approved plan -- no material deviations. All seven parts were implemented as described: 1. Fork created at `overmindtech/otelpgx` with two commits (functionality + rename) 2. `pool.acquire` span removed, metrics preserved, rationale documented 3. `prepare` span removed, `pgx.prepare.duration` attribute added to parent query span 4. Unused code cleaned up from simplified methods 5. Two tests added (`TestTraceAcquire_NoSpan`, `TestTracePrepare_NoSpan_SetsAttribute`) 6. Main repo updated (this PR) 7. Upstream PR suggestion deferred to post-validation (as planned) Made with [Cursor](https://cursor.com) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Moderate risk because it changes database OpenTelemetry instrumentation and sampling rules, which can affect trace volume/shape and observability expectations, but it is otherwise a small, localized dependency swap. > > **Overview** > Switches PostgreSQL tracing from `github.com/exaring/otelpgx` to the `github.com/overmindtech/otelpgx` fork, updating `dbkit.Connect` to use the new import and bumping module sums accordingly. > > Simplifies tracing sampling by removing the special-case sampler for `pool.acquire` spans (and the now-unused `SpanNameMatcher` helper), reflecting the fork’s reduced span creation. Adds a `//nolint:staticcheck` annotation for the Kubernetes `v1.Endpoints` adapter to suppress deprecation warnings while `EndpointSlice` migration is pending. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2c0f40d231fdad6a06ce4080b1b834cfed6dce42. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> GitOrigin-RevId: cd50535a27c2563fb4dd32592182711892177b7d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pool.acquireandprepareoperations to reduce trace noisedb.client.operation.duration, error counts) for both operationspgx.prepare.durationattribute (Int64, ms) on the parent query spangithub.com/overmindtech/otelpgxRationale
pool.acquire: Pool acquire duration is tracked via
db.client.operation.durationmetric (withpgx.operation.type=acquire) and thepgxpool.*metrics fromRecordStats. As a span in a trace it adds noise without actionable signal -- pool contention is an environmental concern (database bottleneck) better diagnosed from aggregate metrics than individual traces.prepare: The prepare round-trip time is useful context on the parent query span, but not worth a dedicated child span. The
pgx.prepare.durationattribute surfaces this on the query span directly.Test plan
TestTraceAcquire_NoSpan-- verifies no span created, only parent span presentTestTracePrepare_NoSpan_SetsAttribute-- verifies no prepare span, parent span haspgx.prepare.durationattributeMade with Cursor