Add from and to to default dashboards#87823
Conversation
|
Workflow [PR], commit [3b63e42] Summary: ❌
|
vdimir
left a comment
There was a problem hiding this comment.
Overall looks great! What do you think about making it a bit more user-friendly by adding placeholders and hover text? It's not really clear what format to use for entering data until you see the actual queries. Something like this:
diff --git a/programs/server/dashboard.html b/programs/server/dashboard.html
index 727d65316a7..0a01a9df6f8 100644
--- a/programs/server/dashboard.html
+++ b/programs/server/dashboard.html
@@ -548,8 +548,18 @@ let queries = [];
/// All other parameters will be automatically found in the queries.
let default_params = {
'rounding': '60',
- 'seconds': '86400'
+ 'seconds': '86400',
+ // If unset, the `seconds` is used
+ 'from': '',
+ 'to': '',
};
+
+let default_params_desc = {
+ 'from': {'placeholder': '2023-01-01 00:00:00', 'title': 'Enter date in 2023-01-01 00:00:00 format. If empty, it is calculated as current time minus "seconds" parameter.'},
+ 'to': {'placeholder': '2023-01-02 00:00:00', 'title': 'Enter date in 2023-01-01 00:00:00 format. If empty, it is current time.'},
+ 'seconds': {'placeholder': '86400', 'title': 'Number of seconds to look back from current time. Default is 86400 (1 day).'},
+}
+
let params = default_params;
/// Palette generation for charts
@@ -667,6 +677,14 @@ function insertParam(name, value) {
param_value.name = `${name}`;
param_value.type = 'text';
param_value.value = value;
+ if (name in default_params_desc) {
+ if ('placeholder' in default_params_desc[name]) {
+ param_value.placeholder = default_params_desc[name]['placeholder'];
+ }
+ if ('title' in default_params_desc[name]) {
+ param_value.title = default_params_desc[name]['title'];
+ }
+ }
param_value.spellcheck = false;
let setWidth = e => { e.style.width = (e.value.length + 1) + 'ch' };
Also, the current parameter order is a bit confusing (from, seconds, to). It would probably be better to force it to from, to, seconds, but that would require some additional changes since we currently just iterate over object keys.
|
Hinting is a good idea, I'll add it. Regarding sorting, it's not so tricky. Added it. |
|
Integration tests failed. I'll fix them. BTW, I wonder if we can use |
|
No, the To see how it works, here's the data to try: {
"params": {
"rounding": "60",
"seconds": "86400",
"from": "",
"to": ""
},
"queries": [
{
"title": "Queries/second",
"query": "WITH toDateTimeOrDefault({from:DateTime}, '', now() - {seconds:UInt32}) AS from,\n toDateTimeOrDefault({to:DateTime}, '', now()) AS to\nSELECT toStartOfInterval(event_time, INTERVAL {rounding:UInt32} SECOND)::INT AS t, avg(ProfileEvent_Query)\nFROM merge('system', '^metric_log')\nWHERE event_date BETWEEN toDate(from) AND toDate(to) AND event_time BETWEEN from AND to\nGROUP BY t\nORDER BY t WITH FILL STEP {rounding:UInt32}"
},
{
"title": "CPU Usage (cores)",
"query": "WITH toDateTimeOrDefault({from:DateTime}, '', now() - {seconds:UInt32}) AS from,\n toDateTimeOrDefault({to:DateTime}, '', now()) AS to\nSELECT toStartOfInterval(event_time, INTERVAL {rounding:UInt32} SECOND)::INT AS t, avg(ProfileEvent_OSCPUVirtualTimeMicroseconds) / 1000000\nFROM merge('system', '^metric_log')\nWHERE event_date BETWEEN toDate(from) AND toDate(to) AND event_time BETWEEN from AND to\nGROUP BY t\nORDER BY t WITH FILL STEP {rounding:UInt32}"
},
{
"title": "Queries Running",
"query": "WITH toDateTimeOrDefault({from:DateTime}, '', now() - {seconds:UInt32}) AS from,\n toDateTimeOrDefault({to:DateTime}, '', now()) AS to\nSELECT toStartOfInterval(event_time, INTERVAL {rounding:UInt32} SECOND)::INT AS t, avg(CurrentMetric_Query)\nFROM merge('system', '^metric_log')\nWHERE event_date BETWEEN toDate(from) AND toDate(to) AND event_time BETWEEN from AND to\nGROUP BY t\nORDER BY t WITH FILL STEP {rounding:UInt32}"
},
{
"title": "Merges Running",
"query": "WITH toDateTimeOrDefault({from:DateTime}, '', now() - {seconds:UInt32}) AS from,\n toDateTimeOrDefault({to:DateTime}, '', now()) AS to\nSELECT toStartOfInterval(event_time, INTERVAL {rounding:UInt32} SECOND)::INT AS t, avg(CurrentMetric_Merge)\nFROM merge('system', '^metric_log')\nWHERE event_date BETWEEN toDate(from) AND toDate(to) AND event_time BETWEEN from AND to\nGROUP BY t\nORDER BY t WITH FILL STEP {rounding:UInt32}"
}
]
} |
c2561c6 to
fe1ce0a
Compare
c2561c6 to
3b63e42
Compare
|
test_trace_log_memory_context/test.py::test_memory_context_in_trace_log is broken test_quorum_inserts/test.py::test_insert_quorum_with_drop_partition has the same failure in master yesterday. If nothing else is broken, I merge it. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add
fromandtovalues to the system dashboards to facilitate historical investigations.Documentation entry for user-facing changes