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

[Preview] AI Integration: Adds latency based filters to add request diagnostics in Activity and some minor changes #3362

Merged
merged 42 commits into from
Aug 26, 2022

Conversation

sourabh1007
Copy link
Contributor

@sourabh1007 sourabh1007 commented Jul 26, 2022

Description

As part of this PR,

  1. Ways to set global Latency threshold:

a) Using Client Builder:

CosmosClientBuilder cosmosClientBuilder = new CosmosClientBuilder(
                accountEndpoint: endpoint,
                authKeyOrResourceToken: key).WithDistributingTracingOption(new DistributedTracingOptions
                {
                    LatencyThresholdToIncludeDiagnostics = TimeSpan.FromMilliseconds(100)
                });

b) Using Client Options:

CosmosClient cosmosClient = new CosmosClient(
        "account-endpoint-from-portal", 
        "account-key-from-portal", 
        new CosmosClientOptions()
        { 
         EnableDistributedTracing = true,
         DistributedTracingOptions = new DistributedTracingOptions
                {
                    LatencyThresholdToIncludeDiagnostics = TimeSpan.FromMilliseconds(100)
                }
});

c) Using Request Options:

ItemRequestOptions requestOptions = new ItemRequestOptions { 
               DistributedTracingOptions= new DistributedTracingOptions
                {
                    LatencyThresholdToIncludeDiagnostics = TimeSpan.FromMilliseconds(100)
                }
};
ItemResponse<ToDoActivity> createResponse = await container.CreateItemAsync<ToDoActivity>(testItem, requestOptions: requestOptions);
  1. Default Latency threshold has been set from Query and Non-Query operations
    image

In Java SDK, for Query operations it is 500ms, but in previous PRs, we decided to have threshold as 250ms in .Net SDK.
3. Changes the namespace name to Microsoft.Azure.Cosmos.Telemetry and fix corresponding imports.
4. Changed message to "information not available" from NA if information is not available.
5. Check Scope enablement before recording any value to avoid any precalculation overhead which we might be happening before setting attribute value.
6. Remove EnableOpenTelemetry API and Add internal EnableOpenTelemetrySupport API to enable this feature only in preview build and for GA build internal package like tests can enable it on demand
7. Add Account Host information instead of Account Name along with Cloud information in net.peer.name attribute.
8. Populate Database and Container information on Create Container calls
9. Populate Database information on Create Database Calls.

Type of change

  • [] New feature (non-breaking change which adds functionality)

@sourabh1007 sourabh1007 changed the title [Preview] AI Integration: Adds open telemetry config for Latency Filter [Preview] AI Integration: Adds open telemetry config for a filter Jul 26, 2022
@sourabh1007 sourabh1007 force-pushed the users/sourabhjain/otelconfig branch from 7ca17a5 to cf5eec6 Compare July 26, 2022 15:36
@sourabh1007 sourabh1007 self-assigned this Jul 26, 2022
@sourabh1007 sourabh1007 force-pushed the users/sourabhjain/otelconfig branch 2 times, most recently from b2d20ea to 9aaa843 Compare July 27, 2022 01:12
@sourabh1007 sourabh1007 force-pushed the users/sourabhjain/otelconfig branch from cd163b5 to f5ace49 Compare July 28, 2022 01:22
@sourabh1007 sourabh1007 changed the title [Preview] AI Integration: Adds open telemetry config for a filter [Preview] AI Integration: Adds Latency based filter to add request diagnostics in Activity Aug 1, 2022
@sourabh1007 sourabh1007 changed the title [Preview] AI Integration: Adds Latency based filter to add request diagnostics in Activity [Preview] AI Integration: Adds latency based filter to add request diagnostics in Activity Aug 1, 2022
@philipthomas-MSFT philipthomas-MSFT self-requested a review August 1, 2022 15:54
@sourabh1007 sourabh1007 force-pushed the users/sourabhjain/otelconfig branch from 20bdd6c to e256162 Compare August 3, 2022 04:46
Copy link
Contributor

@philipthomas-MSFT philipthomas-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my understanding, under what conditions will diagnostics be set to null?

@sourabh1007 sourabh1007 changed the title [Preview] AI Integration: Adds latency based filter to add request diagnostics in Activity [Preview] AI Integration: Adds latency based filters to add request diagnostics in Activity and some minor changes Aug 3, 2022
@sourabh1007
Copy link
Contributor Author

Just for my understanding, under what conditions will diagnostics be set to null?

ReadThroughputIfExistsAsync is one of the functions where diagnostics will be null.

@sourabh1007 sourabh1007 force-pushed the users/sourabhjain/otelconfig branch 2 times, most recently from 6ddc4bf to 5eaa2a2 Compare August 4, 2022 19:18
@ealsur ealsur merged commit 875109d into master Aug 26, 2022
@ealsur ealsur deleted the users/sourabhjain/otelconfig branch August 26, 2022 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants