github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/cdc/puller/memorysorter/metrics.go (about) 1 // Copyright 2021 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 memorysorter 15 16 import ( 17 "time" 18 19 "github.com/prometheus/client_golang/prometheus" 20 ) 21 22 const ( 23 defaultMetricInterval = time.Second * 15 24 ) 25 26 var ( 27 entrySorterResolvedChanSizeGauge = prometheus.NewGaugeVec( 28 prometheus.GaugeOpts{ 29 Namespace: "ticdc", 30 Subsystem: "puller", 31 Name: "entry_sorter_resolved_chan_size", 32 Help: "Puller entry sorter resolved channel size", 33 }, []string{"namespace", "changefeed", "table"}) 34 entrySorterOutputChanSizeGauge = prometheus.NewGaugeVec( 35 prometheus.GaugeOpts{ 36 Namespace: "ticdc", 37 Subsystem: "puller", 38 Name: "entry_sorter_output_chan_size", 39 Help: "Puller entry sorter output channel size", 40 }, []string{"namespace", "changefeed", "table"}) 41 entrySorterUnsortedSizeGauge = prometheus.NewGaugeVec( 42 prometheus.GaugeOpts{ 43 Namespace: "ticdc", 44 Subsystem: "puller", 45 Name: "entry_sorter_unsorted_size", 46 Help: "Puller entry sorter unsorted items size", 47 }, []string{"namespace", "changefeed", "table"}) 48 entrySorterSortDuration = prometheus.NewHistogramVec( 49 prometheus.HistogramOpts{ 50 Namespace: "ticdc", 51 Subsystem: "puller", 52 Name: "entry_sorter_sort", 53 Help: "Bucketed histogram of processing time (s) of sort in entry sorter.", 54 Buckets: prometheus.ExponentialBuckets(0.000001, 10, 10), 55 }, []string{"namespace", "changefeed", "table"}) 56 entrySorterMergeDuration = prometheus.NewHistogramVec( 57 prometheus.HistogramOpts{ 58 Namespace: "ticdc", 59 Subsystem: "puller", 60 Name: "entry_sorter_merge", 61 Help: "Bucketed histogram of processing time (s) of merge in entry sorter.", 62 Buckets: prometheus.ExponentialBuckets(0.000001, 10, 10), 63 }, []string{"namespace", "changefeed", "table"}) 64 ) 65 66 // InitMetrics registers all metrics in this file 67 func InitMetrics(registry *prometheus.Registry) { 68 registry.MustRegister(entrySorterResolvedChanSizeGauge) 69 registry.MustRegister(entrySorterOutputChanSizeGauge) 70 registry.MustRegister(entrySorterUnsortedSizeGauge) 71 registry.MustRegister(entrySorterSortDuration) 72 registry.MustRegister(entrySorterMergeDuration) 73 }