github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/pkg/orchestrator/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 orchestrator 15 16 import "github.com/prometheus/client_golang/prometheus" 17 18 var ( 19 etcdTxnSize = prometheus.NewHistogram( 20 prometheus.HistogramOpts{ 21 Namespace: "ticdc", 22 Subsystem: "etcd_worker", 23 Name: "etcd_txn_size_bytes", 24 Help: "Bucketed histogram of a etcd txn size.", 25 Buckets: prometheus.ExponentialBuckets(1, 2, 18), 26 }) 27 28 etcdTxnExecDuration = prometheus.NewHistogram( 29 prometheus.HistogramOpts{ 30 Namespace: "ticdc", 31 Subsystem: "etcd_worker", 32 Name: "etcd_txn_exec_duration", 33 Help: "Bucketed histogram of processing time (s) of a etcd txn.", 34 Buckets: prometheus.ExponentialBuckets(0.002 /* 2 ms */, 2, 18), 35 }) 36 37 etcdWorkerTickDuration = prometheus.NewHistogram( 38 prometheus.HistogramOpts{ 39 Namespace: "ticdc", 40 Subsystem: "etcd_worker", 41 Name: "tick_reactor_duration", 42 Help: "Bucketed histogram of etcdWorker tick reactor time (s).", 43 Buckets: prometheus.ExponentialBuckets(0.01 /* 10 ms */, 2, 18), 44 }) 45 ) 46 47 // InitMetrics registers all metrics in this file 48 func InitMetrics(registry *prometheus.Registry) { 49 registry.MustRegister(etcdTxnSize) 50 registry.MustRegister(etcdTxnExecDuration) 51 registry.MustRegister(etcdWorkerTickDuration) 52 }