Enhance OpenTelemetry span logging to include query settings#70011
Enhance OpenTelemetry span logging to include query settings#70011kssenii merged 10 commits intoClickHouse:masterfrom
Conversation
| query_id=$(${CLICKHOUSE_CLIENT} -q "select generateUUIDv4()"); | ||
| execute_query $query_id 'select * from opentelemetry_test format Null' | ||
| check_query_span $query_id | ||
| check_query_settings |
There was a problem hiding this comment.
need to also update according tests/queries/0_stateless/02421_simple_queries_for_opentelemetry.reference file
There was a problem hiding this comment.
Update test script and reference file as per review comments
programs/server/config.xml
Outdated
| <interserver_http_port>9009</interserver_http_port> | ||
|
|
||
| <settings> | ||
| <log_query_settings>1</log_query_settings> |
There was a problem hiding this comment.
This is not the correct place to modify settings for the tests, please modify ClickHouse/tests/configs/ instead
There was a problem hiding this comment.
Addressed the review comments
programs/server/users.xml
Outdated
| <profiles> | ||
| <!-- Default settings. --> | ||
| <default> | ||
| <allow_introspection_functions>1</allow_introspection_functions> |
There was a problem hiding this comment.
This does not look required for the test. Anyway same comment as above that this is not the correct place to modify settings for tests.
| { | ||
| ${CLICKHOUSE_CLIENT} -q " | ||
| SYSTEM FLUSH LOGS; | ||
| SELECT attribute |
There was a problem hiding this comment.
This test will give too big output, better to search for specific query settings.
There was a problem hiding this comment.
Update test script and reference file as per review comments
|
This is an automated comment for commit ef9b9a2 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
Removed config files changes
|
@sharathks118 Hi, there is an issue with checks. |
src/Interpreters/executeQuery.cpp
Outdated
| break; | ||
| } | ||
|
|
||
| query_span->addAttribute(name, value_str); |
There was a problem hiding this comment.
I would like to suggest adding a prefix(like clickhouse.setting.) to the name so that all these query setting names in the span log can be easily distinguished from other attributes.
There was a problem hiding this comment.
Addressed review comments by adding a "clickhouse.setting." prefix to query setting names
| query_span->addAttribute("clickhouse.user", user_name); | ||
| } | ||
|
|
||
| if (settings[Setting::log_query_settings]) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Updated documentation and setting descriptions
Updated relevant documentation and setting descriptions to reflect this change.
|
The test failure in the pipeline is not related to my changes. |
src/Interpreters/executeQuery.cpp
Outdated
| Field value = settings.get(name); | ||
| String value_str; | ||
|
|
||
| switch (value.getType()) |
There was a problem hiding this comment.
Let's use here convertFieldToString from Common/FieldVisitorToString.h
There was a problem hiding this comment.
updated the code to use convertFieldToString from Common/FieldVisitorToString.h
|
The failure in the pipeline is unrelated to my changes. |
|
|
||
| if (settings[Setting::log_query_settings]) | ||
| { | ||
| auto changed_settings_names = settings.getChangedNames(); |
There was a problem hiding this comment.
You already have this in settings.changes(). No need to add a new function and call .get() every time
|
|
||
| The tags or attributes are saved as two parallel arrays, containing the keys and values. Use [ARRAY JOIN](../sql-reference/statements/select/array-join.md) to work with them. | ||
|
|
||
| ## Log-query-settings |
There was a problem hiding this comment.
@sharathks118 Without a link to the corresponding setting in "settings.md", readers will be confused by "Log-query-settings" and below description.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Enhance OpenTelemetry span logging to include query settings
Documentation entry for user-facing changes
CI Settings (Only check the boxes if you know what you are doing):