docs/en/administration/management/monitoring/metrics-materialized_view.md
From v3.1 onwards, StarRocks supports metrics for asynchronous materialized views.
To allow Prometheus to access the materialized view metadata in your cluster, you must add the following configurations in the Prometheus configuration file prometheus/prometheus.yml:
global:
....
scrape_configs:
- job_name: 'dev'
metrics_path: '/metrics'
# Add the following configurations.
basic_auth:
username: 'root'
password: ''
params:
'with_materialized_view_metrics' : ['all']
....
username: The username used to log into your StarRocks cluster. Unless using the root account, the user must be granted both the user_admin and db_admin roles.password: The password used to log into your StarRocks cluster.'with_materialized_view_metrics': The scope of the metrics to collect. Valid values:
'all': All metrics relevant to materialized views are collected.'minified': Gauge metrics and metrics whose values are 0 will not be collected.0(active) and 1(inactive).0 if the materialized view is not partitioned.refresh_mode (the materialized view's refresh mode) and status (ACTIVE or INACTIVE). This metric is always emitted, regardless of the per-materialized-view metrics privilege.state: HIT (the query was rewritten to use a materialized view), NO_HIT (rewrite was enabled but no materialized view was used), or DISABLED (materialized view rewrite was disabled by the session variable or the FE configuration). Counted once per query.usage_type (REWRITE if a query was rewritten to use the materialized view, or DIRECT if a query reads the materialized view directly) and refresh_mode.warehouse_name. This is the fleet-level aggregate of mv_refresh_jobs: counted once per job on its terminal task run, excluding MERGED runs. Always emitted, regardless of the per-materialized-view metrics privilege.warehouse_name.warehouse_name.warehouse_name.warehouse_name.warehouse_name.