-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Enhance OpenTelemetry span logging to include query settings #70011
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
Changes from all commits
9f8964a
e524469
4eddbe6
6358a14
15a86ae
88671d8
6d308b3
a0e2e6a
36e29e4
ef9b9a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| #include <Common/MemoryTrackerBlockerInThread.h> | ||
| #include <Common/SensitiveDataMasker.h> | ||
| #include <Common/FailPoint.h> | ||
| #include <Common/FieldVisitorToString.h> | ||
|
|
||
| #include <Interpreters/AsynchronousInsertQueue.h> | ||
| #include <Interpreters/Cache/QueryCache.h> | ||
|
|
@@ -564,6 +565,25 @@ void logQueryFinish( | |
| query_span->addAttributeIfNotZero("clickhouse.written_rows", elem.written_rows); | ||
| query_span->addAttributeIfNotZero("clickhouse.written_bytes", elem.written_bytes); | ||
| query_span->addAttributeIfNotZero("clickhouse.memory_usage", elem.memory_usage); | ||
|
|
||
| if (context) | ||
| { | ||
| std::string user_name = context->getUserName(); | ||
| query_span->addAttribute("clickhouse.user", user_name); | ||
| } | ||
|
|
||
| if (settings[Setting::log_query_settings]) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this feature is controlled by this setting, it's better to update docs and the setting description in the code to reflect this change.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated documentation and setting descriptions |
||
| { | ||
| auto changed_settings_names = settings.getChangedNames(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You already have this in settings.changes(). No need to add a new function and call .get() every time |
||
| for (const auto & name : changed_settings_names) | ||
| { | ||
| Field value = settings.get(name); | ||
| String value_str = convertFieldToString(value); | ||
|
|
||
| query_span->addAttribute(fmt::format("clickhouse.setting.{}", name), value_str); | ||
|
|
||
| } | ||
| } | ||
| query_span->finish(); | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sharathks118 Without a link to the corresponding setting in "settings.md", readers will be confused by "Log-query-settings" and below description.