github.com/matrixorigin/matrixone@v1.2.0/pkg/util/metric/v2/proxy.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 "github.com/prometheus/client_golang/prometheus" 18 19 var ( 20 proxyConnectCounter = prometheus.NewCounterVec( 21 prometheus.CounterOpts{ 22 Namespace: "mo", 23 Subsystem: "proxy", 24 Name: "connect_counter", 25 Help: "Count of proxy connect to backend", 26 }, []string{"type"}) 27 ProxyConnectAcceptedCounter = proxyConnectCounter.WithLabelValues("accepted") 28 ProxyConnectCurrentCounter = proxyConnectCounter.WithLabelValues("current") 29 ProxyConnectSuccessCounter = proxyConnectCounter.WithLabelValues("success") 30 ProxyConnectRouteFailCounter = proxyConnectCounter.WithLabelValues("route-fail") 31 ProxyConnectCommonFailCounter = proxyConnectCounter.WithLabelValues("common-fail") 32 ProxyConnectRetryCounter = proxyConnectCounter.WithLabelValues("retry") 33 ProxyConnectSelectCounter = proxyConnectCounter.WithLabelValues("select") 34 ProxyConnectRejectCounter = proxyConnectCounter.WithLabelValues("reject") 35 36 proxyDisconnectCounter = prometheus.NewCounterVec( 37 prometheus.CounterOpts{ 38 Namespace: "mo", 39 Subsystem: "proxy", 40 Name: "disconnect_counter", 41 Help: "Count of proxy disconnect with server or client", 42 }, []string{"type"}) 43 ProxyServerDisconnectCounter = proxyDisconnectCounter.WithLabelValues("server") 44 ProxyClientDisconnectCounter = proxyDisconnectCounter.WithLabelValues("client") 45 46 proxyTransferCounter = prometheus.NewCounterVec( 47 prometheus.CounterOpts{ 48 Namespace: "mo", 49 Subsystem: "proxy", 50 Name: "connection_transfer_counter", 51 Help: "Count of proxy transfer connections", 52 }, []string{"type"}) 53 ProxyTransferSuccessCounter = proxyTransferCounter.WithLabelValues("success") 54 ProxyTransferFailCounter = proxyTransferCounter.WithLabelValues("fail") 55 ProxyTransferAbortCounter = proxyTransferCounter.WithLabelValues("abort") 56 57 ProxyTransferDurationHistogram = prometheus.NewHistogram( 58 prometheus.HistogramOpts{ 59 Namespace: "mo", 60 Subsystem: "proxy", 61 Name: "connection_transfer_duration", 62 Help: "Histogram of proxy transfer connections duration", 63 Buckets: prometheus.ExponentialBuckets(0.00001, 2.0, 20), 64 }) 65 66 ProxyDrainCounter = prometheus.NewCounter( 67 prometheus.CounterOpts{ 68 Namespace: "mo", 69 Subsystem: "proxy", 70 Name: "drain_counter", 71 Help: "Count of proxy drain CN servers", 72 }) 73 74 ProxyAvailableBackendServerNumGauge = prometheus.NewGaugeVec( 75 prometheus.GaugeOpts{ 76 Namespace: "mo", 77 Subsystem: "proxy", 78 Name: "available_backend_server_num", 79 Help: "Count of available backend servers", 80 }, []string{"account"}) 81 82 ProxyTransferQueueSizeGauge = prometheus.NewGauge( 83 prometheus.GaugeOpts{ 84 Namespace: "mo", 85 Subsystem: "proxy", 86 Name: "transfer_queue_size", 87 Help: "Size of proxy transfer queue", 88 }) 89 90 ProxyConnectionsNeedToTransferGauge = prometheus.NewGauge( 91 prometheus.GaugeOpts{ 92 Namespace: "mo", 93 Subsystem: "proxy", 94 Name: "connections_need_to_transfer", 95 Help: "Proxy connections need to transfer", 96 }) 97 98 ProxyConnectionsTransferIntentGauge = prometheus.NewGauge( 99 prometheus.GaugeOpts{ 100 Namespace: "mo", 101 Subsystem: "proxy", 102 Name: "connections_transfer_intent", 103 Help: "Proxy connections in transfer intent state", 104 }) 105 )