-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Open Telemetry: Adds open telemetry based versioning (#4854)
## Description Introducing versioning for open telemetry attributes, to make we are always backward compatible. Environment Variable `OTEL_SEMCONV_STABILITY_OPT_IN` value supported : `database` => Otel supported attributes. (right now, same as default, in future can be used to put any attribute change) `database/dup` => Otel and appinsights attributes ( for those, who are moving from appinsightclassic to otel) `default` => Otel Attributes **_(Breaking change, needs to be documented)_** `appinsightssdk` => backward compatibility to appinsights. Other minor changes, 1. Fix connection mode casing ``` { ConnectionMode.Direct => "direct", ConnectionMode.Gateway => "gateway", _ => throw new NotImplementedException() }; ``` 2. rename `db.cosmosdb.item_count` => `db.cosmosdb.row_count` ### Code changes Overview 1. Introduced, `TracesStabilityFactory.cs` : Responsible to take care of version based attributes. 2. Updated Baseline Tests to have old and new both attributes in contract file. ## 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
- Loading branch information
1 parent
80ea40a
commit 925cebe
Showing
23 changed files
with
2,363 additions
and
506 deletions.
There are no files selected for viewing
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
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
39 changes: 39 additions & 0 deletions
39
Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/DatabaseDupAttributeKeys.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,39 @@ | ||
//------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
//------------------------------------------------------------ | ||
|
||
namespace Microsoft.Azure.Cosmos.Telemetry | ||
{ | ||
using System; | ||
using global::Azure.Core; | ||
|
||
internal class DatabaseDupAttributeKeys : IActivityAttributePopulator | ||
{ | ||
private readonly IActivityAttributePopulator appInsightPopulator; | ||
private readonly IActivityAttributePopulator otelPopulator; | ||
|
||
public DatabaseDupAttributeKeys() | ||
{ | ||
this.otelPopulator = new OpenTelemetryAttributeKeys(); | ||
this.appInsightPopulator = new AppInsightClassicAttributeKeys(); | ||
} | ||
|
||
public void PopulateAttributes(DiagnosticScope scope, string operationName, string databaseName, string containerName, Uri accountName, string userAgent, string machineId, string clientId, string connectionMode) | ||
{ | ||
this.appInsightPopulator.PopulateAttributes(scope, operationName, databaseName, containerName, accountName, userAgent, machineId, clientId, connectionMode); | ||
this.otelPopulator.PopulateAttributes(scope, operationName, databaseName, containerName, accountName, userAgent, machineId, clientId, connectionMode); | ||
} | ||
|
||
public void PopulateAttributes(DiagnosticScope scope, Exception exception) | ||
{ | ||
this.appInsightPopulator.PopulateAttributes(scope, exception); | ||
this.otelPopulator.PopulateAttributes(scope, exception); | ||
} | ||
|
||
public void PopulateAttributes(DiagnosticScope scope, QueryTextMode? queryTextMode, string operationType, OpenTelemetryAttributes response) | ||
{ | ||
this.appInsightPopulator.PopulateAttributes(scope, queryTextMode, operationType, response); | ||
this.otelPopulator.PopulateAttributes(scope, queryTextMode, operationType, response); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/IActivityAttributePopulator.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,29 @@ | ||
// ------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// ------------------------------------------------------------ | ||
|
||
namespace Microsoft.Azure.Cosmos.Telemetry | ||
{ | ||
using System; | ||
using global::Azure.Core; | ||
|
||
internal interface IActivityAttributePopulator | ||
{ | ||
public void PopulateAttributes(DiagnosticScope scope, | ||
string operationName, | ||
string databaseName, | ||
string containerName, | ||
Uri accountName, | ||
string userAgent, | ||
string machineId, | ||
string clientId, | ||
string connectionMode); | ||
|
||
public void PopulateAttributes(DiagnosticScope scope, Exception exception); | ||
|
||
public void PopulateAttributes(DiagnosticScope scope, | ||
QueryTextMode? queryTextMode, | ||
string operationType, | ||
OpenTelemetryAttributes response); | ||
} | ||
} |
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.