Fix Elasticsearch REST stable DB operation names#18988
Closed
trask wants to merge 3 commits into
Closed
Conversation
3975e68 to
592ac1a
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Elasticsearch REST low-level client instrumentation to derive stable, low-cardinality database operation names from REST API paths, while preserving legacy operation naming behavior for old semconv span names introduced/extended in #18989.
Changes:
- Infer stable
db.operation.namefor Elasticsearch REST requests from API paths when endpoint metadata isn’t available. - Gate Elasticsearch span naming between stable operation names vs legacy naming using
emitStableDatabaseSemconv(). - Extend DB client incubator API/tests to support
db.collection.nameand to separate stable operation naming from olddb.operation.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| instrumentation/elasticsearch/elasticsearch-rest-common-5.0/library/src/test/java/io/opentelemetry/instrumentation/elasticsearch/rest/common/v5_0/internal/ElasticsearchDbAttributesGetterTest.java | Adds unit coverage for REST-path-based operation name inference and legacy behavior. |
| instrumentation/elasticsearch/elasticsearch-rest-common-5.0/library/src/main/java/io/opentelemetry/instrumentation/elasticsearch/rest/common/v5_0/internal/ElasticsearchSpanNameExtractor.java | Switches span naming between stable operation names and legacy naming based on semconv stability. |
| instrumentation/elasticsearch/elasticsearch-rest-common-5.0/library/src/main/java/io/opentelemetry/instrumentation/elasticsearch/rest/common/v5_0/internal/ElasticsearchDbAttributesGetter.java | Implements stable operation-name inference from REST API path and keeps deprecated legacy operation accessor. |
| instrumentation/elasticsearch/elasticsearch-rest-7.0/library/src/test/java/io/opentelemetry/instrumentation/elasticsearch/rest/v7_0/ElasticsearchRest7Test.java | Updates library tests to assert span name/attrs under stable vs legacy semconv modes. |
| instrumentation/elasticsearch/elasticsearch-rest-7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/v7_0/ElasticsearchRest7Test.java | Updates javaagent tests for stable operation names and metrics attribute presence. |
| instrumentation/elasticsearch/elasticsearch-rest-6.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/v6_4/ElasticsearchRest6Test.java | Same as above for ES 6.4 javaagent coverage. |
| instrumentation/elasticsearch/elasticsearch-rest-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/elasticsearch/rest/v5_0/ElasticsearchRest5Test.java | Same as above for ES 5.0 javaagent coverage. |
| instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientSpanNameExtractorTest.java | Updates/extends span-name tests for stable vs legacy paths and collection-vs-namespace targeting. |
| instrumentation-api-incubator/src/test/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientAttributesExtractorTest.java | Updates extractor tests for new db.collection.name and old db.operation plumbing. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/SqlClientAttributesGetter.java | Updates SQL getter docs and adds default getDbCollectionName hook. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientSpanNameExtractor.java | Refactors stable span-name target selection and adjusts old-vs-stable operation usage. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientAttributesGetter.java | Adds deprecated getDbOperation() and default getDbCollectionName() to split old vs stable fields. |
| instrumentation-api-incubator/src/main/java/io/opentelemetry/instrumentation/api/incubator/semconv/db/DbClientAttributesExtractor.java | Emits db.collection.name and sources old db.operation from getDbOperation(). |
595561a to
39bb6d8
Compare
39bb6d8 to
846d23f
Compare
trask
commented
Jun 15, 2026
| } | ||
|
|
||
| @Nullable | ||
| static String inferOperationName(String method, String endpoint) { |
Member
Author
There was a problem hiding this comment.
closing this PR, this is still not aligned with https://github.com/open-telemetry/semantic-conventions/blob/main/docs/db/elasticsearch.md, I think better not to emit than to make up heuristic here
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. Updates Elasticsearch REST low-level client instrumentation to infer stable low-cardinality database operation names from REST API paths while preserving old semconv operation names for legacy span naming.