Skip to content
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

Open Telemetry: Tests fail in preview mode #3693

Closed
ealsur opened this issue Feb 7, 2023 · 4 comments · Fixed by #3751
Closed

Open Telemetry: Tests fail in preview mode #3693

ealsur opened this issue Feb 7, 2023 · 4 comments · Fixed by #3751
Assignees
Labels
bug Something isn't working Engineering engineering improvements (CI, tests, etc.) Telemetry

Comments

@ealsur
Copy link
Member

ealsur commented Feb 7, 2023

When running the emulator tests on preview mode, the Listener tests fail:

dotnet.exe test D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Microsoft.Azure.Cosmos.EmulatorTests.csproj --filter "TestCategory!=Quarantine & TestCategory!=Functional & TestCategory!=Query & TestCategory!=ReadFeed & TestCategory!=Batch & TestCategory!=ChangeFeed" --verbosity normal --configuration Release /p:OS=Windows /p:IsPreview=true

Failed ItemIterator [24 ms]
Error Message:
Assert.AreEqual failed. Expected:. Actual:. Actual Kind is Internal but expected is Client for Operation.CreateDatabaseAsync
Stack Trace:
at Microsoft.Azure.Cosmos.Tracing.AssertActivity.IsValid(Activity activity) in D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Tracing\AssertActivity.cs:line 19
at Microsoft.Azure.Cosmos.Tests.CustomListener.OnNext(KeyValuePair2 value) in D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Tracing\CustomListener.cs:line 70 at System.Diagnostics.DiagnosticListener.Write(String name, Object value) at Azure.Core.Pipeline.DiagnosticScope.ActivityAdapter.Dispose() in D:\a\1\s\Microsoft.Azure.Cosmos\src\OSS\Azure.Core\DiagnosticScope.cs:line 339 at Microsoft.Azure.Cosmos.Telemetry.OpenTelemetryCoreRecorder.Dispose() in D:\a\1\s\Microsoft.Azure.Cosmos\src\Telemetry\OpenTelemetry\OpenTelemetryCoreRecorder.cs:line 155 at Microsoft.Azure.Cosmos.ClientContextCore.RunWithDiagnosticsHelperAsync[TResult](String containerName, String databaseName, OperationType operationType, ITrace trace, Func2 task, Func2 openTelemetry, String operationName, RequestOptions requestOptions) in D:\a\1\s\Microsoft.Azure.Cosmos\src\Resource\ClientContextCore.cs:line 547 at Microsoft.Azure.Cosmos.ClientContextCore.OperationHelperWithRootTraceAsync[TResult](String operationName, String containerName, String databaseName, OperationType operationType, RequestOptions requestOptions, Func2 task, Func2 openTelemetry, TraceComponent traceComponent, TraceLevel traceLevel) in D:\a\1\s\Microsoft.Azure.Cosmos\src\Resource\ClientContextCore.cs:line 264 at Microsoft.Azure.Cosmos.SDK.EmulatorTests.BaseCosmosClientHelper.TestInit(Boolean validateSinglePartitionKeyRangeCacheCall, Action1 customizeClientBuilder, String accountEndpointOverride) in D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Utils\BaseCosmosClientHelper.cs:line 33
at Microsoft.Azure.Cosmos.SDK.EmulatorTests.CosmosItemTests.TestInitialize() in D:\a\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\CosmosItemTests.cs:line 60

@ealsur ealsur added bug Something isn't working Telemetry labels Feb 7, 2023
@MarcelWouters
Copy link

@sourabh1007 is Open Telemetry already available? I cannot find any documentation how to enable this.

@sourabh1007
Copy link
Contributor

Its available in private preview mode. It's not publicly available yet. It latest preview package, we have a feature flag IsDistributedTracingEnabled which is enabled by default. With open telemetry, you can enable it with below code snippet

AppContext.SetSwitch("Azure.Experimental.EnableActivitySource", true);

 Sdk.CreateTracerProviderBuilder()
                .AddCustomOtelExporter() // use any exporter here
                .AddSource("Azure.Cosmos.Operation")
                .Build();

You can have a taste of it and feel free to create bug/feature request.

@MarcelWouters
Copy link

MarcelWouters commented Feb 20, 2023

Thanks @sourabh1007 I gonna try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Engineering engineering improvements (CI, tests, etc.) Telemetry
Projects
Status: Done
3 participants