-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-Pick Appinsights: Adds classic attribute back to cosmos db to …
…support appinsights sdk (#4781) (#4799) (#4804) ## Description As part of this PR, adding back attributes required by appinsights sdk. It broke the customer experience with appinsight as Appinsight SDK supports very specific set of attributes. This implementation will change in future release, where open telemetry attributes will be controlled by Env Variable as mentioned here. https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/database-spans.md#semantic-conventions-for-database-client-calls **4.42.3** ![image](https://github.com/user-attachments/assets/6c19eab0-4884-4648-b6d9-c941d58e8e0b) **v4.43.0** ![image](https://github.com/user-attachments/assets/fd2a70b4-ed37-4618-b1a5-f654587bf6ab) **v4.43.1** ![image](https://github.com/user-attachments/assets/5bbe54ec-34f3-4538-a7b4-abff1b1853ea) After this PR: ![image](https://github.com/user-attachments/assets/2ea64a34-4e57-4dec-a29e-32ffcd77919a) After this change, customer has to set `OTEL_SEMCONV_STABILITY_OPT_IN` to `database/dup`, in order to see the otel (new and old) attributes. otherwise SDK will emit only classic attributes which would be compatible with appinsights sdk also. ## Type of change - [] Bug fix (non-breaking change which fixes an issue) # Pull Request Template ## Description Please include a summary of the change and which issue is fixed. Include samples if adding new API, and include relevant motivation and context. List any dependencies that are required for this change. ## Type of change Please delete options that are not relevant. - [] Bug fix (non-breaking change which fixes an issue) - [] New feature (non-breaking change which adds functionality) - [] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [] This change requires a documentation update ## Closing issues To automatically close an issue: closes #IssueNumber Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
- Loading branch information
1 parent
307be70
commit 9055f93
Showing
14 changed files
with
1,087 additions
and
944 deletions.
There are no files selected for viewing
89 changes: 89 additions & 0 deletions
89
Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/AppInsightClassicAttributeKeys.cs
This file contains 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,89 @@ | ||
//------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
//------------------------------------------------------------ | ||
|
||
namespace Microsoft.Azure.Cosmos.Telemetry | ||
{ | ||
internal sealed class AppInsightClassicAttributeKeys | ||
{ | ||
/// <summary> | ||
/// Represents the diagnostic namespace for Azure Cosmos. | ||
/// </summary> | ||
public const string DbName = "db.name"; | ||
|
||
/// <summary> | ||
/// Represents the name of the database operation. | ||
/// </summary> | ||
public const string DbOperation = "db.operation"; | ||
|
||
/// <summary> | ||
/// Represents the server address. | ||
/// </summary> | ||
public const string ServerAddress = "net.peer.name"; | ||
|
||
/// <summary> | ||
/// Represents the name of the container in Cosmos DB. | ||
/// </summary> | ||
public const string ContainerName = "db.cosmosdb.container"; | ||
|
||
/// <summary> | ||
/// Represents the status code of the response. | ||
/// </summary> | ||
public const string StatusCode = "db.cosmosdb.status_code"; | ||
|
||
/// <summary> | ||
/// Represents the user agent | ||
/// </summary> | ||
public const string UserAgent = "db.cosmosdb.user_agent"; | ||
|
||
/// <summary> | ||
/// Represents the machine ID for Cosmos DB. | ||
/// </summary> | ||
public const string MachineId = "db.cosmosdb.machine_id"; | ||
|
||
/// <summary> | ||
/// Represents the type of operation for Cosmos DB. | ||
/// </summary> | ||
public const string OperationType = "db.cosmosdb.operation_type"; | ||
|
||
/// <summary> | ||
/// Represents the sub-status code of the response. | ||
/// </summary> | ||
public const string SubStatusCode = "db.cosmosdb.sub_status_code"; | ||
|
||
/// <summary> | ||
/// Represents the content length of the response. | ||
/// </summary> | ||
public const string ResponseContentLength = "db.cosmosdb.response_content_length_bytes"; | ||
|
||
/// <summary> | ||
/// Represents the client ID for Cosmos DB. | ||
/// </summary> | ||
public const string ClientId = "db.cosmosdb.client_id"; | ||
|
||
/// <summary> | ||
/// Represents the request charge for the operation. | ||
/// </summary> | ||
public const string RequestCharge = "db.cosmosdb.request_charge"; | ||
|
||
/// <summary> | ||
/// Represents the activity ID for the operation. | ||
/// </summary> | ||
public const string ActivityId = "db.cosmosdb.activity_id"; | ||
|
||
/// <summary> | ||
/// Represents the connection mode for Cosmos DB. | ||
/// </summary> | ||
public const string ConnectionMode = "db.cosmosdb.connection_mode"; | ||
|
||
/// <summary> | ||
/// Represents the regions contacted for the operation. | ||
/// </summary> | ||
public const string Region = "db.cosmosdb.regions_contacted"; | ||
|
||
/// <summary> | ||
/// Represents the item count in the operation. | ||
/// </summary> | ||
public const string ItemCount = "db.cosmosdb.item_count"; | ||
} | ||
} |
This file contains 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
22 changes: 22 additions & 0 deletions
22
Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryStablityModes.cs
This file contains 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,22 @@ | ||
// ------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// ------------------------------------------------------------ | ||
|
||
namespace Microsoft.Azure.Cosmos.Telemetry | ||
{ | ||
/// <summary> | ||
/// For More information, Ref https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/database-spans.md#semantic-conventions-for-database-client-calls | ||
/// </summary> | ||
internal sealed class OpenTelemetryStablityModes | ||
{ | ||
/// <summary> | ||
/// emit the new, stable database conventions, and stop emitting the old experimental database conventions that the instrumentation emitted previously. | ||
/// </summary> | ||
public const string Database = "database"; | ||
|
||
/// <summary> | ||
/// emit both the old and the stable database conventions, allowing for a seamless transition. | ||
/// </summary> | ||
public const string DatabaseDupe = "database/dup"; | ||
} | ||
} |
This file contains 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
Oops, something went wrong.