Fix InfluxDB stable DB semconv attributes#18991
Closed
trask wants to merge 3 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
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) vsInfluxDbOperation(create/delete/write) and wire separate instrumenters for each. - Add/propagate stable
db.collection.namesupport and introduce explicitgetDbOperation()for legacydb.operationemission. - Update span-name extraction and tests to prefer
db.collection.nameoverdb.namespaceand 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. | ||
| */ |
Member
Author
|
Closing, this has to be done in #18989 |
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.
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.