Skip to content

Fix InfluxDB stable DB semconv attributes#18991

Closed
trask wants to merge 3 commits into
open-telemetry:mainfrom
trask:influxdb-stable-db-semconv
Closed

Fix InfluxDB stable DB semconv attributes#18991
trask wants to merge 3 commits into
open-telemetry:mainfrom
trask:influxdb-stable-db-semconv

Conversation

@trask

@trask trask commented Jun 14, 2026

Copy link
Copy Markdown
Member

Built on top of #18989. Splits InfluxDB query and operation requests so SQL queries continue to use parsed query semantics while create/delete/write operations emit stable low-cardinality operation names and preserve old semconv operation values.

Copilot AI review requested due to automatic review settings June 14, 2026 02:25
@trask trask requested a review from a team as a code owner June 14, 2026 02:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the InfluxDB 2.4 javaagent instrumentation and the incubator DB semconv helpers to better support stable DB semantic conventions: SQL queries keep SQL-parsed span naming, while create/delete/write operations emit stable low-cardinality operation names and preserve legacy db.operation values.

Changes:

  • Split InfluxDB request modeling into InfluxDbQuery (SQL-like) vs InfluxDbOperation (create/delete/write) and wire separate instrumenters for each.
  • Add/propagate stable db.collection.name support and introduce explicit getDbOperation() for legacy db.operation emission.
  • Update span-name extraction and tests to prefer db.collection.name over db.namespace and to align with stable/old semconv behavior.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbSingletons.java Split into query vs operation instrumenters and adjust span-name/attribute extractors accordingly.
instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbImplInstrumentation.java Route query calls to the query instrumenter and create/delete/write calls to the operation instrumenter.
instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbScope.java Make scope container generic so it can carry either query or operation requests with their instrumenter.
instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbQuery.java New request type for query operations (host/port/namespace/query).
instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbQueryAttributesGetter.java New SQL getter for query requests, enabling SQL parsing-based semantics for queries.
instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbOperation.java Rename/split old request type into operation-focused request (host/port/namespace/operation).
instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbAttributesGetter.java Switch to DbClientAttributesGetter for operations; preserve old db.operation via mapping while emitting stable operation names.
instrumentation/influxdb-2.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbClientTest.java Update expected span names and operation attributes for stable vs old semconv across write/create/delete/udp cases.
instrumentation/influxdb-2.4/javaagent/src/test24/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbClient24Test.java Same test expectation updates for the JDK24 test variant.
instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientAttributesGetter.java Add getDbOperation() (legacy) and getDbCollectionName() (stable) to the getter contract.
instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientAttributesExtractor.java Emit stable db.collection.name and use legacy getDbOperation() for old db.operation.
instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientSpanNameExtractor.java Prefer db.collection.name over db.namespace for stable naming; use legacy getDbOperation() for old naming.
instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlClientAttributesGetter.java Update defaults/docs around operation/collection getters in SQL getters.
instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientAttributesExtractorTest.java Expand tests to cover db.collection.name and legacy db.operation behavior.
instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientSpanNameExtractorTest.java Add test coverage for preferring collection name over namespace and adjust fallbacks for empty SQL text.

Comment on lines 25 to 31
/**
* SqlClientAttributesExtractor will try to populate db.operation.name based on {@link
* #getRawQueryTexts(REQUEST)}, but this can be used to explicitly provide the operation name.
* DO NOT USE OR OVERRIDE THIS METHOD.
*
* <p>{@link SqlClientAttributesExtractor} will try to populate {@code db.operation.name} based on
* {@link #getRawQueryTexts(REQUEST)} when {@link
* SqlClientAttributesExtractorBuilder#setSingleOperationAndCollection(boolean)} is enabled.
*/
Comment on lines +58 to +64
/**
* DO NOT USE OR OVERRIDE THIS METHOD.
*
* <p>{@link SqlClientAttributesExtractor} will try to populate {@code db.collection.name} based
* on {@link #getRawQueryTexts(REQUEST)} when {@link
* SqlClientAttributesExtractorBuilder#setSingleOperationAndCollection(boolean)} is enabled.
*/
@trask trask marked this pull request as draft June 14, 2026 02:56
@trask

trask commented Jun 14, 2026

Copy link
Copy Markdown
Member Author

Closing, this has to be done in #18989

@trask trask closed this Jun 14, 2026
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.

2 participants