Closed ealsur closed 2 years ago
This is similar to this issue: https://github.com/Azure/azure-cosmos-dotnet-v3/issues/1224
I think there is some confusion. This is not related to CosmosDiagnostics. This is only referring to the DefaultTrace inside the SDK as part of the .NET framework. CosmosDiagnostic levels will need to be handled separately. I think the naming will need to be clear to avoid confusion.
Yes, this has no relationship with Diagnostics in the operations, but rather the SDK usage of DefaultTrace across the code.
I think it needs to be renamed to CosmosClientOptions.TraceOptions
to avoid confusion with CosmosDiagnostics.
@ealsur I have a hard time to follow. I cannot find this options with the package Microsoft.Azure.Cosmos
version 3.27.0
.
Has this been implemented or do we still have to use reflection ?
Also has any implementation with Microsoft.Extensions.Logging.ILoggerFactory
and Microsoft.Extensions.Logging.ILogger
are planned ? I think this SDK is used a lot in WebServices and it would be great to have a dependency injection compatible SDK.
@RamenTurismo not implemented. The team is working on AI (Application Insights) and Open Telemetry integration, PRs for that are in progress.
Adding options to customize Trace listeners for our traces when running on NET Core environment would be great, and also, to disable all trace listeners (including DefaultTraceListener).
If users want to send traces to a particular sink, in NET Core, today it's extremely complex. When running in NETFX, this can be achieved by web.config/app.config.
It requires some weird hack like:
Ideally, we could expose some config APIs like:
CosmosClientOptions.DiagnosticOptions.DisableTraces
: It would disable all tracing and any machine wide default trace listeners from the SDK trace source.CosmosClientOptions.DiagnosticOptions.AttachTraceListeners(IEnumerable<TraceListener>)
: Would attach the listeners to our trace source programmatically.For performance reasons, any application that does not want to collect traces can disable them to avoid any lock contention on the default machine-wide tracing.