CosmosDB - Diagnostics in dotnet v3 SDK

banto 0 Reputation points
2025-02-28T14:43:58.66+00:00

Hello,

 

We are using CosmosDB dotnet v3 SDK and we are fetching around 550kb of data in one query.

Here is a gist of the code:

User's image

We noticed that the “ReadNextAsync()” method takes 180ms to execute. After closer examinations of the diagnostics, we can see that 160ms is spent just by sending telemetry data to azure :

User's image

Is it possible to disable or control the sending of these telemetry statistics in the client application ?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,786 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sai Raghunadh M 2,880 Reputation points Microsoft External Staff
    2025-02-28T20:10:58.15+00:00

    Hi @ banto

    Thanks for the Question and using Microsoft @&A.

    Yes, it is possible to disable or control the sending of telemetry statistics in a client application. The specific method depends on the application and the telemetry service being used. Here are a few general approaches:

    If you're using Azure Application Insights, you can disable telemetry by setting the DisableTelemetry property to true in the TelemetryConfiguration object. This prevents any telemetry data from being sent.

    https://dev.to/marktinderholt/mocking-telemetryclient-in-application-insights-a-simple-workaround-2mec

    You can use telemetry initializers to filter out specific telemetry data. For example, you can create a telemetry initializer that ignores certain types of telemetry based on conditions

    https://stackoverflow.com/questions/59535524/disable-application-insights-browser-telemetry-for-a-recurring-javascript-call

    Hope this helps. Do let us know if you any further queries.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.