Skip to content

Commit

Permalink
Merge pull request #503 from openedx/jill/clickhouse-metrics
Browse files Browse the repository at this point in the history
Adds ClickHouse system metrics to the Operator Dashboard's Clickhouse tab
  • Loading branch information
bmtcril authored Nov 1, 2023
2 parents 954678f + 5af67af commit 23389bf
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ GRANT {{ ON_CLUSTER }} INSERT, SELECT ON {{ ASPECTS_EVENT_SINK_DATABASE }}.* TO
GRANT {{ ON_CLUSTER }} SELECT, dictGet ON {{ ASPECTS_EVENT_SINK_DATABASE }}.* TO '{{ ASPECTS_CLICKHOUSE_REPORT_USER }}';
GRANT {{ ON_CLUSTER }} INSERT, SELECT ON {{ ASPECTS_VECTOR_DATABASE }}.* TO '{{ ASPECTS_CLICKHOUSE_VECTOR_USER }}';
GRANT {{ ON_CLUSTER }} SELECT ON {{ ASPECTS_VECTOR_DATABASE }}.* TO '{{ ASPECTS_CLICKHOUSE_REPORT_USER }}';
GRANT {{ ON_CLUSTER }} SELECT ON system.asynchronous_metrics TO '{{ ASPECTS_CLICKHOUSE_REPORT_USER }}';
GRANT {{ ON_CLUSTER }} SELECT ON system.disks TO '{{ ASPECTS_CLICKHOUSE_REPORT_USER }}';
GRANT {{ ON_CLUSTER }} SELECT ON system.events TO '{{ ASPECTS_CLICKHOUSE_REPORT_USER }}';
GRANT {{ ON_CLUSTER }} SELECT ON system.metrics TO '{{ ASPECTS_CLICKHOUSE_REPORT_USER }}';
GRANT {{ ON_CLUSTER }} SELECT ON system.replication_queue TO '{{ ASPECTS_CLICKHOUSE_REPORT_USER }}';
{{ patch("clickhouse-extra-sql") }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
_file_name: clickhouse_metrics.yaml
slice_name: ClickHouse metrics
description: null
certified_by: null
certification_details: null
viz_type: table
params:
datasource: 30__table
viz_type: table
query_mode: raw
groupby: []
time_grain_sqla: P1D
temporal_columns_lookup: {}
all_columns:
- name
- value
- description
percent_metrics: []
adhoc_filters: []
order_by_cols: []
row_limit: 1000
server_page_length: 10
order_desc: true
table_timestamp_format: smart_date
show_cell_bars: true
color_pn: true
extra_form_data: {}
dashboards: []
query_context: null
cache_timeout: null
uuid: 2f84cbc3-4068-4d4d-bd40-ae348e4be95d
version: 1.0.0
dataset_uuid: 9eee1df8-ad25-4d0f-8e53-90c277cf28e4
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ position:
- GRID_ID
- TABS-7nA6MwltSD
- TAB-gvqU89mvT
- ROW-cpoIgMfQUZ
- COLUMN-cpoIgMfQUZ
type: CHART
CHART-QN5x3ibIzS:
children: []
Expand Down Expand Up @@ -475,6 +475,36 @@ position:
- TAB-EygpebMa1
- ROW-06Qh5Kxfn
type: CHART
CHART-4xInxcau02:
children: []
id: CHART-4xInxcau02
meta:
chartId: 647
height: 50
sliceName: ClickHouse Metrics
uuid: 2f84cbc3-4068-4d4d-bd40-ae348e4be95d
width: 12
parents:
- ROOT_ID
- GRID_ID
- TABS-7nA6MwltSD
- TAB-gvqU89mvT
- COLUMN-cpoIgMfQUZ
type: CHART
COLUMN-cpoIgMfQUZ:
children:
- CHART-La3O2IbbVV
- CHART-4xInxcau02
id: COLUMN-cpoIgMfQUZ
meta:
background: BACKGROUND_TRANSPARENT
width: 12
parents:
- ROOT_ID
- GRID_ID
- TABS-7nA6MwltSD
- TAB-gvqU89mvT
type: COLUMN
COLUMN-GDahqg06nQ:
children:
- MARKDOWN-EZXXAbo-Tg
Expand All @@ -489,6 +519,22 @@ position:
- TAB-DE73B5pXm
- ROW-mPSz65tZ7E
type: COLUMN
COLUMN-cZHAXyMjrZ:
children:
- CHART-YIks0931LR
- DIVIDER-Cjn1gzHg1Z
- CHART-z56xnjjWTf
id: COLUMN-cZHAXyMjrZ
meta:
background: BACKGROUND_TRANSPARENT
width: 12
parents:
- ROOT_ID
- GRID_ID
- TABS-7nA6MwltSD
- TAB-gvqU89mvT
- ROW-npo-Vvh-xu
type: COLUMN
COLUMN-eGzPLamIzw:
children:
- CHART-explore-21-1
Expand All @@ -506,6 +552,18 @@ position:
- ROW-mPSz65tZ7E
type: COLUMN
DASHBOARD_VERSION_KEY: v2
DIVIDER-Cjn1gzHg1Z:
children: []
id: DIVIDER-Cjn1gzHg1Z
meta: {}
parents:
- ROOT_ID
- GRID_ID
- TABS-7nA6MwltSD
- TAB-gvqU89mvT
- ROW-npo-Vvh-xu
- COLUMN-cZHAXyMjrZ
type: DIVIDER
DIVIDER-erPdret3HB:
children: []
id: DIVIDER-erPdret3HB
Expand Down Expand Up @@ -622,18 +680,6 @@ position:
- TABS-7nA6MwltSD
- TAB-6Mdnw3FZh
type: ROW
ROW-cpoIgMfQUZ:
children:
- CHART-La3O2IbbVV
id: ROW-cpoIgMfQUZ
meta:
background: BACKGROUND_TRANSPARENT
parents:
- ROOT_ID
- GRID_ID
- TABS-7nA6MwltSD
- TAB-gvqU89mvT
type: ROW
ROW-mPSz65tZ7E:
children:
- COLUMN-GDahqg06nQ
Expand Down Expand Up @@ -691,7 +737,7 @@ position:
type: TAB
TAB-gvqU89mvT:
children:
- ROW-cpoIgMfQUZ
- COLUMN-cpoIgMfQUZ
id: TAB-gvqU89mvT
meta:
defaultText: Tab title
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
_file_name: clickhouse_computed_metrics.yaml
table_name: clickhouse_computed_metrics
main_dttm_col: null
description: null
default_endpoint: null
offset: 0
cache_timeout: null
schema: system
sql: |
SELECT
name,
toFloat64(value) AS value,
description
FROM system.metrics
WHERE metric IN (
'Query',
'DelayedInserts',
'DistributedFilesToInsert'
)
UNION ALL
SELECT
metric AS name,
round(toFloat64(value), 2) AS value,
description
FROM system.asynchronous_metrics
WHERE metric IN ('MaxPartCountForPartition', 'Uptime')
UNION ALL
SELECT
name,
toFloat64(value) AS value,
description
FROM system.events
WHERE event IN (
'RejectedInserts',
'ReplicatedDataLoss',
'DataAfterMergeDiffersFromReplica',
'DataAfterMutationDiffersFromReplica'
)
UNION All
SELECT
'StuckReplicationTasks' AS name,
toFloat64(count()) AS value,
'Replication tasks that were retried or postponed over 100 times.' AS description
FROM system.replication_queue
WHERE num_tries > 100 OR num_postponed > 100
UNION ALL
SELECT
CONCAT('cluster ', name) AS name,
ROUND(SUM(free_space) / SUM(total_space), 3) * 100 AS value,
'Free space per cluster node, as percent' AS description
FROM system.disks
GROUP BY name
params: null
template_params: null
filter_select_enabled: true
fetch_values_predicate: null
extra: null
normalize_columns: false
uuid: 9eee1df8-ad25-4d0f-8e53-90c277cf28e4
metrics:
- metric_name: count
verbose_name: COUNT(*)
metric_type: count
expression: COUNT(*)
description: null
d3format: null
currency: null
extra:
warning_markdown: ''
warning_text: null
columns:
- column_name: value
verbose_name: null
is_dttm: false
is_active: true
type: Float64
advanced_data_type: null
groupby: true
filterable: true
expression: null
description: null
python_date_format: null
extra: {}
- column_name: name
verbose_name: null
is_dttm: false
is_active: true
type: String
advanced_data_type: null
groupby: true
filterable: true
expression: null
description: null
python_date_format: null
extra: {}
- column_name: description
verbose_name: null
is_dttm: false
is_active: true
type: String
advanced_data_type: null
groupby: true
filterable: true
expression: null
description: null
python_date_format: null
extra: {}
version: 1.0.0
database_uuid: 21174b6c-4d40-4958-8161-d6c3cf5e77b6

0 comments on commit 23389bf

Please sign in to comment.