github.com/matrixorigin/matrixone@v1.2.0/pkg/util/metric/v2/task.go (about) 1 // Copyright 2023 Matrix Origin 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package v2 16 17 import ( 18 "github.com/prometheus/client_golang/prometheus" 19 ) 20 21 var ( 22 taskShortDurationHistogram = prometheus.NewHistogramVec( 23 prometheus.HistogramOpts{ 24 Namespace: "mo", 25 Subsystem: "task", 26 Name: "short_duration_seconds", 27 Help: "Bucketed histogram of short tn task execute duration.", 28 Buckets: getDurationBuckets(), 29 }, []string{"type"}) 30 31 TaskFlushTableTailDurationHistogram = taskShortDurationHistogram.WithLabelValues("flush_table_tail") 32 TaskCommitTableTailDurationHistogram = taskShortDurationHistogram.WithLabelValues("commit_table_tail") 33 TaskCommitMergeObjectsDurationHistogram = taskShortDurationHistogram.WithLabelValues("commit_merge_objects") 34 GetObjectStatsDurationHistogram = taskShortDurationHistogram.WithLabelValues("get_object_stats") 35 36 // storage usage / show accounts metrics 37 TaskGCkpCollectUsageDurationHistogram = taskShortDurationHistogram.WithLabelValues("gckp_collect_usage") 38 TaskICkpCollectUsageDurationHistogram = taskShortDurationHistogram.WithLabelValues("ickp_collect_usage") 39 TaskStorageUsageReqDurationHistogram = taskShortDurationHistogram.WithLabelValues("handle_usage_request") 40 TaskShowAccountsGetTableStatsDurationHistogram = taskShortDurationHistogram.WithLabelValues("show_accounts_get_table_stats") 41 TaskShowAccountsGetUsageDurationHistogram = taskShortDurationHistogram.WithLabelValues("show_accounts_get_storage_usage") 42 TaskShowAccountsTotalDurationHistogram = taskShortDurationHistogram.WithLabelValues("show_accounts_total_duration") 43 44 taskLongDurationHistogram = prometheus.NewHistogramVec( 45 prometheus.HistogramOpts{ 46 Namespace: "mo", 47 Subsystem: "task", 48 Name: "long_duration_seconds", 49 Help: "Bucketed histogram of long tn task execute duration.", 50 Buckets: prometheus.ExponentialBuckets(1, 2.0, 13), 51 }, []string{"type"}) 52 53 taskBytesHistogram = prometheus.NewHistogramVec( 54 prometheus.HistogramOpts{ 55 Namespace: "mo", 56 Subsystem: "task", 57 Name: "hist_bytes", 58 Help: "Bucketed histogram of task result bytes.", 59 Buckets: prometheus.ExponentialBuckets(1, 2.0, 30), 60 }, []string{"type"}) 61 62 taskCountHistogram = prometheus.NewHistogramVec( 63 prometheus.HistogramOpts{ 64 Namespace: "mo", 65 Subsystem: "task", 66 Name: "hist_total", 67 Help: "Bucketed histogram of task result count.", 68 Buckets: prometheus.ExponentialBuckets(1, 2.0, 30), 69 }, []string{"type"}) 70 71 TaskCkpEntryPendingDurationHistogram = taskLongDurationHistogram.WithLabelValues("ckp_entry_pending") 72 TaskLoadMemDeletesPerBlockHistogram = taskCountHistogram.WithLabelValues("load_mem_deletes_per_block") 73 TaskFlushDeletesCountHistogram = taskCountHistogram.WithLabelValues("flush_deletes_count") 74 TaskFlushDeletesSizeHistogram = taskBytesHistogram.WithLabelValues("flush_deletes_size") 75 ) 76 77 var ( 78 taskScheduledByCounter = prometheus.NewCounterVec( 79 prometheus.CounterOpts{ 80 Namespace: "mo", 81 Subsystem: "task", 82 Name: "scheduled_by_total", 83 Help: "Total number of task have been scheduled.", 84 }, []string{"type", "nodetype"}) 85 86 TaskDNMergeScheduledByCounter = taskScheduledByCounter.WithLabelValues("merge", "dn") 87 TaskCNMergeScheduledByCounter = taskScheduledByCounter.WithLabelValues("merge", "cn") 88 89 taskGeneratedStuffCounter = prometheus.NewCounterVec( 90 prometheus.CounterOpts{ 91 Namespace: "mo", 92 Subsystem: "task", 93 Name: "execute_results_total", 94 Help: "Total number of stuff a task have generated", 95 }, []string{"type", "nodetype"}) 96 97 TaskDNMergedSizeCounter = taskGeneratedStuffCounter.WithLabelValues("merged_size", "dn") 98 TaskCNMergedSizeCounter = taskGeneratedStuffCounter.WithLabelValues("merged_size", "cn") 99 100 taskSelectivityCounter = prometheus.NewCounterVec( 101 prometheus.CounterOpts{ 102 Namespace: "mo", 103 Subsystem: "task", 104 Name: "selectivity", 105 Help: "Selectivity counter for read filter, block etc.", 106 }, []string{"type"}) 107 108 TaskSelReadFilterTotal = taskSelectivityCounter.WithLabelValues("readfilter_total") 109 TaskSelReadFilterHit = taskSelectivityCounter.WithLabelValues("readfilter_hit") 110 TaskSelBlockTotal = taskSelectivityCounter.WithLabelValues("block_total") 111 TaskSelBlockHit = taskSelectivityCounter.WithLabelValues("block_hit") 112 TaskSelColumnTotal = taskSelectivityCounter.WithLabelValues("column_total") 113 TaskSelColumnHit = taskSelectivityCounter.WithLabelValues("column_hit") 114 ) 115 116 var ( 117 TaskMergeTransferPageLengthGauge = prometheus.NewGauge( 118 prometheus.GaugeOpts{ 119 Namespace: "mo", 120 Subsystem: "task", 121 Name: "merge_transfer_page_size", 122 Help: "Size of merge generated transfer page", 123 }) 124 125 TaskStorageUsageCacheMemUsedGauge = prometheus.NewGauge( 126 prometheus.GaugeOpts{ 127 Namespace: "mo", 128 Subsystem: "task", 129 Name: "storage_usage_cache_size", 130 Help: "Size of the storage usage cache used", 131 }) 132 )