-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fixing OpenTelemetryTraces to include the GA V1 semantic conventionttributes #45929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
FabianMeiswinkel
merged 8 commits into
Azure:main
from
FabianMeiswinkel:users/fabianm/OTelTraceGAFix
Jul 9, 2025
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9a2421a
Fixing OpenTelemetryTraces to include the GA V1 semantic convention a…
FabianMeiswinkel 3def90b
Update CHANGELOG.md
FabianMeiswinkel 2f458c1
Update sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/impleme…
FabianMeiswinkel e716a5d
Merge branch 'main' into users/fabianm/OTelTraceGAFix
FabianMeiswinkel e84613f
Update AttributeNamingScheme.java
FabianMeiswinkel bb212b8
Merge branch 'main' into users/fabianm/OTelTraceGAFix
FabianMeiswinkel 38d4c0a
Merge branch 'main' into users/fabianm/OTelTraceGAFix
FabianMeiswinkel 069b058
Update sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/impleme…
FabianMeiswinkel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
320 changes: 300 additions & 20 deletions
320
sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/CosmosTracerTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
288 changes: 232 additions & 56 deletions
288
...osmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DiagnosticsProvider.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
20 changes: 20 additions & 0 deletions
20
...s/src/main/java/com/azure/cosmos/implementation/clienttelemetry/AttributeNamesCommon.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.azure.cosmos.implementation.clienttelemetry; | ||
|
|
||
| public enum AttributeNamesCommon { | ||
| DB_SYSTEM("db.system"), | ||
| DB_OPERATION("db.operation"), | ||
| USER_AGENT("user_agent.original"); | ||
|
|
||
| private final String name; | ||
|
|
||
| private AttributeNamesCommon(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return this.name; | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
...os/src/main/java/com/azure/cosmos/implementation/clienttelemetry/AttributeNamesPreV1.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.azure.cosmos.implementation.clienttelemetry; | ||
|
|
||
| public enum AttributeNamesPreV1 { | ||
| NET_PEER_NAME("net.peer.name"), | ||
| EXCEPTION_ESCAPED("exception.escaped"), | ||
| EXCEPTION_TYPE("exception.type"), | ||
| EXCEPTION_MESSAGE("exception.message"), | ||
| EXCEPTION_STACKTRACE("exception.stacktrace"), | ||
| CDB_OPERATION_TYPE("db.cosmosdb.operation_type"), | ||
| CDB_RESOURCE_TYPE("db.cosmosdb.resource_type"), | ||
| CDB_DB_NAME("db.name"), | ||
| CDB_CLIENT_ID("db.cosmosdb.client_id"), | ||
| CDB_CONNECTION_MODE("db.cosmosdb.connection_mode"), | ||
| CDB_QUERY_STATEMENT("db.statement"), | ||
| CDB_OPERATION_ID("db.cosmosdb.operation_id"), | ||
| CDB_CONTAINER_NAME("db.cosmosdb.container"), | ||
| CDB_STATUS_CODE("db.cosmosdb.status_code"), | ||
| CDB_SUB_STATUS_CODE("db.cosmosdb.sub_status_code"), | ||
| CDB_REQUEST_CHARGE("db.cosmosdb.request_charge"), | ||
| CDB_REQUEST_CONTENT_SIZE("db.cosmosdb.request_content_length"), | ||
| CDB_RESPONSE_CONTENT_SIZE("db.cosmosdb.max_response_content_length_bytes"), | ||
| CDB_RETRY_COUNT("db.cosmosdb.retry_count"), | ||
| CDB_CONTACTED_REGIONS("db.cosmosdb.regions_contacted"), | ||
| CDB_IS_EMPTY_COMPLETION("db.cosmosdb.is_empty_completion"), | ||
| ; | ||
|
|
||
| private final String name; | ||
|
|
||
| private AttributeNamesPreV1(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return this.name; | ||
| } | ||
| } |
45 changes: 45 additions & 0 deletions
45
...osmos/src/main/java/com/azure/cosmos/implementation/clienttelemetry/AttributeNamesV1.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.azure.cosmos.implementation.clienttelemetry; | ||
|
|
||
| public enum AttributeNamesV1 { | ||
| DB_NAMESPACE("db.namespace"), | ||
| DB_SYSTEM_NAME("db.system.name"), | ||
| DB_OPERATION_NAME("db.operation.name"), | ||
| DB_QUERY_TEXT("db.query.text"), | ||
| DB_COLLECTION_NAME("db.collection.name"), | ||
| DB_RESPONSE_STATUS_CODE("db.response.status_code"), | ||
| DB_OPERATION_BATCH_SIZE("db.operation.batch.size"), | ||
| ERROR_TYPE("error.type"), | ||
| SERVER_ADDRESS("server.address"), | ||
| CLIENT_ID("azure.client.id"), | ||
| CDB_NAMESPACE("azure.cosmosdb.namespace"), | ||
| CDB_COLLECTION_NAME("azure.cosmosdb.collection.name"), | ||
| CDB_CONNECTION_MODE("azure.cosmosdb.connection.mode"), | ||
| CDB_OPERATION("azure.cosmosdb.operation"), | ||
| CDB_QUERY_TEXT("azure.cosmosdb.query.text"), | ||
| CDB_RESPONSE_STATUS_CODE("azure.cosmosdb.response.status_code"), | ||
| CDB_RESPONSE_SUB_STATUS_CODE("azure.cosmosdb.response.sub_status_code"), | ||
| CDB_ERROR_MESSAGE("azure.cosmosdb.error.message"), | ||
| CDB_ERROR_STACKTRACE("azure.cosmosdb.error.stacktrace"), | ||
| CDB_CONSISTENCY_LEVEL("azure.cosmosdb.consistency.level"), | ||
| CDB_READ_CONSISTENCY_STRATEGY("azure.cosmosdb.read_consistency.strategy"), | ||
| CDB_REQUEST_CHARGE("azure.cosmosdb.operation.request_charge"), | ||
| CDB_REQUEST_BODY_SIZE("azure.cosmosdb.request.body.size"), | ||
| CDB_MAX_RESPONSE_BODY_SIZE("azure.cosmosdb.response.body.size"), | ||
| CDB_RETRY_COUNT("azure.cosmosdb.retry_count"), | ||
| CDB_CONTACTED_REGIONS("azure.cosmosdb.operation.contacted_regions"), | ||
| CDB_OPERATION_BATCH_SIZE("azure.cosmosdb.operation.batch.size"), | ||
| CDB_IS_EMPTY_COMPLETION("azure.cosmosdb.is_empty_completion"); | ||
|
|
||
| private final String name; | ||
|
|
||
| private AttributeNamesV1(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return this.name; | ||
| } | ||
| } |
50 changes: 50 additions & 0 deletions
50
.../src/main/java/com/azure/cosmos/implementation/clienttelemetry/AttributeNamingScheme.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| package com.azure.cosmos.implementation.clienttelemetry; | ||
|
|
||
| import com.azure.cosmos.implementation.Configs; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.EnumSet; | ||
| import java.util.List; | ||
|
|
||
| public enum AttributeNamingScheme { | ||
| PRE_V1_RELEASE, | ||
| V1; | ||
|
|
||
| private static final Logger logger = LoggerFactory.getLogger(Configs.class); | ||
FabianMeiswinkel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| public static EnumSet<AttributeNamingScheme> parse(String name) { | ||
| if (name == null || name.isEmpty() || "All".equalsIgnoreCase(name) || "Default".equalsIgnoreCase(name)) { | ||
| return EnumSet.allOf(AttributeNamingScheme.class); | ||
| } | ||
|
|
||
| String[] textValues = name.split(","); | ||
| List<AttributeNamingScheme> schemeList = new ArrayList<>(); | ||
| for (String textValue : textValues) { | ||
| boolean foundTextValue = false; | ||
| for (AttributeNamingScheme scheme : values()) { | ||
| if (scheme.name().equalsIgnoreCase(textValue)) { | ||
| foundTextValue = true; | ||
| schemeList.add(scheme); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| if (!foundTextValue) { | ||
| logger.error("Invalid AttributeNamingScheme: " + textValue + " in '" + name + | ||
| "' - proceeding with default value 'ALL'"); | ||
|
|
||
| return EnumSet.allOf(AttributeNamingScheme.class); | ||
| } | ||
| } | ||
|
|
||
| if (schemeList.size() > 0) { | ||
| return EnumSet.copyOf(schemeList); | ||
| } | ||
|
|
||
| return EnumSet.allOf(AttributeNamingScheme.class); | ||
| } | ||
| } | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.