github.com/pingcap/ticdc@v0.0.0-20220526033649-485a10ef2652/cdc/puller/sorter/metrics.go (about) 1 // Copyright 2020 PingCAP, Inc. 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 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 package sorter 15 16 import ( 17 "github.com/prometheus/client_golang/prometheus" 18 ) 19 20 var ( 21 sorterConsumeCount = prometheus.NewCounterVec(prometheus.CounterOpts{ 22 Namespace: "ticdc", 23 Subsystem: "sorter", 24 Name: "consume_count", 25 Help: "the number of events consumed by the sorter", 26 }, []string{"capture", "changefeed", "type"}) 27 28 sorterEventCount = prometheus.NewCounterVec(prometheus.CounterOpts{ 29 Namespace: "ticdc", 30 Subsystem: "sorter", 31 Name: "event_count", 32 Help: "the number of events output by the sorter", 33 }, []string{"capture", "changefeed", "type"}) 34 35 sorterResolvedTsGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ 36 Namespace: "ticdc", 37 Subsystem: "sorter", 38 Name: "resolved_ts_gauge", 39 Help: "the resolved ts of the sorter", 40 }, []string{"capture", "changefeed"}) 41 42 sorterMergerStartTsGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ 43 Namespace: "ticdc", 44 Subsystem: "sorter", 45 Name: "merger_start_ts_gauge", 46 Help: "the start TS of each merge in the sorter", 47 }, []string{"capture", "changefeed"}) 48 49 sorterInMemoryDataSizeGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ 50 Namespace: "ticdc", 51 Subsystem: "sorter", 52 Name: "in_memory_data_size_gauge", 53 Help: "the amount of pending data stored in-memory by the sorter", 54 }, []string{"capture"}) 55 56 sorterOnDiskDataSizeGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ 57 Namespace: "ticdc", 58 Subsystem: "sorter", 59 Name: "on_disk_data_size_gauge", 60 Help: "the amount of pending data stored on-disk by the sorter", 61 }, []string{"capture"}) 62 63 sorterOpenFileCountGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ 64 Namespace: "ticdc", 65 Subsystem: "sorter", 66 Name: "open_file_count_gauge", 67 Help: "the number of open file descriptors held by the sorter", 68 }, []string{"capture"}) 69 70 sorterFlushCountHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ 71 Namespace: "ticdc", 72 Subsystem: "sorter", 73 Name: "flush_count_histogram", 74 Help: "Bucketed histogram of the number of events in individual flushes performed by the sorter", 75 Buckets: prometheus.ExponentialBuckets(4, 4, 10), 76 }, []string{"capture", "changefeed"}) 77 78 sorterMergeCountHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{ 79 Namespace: "ticdc", 80 Subsystem: "sorter", 81 Name: "merge_count_histogram", 82 Help: "Bucketed histogram of the number of events in individual merges performed by the sorter", 83 Buckets: prometheus.ExponentialBuckets(16, 4, 10), 84 }, []string{"capture", "changefeed"}) 85 ) 86 87 // InitMetrics registers all metrics in this file 88 func InitMetrics(registry *prometheus.Registry) { 89 registry.MustRegister(sorterConsumeCount) 90 registry.MustRegister(sorterEventCount) 91 registry.MustRegister(sorterResolvedTsGauge) 92 registry.MustRegister(sorterMergerStartTsGauge) 93 registry.MustRegister(sorterInMemoryDataSizeGauge) 94 registry.MustRegister(sorterOnDiskDataSizeGauge) 95 registry.MustRegister(sorterOpenFileCountGauge) 96 registry.MustRegister(sorterFlushCountHistogram) 97 registry.MustRegister(sorterMergeCountHistogram) 98 }