fix: Align OpenTelemetry attribute coverage with database-spans semconv - #32
Merged
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #32 +/- ##
==========================================
+ Coverage 99.90% 99.95% +0.05%
==========================================
Files 12 12
Lines 2034 2164 +130
==========================================
+ Hits 2032 2163 +131
+ Misses 2 1 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The `db.client.operation.duration` histogram previously carried only connection-level attributes (`db.system.name`, `db.namespace`). Annotation-derived attributes (`db.operation.name`, `db.collection.name`, `db.query.summary`, `db.stored_procedure.name`) and error-path attributes (`error.type`, plus `db.response.status_code` for `sqlx::Error::Database`) are now appended to `metric_attrs` in lock-step with the span attribute set, so dashboards can slice DB latency by operation verb, target collection, or error class – the dimensions OTel's database-spans semconv recommends. `InstrumentedStream` gains a single-error latch so streams that yield multiple `Err` items before terminating cannot append duplicate `error.type` / `db.response.status_code` keys. Three additional attributes from the OTel database-spans recommended set now surface on every span and per-operation metric: `db.client.connection.pool.name` (previously only on the `db.client.connection.count` gauge; now on every span and the rest of the `db.client.connection.*` family via the shared connection-attribute set), `network.protocol.name` (per-backend default via the new `Database::DEFAULT_NETWORK_PROTOCOL_NAME` constant; overridable via `PoolBuilder::with_network_protocol_name`), and `network.transport` (set explicitly via `PoolBuilder::with_network_transport`; the wrapper does not infer transport from the connect string).
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.
The
db.client.operation.durationhistogram previously carried only connection-level attributes (db.system.name,db.namespace). Annotation-derived attributes (db.operation.name,db.collection.name,db.query.summary,db.stored_procedure.name) and error-path attributes (error.type, plusdb.response.status_codeforsqlx::Error::Database) are now appended tometric_attrsin lock-step with the span attribute set, so dashboards can slice DB latency by operation verb, target collection, or error class – the dimensions OTel's database-spans semconv recommends.InstrumentedStreamgains a single-error latch so streams that yield multipleErritems before terminating cannot append duplicateerror.type/db.response.status_codekeys.Three additional attributes from the OTel database-spans recommended set now surface on every span and per-operation metric:
db.client.connection.pool.name(previously only on thedb.client.connection.countgauge; now on every span and the rest of thedb.client.connection.*family via the shared connection-attribute set),network.protocol.name(per-backend default via the newDatabase::DEFAULT_NETWORK_PROTOCOL_NAMEconstant; overridable viaPoolBuilder::with_network_protocol_name), andnetwork.transport(set explicitly viaPoolBuilder::with_network_transport; the wrapper does not infer transport from the connect string).