github.com/matrixorigin/matrixone@v1.2.0/pkg/util/metric/v2/hakeeper.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 HeartbeatHistogram = prometheus.NewHistogramVec( 23 prometheus.HistogramOpts{ 24 Namespace: "hakeeper", 25 Subsystem: "heartbeat_send", 26 Name: "duration_seconds", 27 Help: "hakeeper heartbeat send durations", 28 Buckets: getDurationBuckets(), 29 }, []string{"type"}) 30 31 HeartbeatFailureCounter = prometheus.NewCounterVec( 32 prometheus.CounterOpts{ 33 Namespace: "hakeeper", 34 Subsystem: "heartbeat_send", 35 Name: "failed_total", 36 Help: "hakeeper heartbeat failed count", 37 }, []string{"type"}) 38 39 HeartbeatRecvHistogram = prometheus.NewHistogramVec( 40 prometheus.HistogramOpts{ 41 Namespace: "hakeeper", 42 Subsystem: "heartbeat_recv", 43 Name: "duration_seconds", 44 Help: "hakeeper heartbeat recv durations", 45 Buckets: getDurationBuckets(), 46 }, []string{"type"}) 47 48 HeartbeatRecvFailureCounter = prometheus.NewCounterVec( 49 prometheus.CounterOpts{ 50 Namespace: "hakeeper", 51 Subsystem: "heartbeat_recv", 52 Name: "failed_total", 53 Help: "hakeeper heartbeat recv failed count", 54 }, []string{"type"}) 55 56 CNHeartbeatHistogram = HeartbeatHistogram.WithLabelValues("cn") 57 CNHeartbeatFailureCounter = HeartbeatFailureCounter.WithLabelValues("cn") 58 CNHeartbeatRecvHistogram = HeartbeatRecvHistogram.WithLabelValues("cn") 59 CNHeartbeatRecvFailureCounter = HeartbeatRecvFailureCounter.WithLabelValues("cn") 60 61 TNHeartbeatHistogram = HeartbeatHistogram.WithLabelValues("tn") 62 TNHeartbeatFailureCounter = HeartbeatFailureCounter.WithLabelValues("tn") 63 TNHeartbeatRecvHistogram = HeartbeatRecvHistogram.WithLabelValues("tn") 64 TNHeartbeatRecvFailureCounter = HeartbeatRecvFailureCounter.WithLabelValues("tn") 65 66 LogHeartbeatHistogram = HeartbeatHistogram.WithLabelValues("log") 67 LogHeartbeatFailureCounter = HeartbeatFailureCounter.WithLabelValues("log") 68 LogHeartbeatRecvHistogram = HeartbeatRecvHistogram.WithLabelValues("log") 69 LogHeartbeatRecvFailureCounter = HeartbeatRecvFailureCounter.WithLabelValues("log") 70 )