Skip to content

Commit

Permalink
feat: adds Clickhouse metrics to Operator / Clickhouse tab
Browse files Browse the repository at this point in the history
  • Loading branch information
pomegranited committed Nov 1, 2023
1 parent 954678f commit c8f99da
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 0 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 @@ -475,6 +475,20 @@ 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
- ROW-tH6acQet-Z
type: CHART
COLUMN-GDahqg06nQ:
children:
- MARKDOWN-EZXXAbo-Tg
Expand Down Expand Up @@ -517,6 +531,7 @@ position:
GRID_ID:
children:
- TABS-7nA6MwltSD
- ROW-tH6acQet-Z
- DIVIDER-erPdret3HB
id: GRID_ID
parents:
Expand Down Expand Up @@ -649,6 +664,16 @@ position:
- TABS-7nA6MwltSD
- TAB-DE73B5pXm
type: ROW
ROW-tH6acQet-Z:
children:
- CHART-4xInxcau02
id: ROW-tH6acQet-Z
meta:
background: BACKGROUND_TRANSPARENT
parents:
- ROOT_ID
- GRID_ID
type: ROW
TAB-6Mdnw3FZh:
children:
- ROW-Z0QlRyckta
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 c8f99da

Please sign in to comment.