From 7af0aef2697c54a5a3e91b7bdec6cc68d396a2f9 Mon Sep 17 00:00:00 2001 From: Wenbin1002 Date: Fri, 28 Jun 2024 18:18:42 +0800 Subject: [PATCH] update metrics #16953 --- .../v2/dashboard/grafana_dashboard_task.go | 10 ++--- pkg/util/metric/v2/metrics.go | 3 -- pkg/util/metric/v2/task.go | 40 ++++--------------- 3 files changed, 12 insertions(+), 41 deletions(-) diff --git a/pkg/util/metric/v2/dashboard/grafana_dashboard_task.go b/pkg/util/metric/v2/dashboard/grafana_dashboard_task.go index 21ab8b254bc6..4b307da085b9 100644 --- a/pkg/util/metric/v2/dashboard/grafana_dashboard_task.go +++ b/pkg/util/metric/v2/dashboard/grafana_dashboard_task.go @@ -90,35 +90,35 @@ func (c *DashboardCreator) initTaskMergeTransferPageRow() dashboard.Option { ), c.getPercentHist( "Transfer duration since born", - c.getMetricWithFilter(`mo_task_transfer_duration_since_born_bucket`, ``), + c.getMetricWithFilter(`mo_task_short_duration_seconds_bucket`, `type="transfer_page_since_born_duration"`), []float64{0.50, 0.8, 0.90, 0.99}, SpanNulls(true), timeseries.Span(3), ), c.getPercentHist( "Transfer memory latency", - c.getMetricWithFilter(`mo_task_transfer_latency_bucket`, `type="memory"`), + c.getMetricWithFilter(`mo_task_short_duration_seconds_bucket`, `type="transfer_mem_latency"`), []float64{0.50, 0.8, 0.90, 0.99}, SpanNulls(true), timeseries.Span(3), ), c.getPercentHist( "Transfer disk latency", - c.getMetricWithFilter(`mo_task_transfer_latency_bucket`, `type="disk"`), + c.getMetricWithFilter(`mo_task_short_duration_seconds_bucket`, `type="transfer_disk_latency"`), []float64{0.50, 0.8, 0.90, 0.99}, SpanNulls(true), timeseries.Span(3), ), c.getPercentHist( "Transfer page write latency in flush", - c.getMetricWithFilter(`mo_task_transfer_page_write_latency_bucket`, `type="flush"`), + c.getMetricWithFilter(`mo_task_short_duration_seconds_bucket`, `type="transfer_page_flush_latency"`), []float64{0.50, 0.8, 0.90, 0.99}, SpanNulls(true), timeseries.Span(3), ), c.getPercentHist( "Transfer page write latency in merge", - c.getMetricWithFilter(`mo_task_transfer_page_write_latency_bucket`, `type="merge"`), + c.getMetricWithFilter(`mo_task_short_duration_seconds_bucket`, `type="transfer_page_merge_latency"`), []float64{0.50, 0.8, 0.90, 0.99}, SpanNulls(true), timeseries.Span(3), diff --git a/pkg/util/metric/v2/metrics.go b/pkg/util/metric/v2/metrics.go index 88af85b018af..f6d88faefc01 100644 --- a/pkg/util/metric/v2/metrics.go +++ b/pkg/util/metric/v2/metrics.go @@ -74,11 +74,8 @@ func initTaskMetrics() { registry.MustRegister(taskSelectivityCounter) registry.MustRegister(transferPageHitHistogram) - registry.MustRegister(transferLatencyHistogram) - registry.MustRegister(transferPageWriteLatencyHistogram) registry.MustRegister(TransferPageRowHistogram) registry.MustRegister(TransferPagesInChannelHistogram) - registry.MustRegister(TransferPageSinceBornDurationHistogram) registry.MustRegister(TaskMergeTransferPageSizeGauge) registry.MustRegister(TaskStorageUsageCacheMemUsedGauge) diff --git a/pkg/util/metric/v2/task.go b/pkg/util/metric/v2/task.go index c86b9db96809..55b47c08f02c 100644 --- a/pkg/util/metric/v2/task.go +++ b/pkg/util/metric/v2/task.go @@ -41,6 +41,13 @@ var ( TaskShowAccountsGetUsageDurationHistogram = taskShortDurationHistogram.WithLabelValues("show_accounts_get_storage_usage") TaskShowAccountsTotalDurationHistogram = taskShortDurationHistogram.WithLabelValues("show_accounts_total_duration") + TransferPageFlushLatencyHistogram = taskShortDurationHistogram.WithLabelValues("transfer_page_flush_latency") + TransferPageMergeLatencyHistogram = taskShortDurationHistogram.WithLabelValues("transfer_page_merge_latency") + + TransferMemLatencyHistogram = taskShortDurationHistogram.WithLabelValues("transfer_mem_latency") + TransferDiskLatencyHistogram = taskShortDurationHistogram.WithLabelValues("transfer_disk_latency") + TransferPageSinceBornDurationHistogram = taskShortDurationHistogram.WithLabelValues("transfer_page_since_born_duration") + taskLongDurationHistogram = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: "mo", @@ -153,18 +160,6 @@ var ( }) ) -var ( - transferLatencyHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ - Namespace: "mo", - Subsystem: "task", - Name: "transfer_latency", - Help: "The total latency of transfer in seconds.", - }, []string{"type"}) - - TransferMemLatencyHistogram = transferLatencyHistogram.WithLabelValues("memory") - TransferDiskLatencyHistogram = transferLatencyHistogram.WithLabelValues("disk") -) - var ( TransferPagesInChannelHistogram = prometheus.NewHistogram(prometheus.HistogramOpts{ Namespace: "mo", @@ -173,24 +168,3 @@ var ( Help: "The number of page in channel.", }) ) - -var ( - transferPageWriteLatencyHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ - Namespace: "mo", - Subsystem: "task", - Name: "transfer_page_write_latency", - Help: "The total latency of transfer write in seconds.", - }, []string{"type"}) - - TransferPageFlushLatencyHistogram = transferPageWriteLatencyHistogram.WithLabelValues("flush") - TransferPageMergeLatencyHistogram = transferPageWriteLatencyHistogram.WithLabelValues("merge") -) - -var ( - TransferPageSinceBornDurationHistogram = prometheus.NewHistogram(prometheus.HistogramOpts{ - Namespace: "mo", - Subsystem: "task", - Name: "transfer_duration_since_born", - Help: "The duration of transfer.", - }) -)