diff --git a/apps/emqx_prometheus/src/emqx_prometheus.erl b/apps/emqx_prometheus/src/emqx_prometheus.erl index 667af1a30..82e60d4bb 100644 --- a/apps/emqx_prometheus/src/emqx_prometheus.erl +++ b/apps/emqx_prometheus/src/emqx_prometheus.erl @@ -294,7 +294,7 @@ fetch_cluster_consistented_data() -> }. aggre_or_zip_init_acc() -> - #{ + (maybe_add_ds_meta())#{ stats_data => maps:from_keys(metrics_name(stats_metric_meta()), []), vm_data => maps:from_keys(metrics_name(vm_metric_meta()), []), cluster_data => maps:from_keys(metrics_name(cluster_metric_meta()), []), @@ -656,6 +656,20 @@ emqx_metric_data(MetricNameTypeKeyL, Mode) -> MetricNameTypeKeyL ). +%%========== +%% Durable Storage +maybe_add_ds_meta() -> + case emqx_persistent_message:is_persistence_enabled() of + true -> + #{ + ds_data => maps:from_keys( + metrics_name(emqx_ds_builtin_metrics:prometheus_meta()), [] + ) + }; + false -> + #{} + end. + %%========== %% Bytes && Packets emqx_packet_metric_meta() ->