From d73b8d4b50507fffd5ce17892c6842f9134354a6 Mon Sep 17 00:00:00 2001 From: ruthenian8 Date: Tue, 24 Oct 2023 11:34:53 +0300 Subject: [PATCH] remove query statements from dashboard files; remove filter values from charts; update docker-compose healthcheck; apply formatting --- .../charts/Flow_visit_ratio_monitor_13.yaml | 2 +- .../charts/Node_visit_ratio_monitor_8.yaml | 2 +- .../datasets/dff_database/dff_node_stats.yaml | 12 +----------- .../datasets/dff_database/dff_stats.yaml | 11 +---------- dff/stats/cli.py | 8 ++++---- docker-compose.yml | 4 ++-- 6 files changed, 10 insertions(+), 29 deletions(-) diff --git a/dff/config/superset_dashboard/charts/Flow_visit_ratio_monitor_13.yaml b/dff/config/superset_dashboard/charts/Flow_visit_ratio_monitor_13.yaml index 633362e20..dfa036ee4 100644 --- a/dff/config/superset_dashboard/charts/Flow_visit_ratio_monitor_13.yaml +++ b/dff/config/superset_dashboard/charts/Flow_visit_ratio_monitor_13.yaml @@ -9,7 +9,7 @@ params: slice_id: 13 granularity_sqla: start_time time_grain_sqla: PT1M - time_range: 'DATEADD(DATETIME("now"), -1, day) : now' + time_range: No filter metrics: - aggregate: COUNT column: diff --git a/dff/config/superset_dashboard/charts/Node_visit_ratio_monitor_8.yaml b/dff/config/superset_dashboard/charts/Node_visit_ratio_monitor_8.yaml index a733c5dc1..7f5852930 100644 --- a/dff/config/superset_dashboard/charts/Node_visit_ratio_monitor_8.yaml +++ b/dff/config/superset_dashboard/charts/Node_visit_ratio_monitor_8.yaml @@ -9,7 +9,7 @@ params: slice_id: 2 granularity_sqla: start_time time_grain_sqla: PT1M - time_range: 'DATEADD(DATETIME("now"), -1, day) : now' + time_range: No filter metrics: - aggregate: COUNT column: diff --git a/dff/config/superset_dashboard/datasets/dff_database/dff_node_stats.yaml b/dff/config/superset_dashboard/datasets/dff_database/dff_node_stats.yaml index 590116df9..cc62e904c 100644 --- a/dff/config/superset_dashboard/datasets/dff_database/dff_node_stats.yaml +++ b/dff/config/superset_dashboard/datasets/dff_database/dff_node_stats.yaml @@ -5,17 +5,7 @@ default_endpoint: null offset: 0 cache_timeout: null schema: test -sql: "\nWITH main AS (\n SELECT DISTINCT otel_logs.LogAttributes['context_id']\ - \ as context_id,\n otel_logs.LogAttributes['request_id'] as request_id,\n \ - \ toDateTime(otel_traces.Timestamp) as start_time,\n otel_traces.SpanName as\ - \ data_key,\n otel_logs.Body as data,\n JSON_VALUE(otel_logs.Body, '$.label')\ - \ as label,\n JSON_VALUE(otel_logs.Body, '$.flow') as flow_label,\n JSON_VALUE(otel_logs.Body,\ - \ '$.node') as node_label,\n otel_logs.TraceId as trace_id,\n otel_traces.TraceId\n\ - FROM otel_logs, otel_traces\n WHERE otel_logs.TraceId = otel_traces.TraceId and\ - \ data_key = 'get_current_label'\n ORDER BY context_id, request_id\n) SELECT\ - \ context_id,\n request_id,\n start_time,\n data_key,\n data,\n label,\n\ - \ (request_id != '0' ? neighbor(label, -1) : '') as prev_label,\n (request_id != '0' ? neighbor(flow_label, -1) : '') as prev_flow,\n\ - \ flow_label,\n node_label\nFROM main\n" +sql: null params: null template_params: null filter_select_enabled: false diff --git a/dff/config/superset_dashboard/datasets/dff_database/dff_stats.yaml b/dff/config/superset_dashboard/datasets/dff_database/dff_stats.yaml index 142a2ccc0..f8044ae98 100644 --- a/dff/config/superset_dashboard/datasets/dff_database/dff_stats.yaml +++ b/dff/config/superset_dashboard/datasets/dff_database/dff_stats.yaml @@ -5,16 +5,7 @@ default_endpoint: null offset: 0 cache_timeout: null schema: test -sql: "WITH main AS (\n SELECT DISTINCT otel_logs.LogAttributes['context_id'] as\ - \ context_id,\n otel_logs.LogAttributes['request_id'] as request_id,\n toDateTime(otel_traces.Timestamp)\ - \ as start_time,\n otel_traces.SpanName as data_key,\n otel_logs.Body as data,\n\ - \ JSON_VALUE(otel_logs.Body, '$.label') as label,\n JSON_VALUE(otel_logs.Body,\ - \ '$.flow') as flow_label,\n JSON_VALUE(otel_logs.Body, '$.node') as node_label,\n\ - \ otel_logs.TraceId as trace_id,\n otel_traces.TraceId\nFROM otel_logs, otel_traces\n\ - \ WHERE otel_logs.TraceId = otel_traces.TraceId\n ORDER BY data_key, context_id,\ - \ request_id\n) SELECT context_id,\n request_id,\n start_time,\n data_key,\n\ - \ data,\n label,\n neighbor(label, -1) as prev_label,\n neighbor(flow_label,\ - \ -1) as prev_flow,\n flow_label,\n node_label\nFROM main" +sql: null params: null template_params: null filter_select_enabled: false diff --git a/dff/stats/cli.py b/dff/stats/cli.py index 38d1f69a5..1d3245cd1 100644 --- a/dff/stats/cli.py +++ b/dff/stats/cli.py @@ -199,11 +199,11 @@ def make_zip_config(parsed_args: argparse.Namespace) -> Path: params = dict( table="${db.table}", label_lag="lagInFrame(label) OVER " - "(PARTITION BY context_id ORDER BY request_id ASC " - "ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)", + "(PARTITION BY context_id ORDER BY request_id ASC " + "ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)", flow_lag="lagInFrame(flow_label) OVER " - "(PARTITION BY context_id ORDER BY request_id ASC " - "ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)", + "(PARTITION BY context_id ORDER BY request_id ASC " + "ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)", texttype="String", lblfield="JSON_VALUE(${db.table}.Body, '$.label')", flowfield="JSON_VALUE(${db.table}.Body, '$.flow')", diff --git a/docker-compose.yml b/docker-compose.yml index 20aca6f23..adf18f024 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -84,8 +84,8 @@ services: - ch-data:/var/lib/clickhouse/ healthcheck: test: wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1 - interval: 2s - timeout: 2s + interval: 5s + timeout: 4s retries: 5 otelcol: image: otel/opentelemetry-collector-contrib:latest