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 : Adds query text in attribute #4664

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

sourabh1007
Copy link
Contributor

@sourabh1007 sourabh1007 commented Sep 4, 2024

Description

  1. Added db.query.text attribute to record queries in Traces.
  2. Introduced new ShowQueryMode, which will have valid values as
    a) NONE :Do not show query.
    b) PARAMETERIZED_ONLY : Print parameterized query only.
    b) ALL
  3. It can be set as part of CosmosClientTelemetryOptions and RequestOptions (i.e. QueryRequestOptions and ChangeFeedRequestOptions)

Type of change

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

@sourabh1007 sourabh1007 marked this pull request as draft September 4, 2024 17:16
@sourabh1007 sourabh1007 force-pushed the users/sourabhjain/addqueryTextinOtel branch 3 times, most recently from 2f7c8e7 to e663af5 Compare September 11, 2024 01:24
@sourabh1007 sourabh1007 marked this pull request as ready for review September 12, 2024 00:45
@sourabh1007 sourabh1007 requested a review from a team as a code owner September 12, 2024 00:45
@sourabh1007 sourabh1007 force-pushed the users/sourabhjain/addqueryTextinOtel branch from 816b162 to 8e29f00 Compare September 13, 2024 12:32
Copy link
Contributor

@jcocchi jcocchi left a comment

Choose a reason for hiding this comment

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

Do we want to have an opt in to also capture parameter values attributes? This is described in the otel conventions, but we can always go back and add it if there's demand later.

db.query.parameter.<key>

showQueryMode = queryRequestOptions.ShowQueryMode.Value;

}
else if (requestOptions is ChangeFeedRequestOptions changeFeedRequestOptions && changeFeedRequestOptions.ShowQueryMode.HasValue)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to show query text for change feed operations?

Copy link
Contributor Author

@sourabh1007 sourabh1007 Sep 18, 2024

Choose a reason for hiding this comment

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

There is an option to pass query in change feed iterator. We can discuss and understand, if we really need it.

Copy link
Contributor

Choose a reason for hiding this comment

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

What scenario would change feed expose a query in traces and when would it not? Do you have examples?

/// <summary>
/// Defines whether to print query in tracing attributes
/// </summary>
public enum ShowQueryMode
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the values ​​be in pascal case instead? It seems this is the convention in this repo like:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants