github.com/matrixorigin/matrixone@v1.2.0/pkg/util/metric/v2/logtail.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 LogtailLoadCheckpointCounter = prometheus.NewCounter( 23 prometheus.CounterOpts{ 24 Namespace: "mo", 25 Subsystem: "logtail", 26 Name: "load_checkpoint_total", 27 Help: "Total number of load checkpoint handled.", 28 }) 29 30 logtailReceivedCounter = prometheus.NewCounterVec( 31 prometheus.CounterOpts{ 32 Namespace: "mo", 33 Subsystem: "logtail", 34 Name: "received_total", 35 Help: "Total number of received logtail.", 36 }, []string{"type"}) 37 LogtailTotalReceivedCounter = logtailReceivedCounter.WithLabelValues("total") 38 LogtailSubscribeReceivedCounter = logtailReceivedCounter.WithLabelValues("subscribe") 39 LogtailUnsubscribeReceivedCounter = logtailReceivedCounter.WithLabelValues("unsubscribe") 40 LogtailUpdateReceivedCounter = logtailReceivedCounter.WithLabelValues("update") 41 LogtailHeartbeatReceivedCounter = logtailReceivedCounter.WithLabelValues("heartbeat") 42 ) 43 44 var ( 45 logTailQueueSizeGauge = prometheus.NewGaugeVec( 46 prometheus.GaugeOpts{ 47 Namespace: "mo", 48 Subsystem: "logtail", 49 Name: "queue_size", 50 Help: "Size of logtail queue size.", 51 }, []string{"type"}) 52 LogTailSendQueueSizeGauge = logTailQueueSizeGauge.WithLabelValues("send") 53 LogTailReceiveQueueSizeGauge = logTailQueueSizeGauge.WithLabelValues("receive") 54 LogTailApplyQueueSizeGauge = logTailQueueSizeGauge.WithLabelValues("apply") 55 ) 56 57 var ( 58 LogTailBytesHistogram = prometheus.NewHistogram( 59 prometheus.HistogramOpts{ 60 Namespace: "mo", 61 Subsystem: "logtail", 62 Name: "bytes", 63 Help: "Bucketed histogram of logtail log bytes.", 64 Buckets: prometheus.ExponentialBuckets(1, 2.0, 10), 65 }) 66 67 logTailApplyDurationHistogram = prometheus.NewHistogramVec( 68 prometheus.HistogramOpts{ 69 Namespace: "mo", 70 Subsystem: "logtail", 71 Name: "apply_duration_seconds", 72 Help: "Bucketed histogram of apply log tail into mem-table duration.", 73 Buckets: getDurationBuckets(), 74 }, []string{"step"}) 75 LogTailApplyDurationHistogram = logTailApplyDurationHistogram.WithLabelValues("apply") 76 LogTailApplyLatencyDurationHistogram = logTailApplyDurationHistogram.WithLabelValues("apply-latency") 77 LogTailApplyNotifyDurationHistogram = logTailApplyDurationHistogram.WithLabelValues("apply-notify") 78 LogTailApplyNotifyLatencyDurationHistogram = logTailApplyDurationHistogram.WithLabelValues("apply-notify-latency") 79 80 logtailUpdatePartitionDurationHistogram = prometheus.NewHistogramVec( 81 prometheus.HistogramOpts{ 82 Namespace: "mo", 83 Subsystem: "logtail", 84 Name: "update_partition_duration_seconds", 85 Help: "Bucketed histogram of partiton update duration.", 86 Buckets: getDurationBuckets(), 87 }, []string{"step"}) 88 LogtailUpdatePartitonEnqueueGlobalStatsDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("enqueue-global-stats") 89 LogtailUpdatePartitonGetPartitionDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("get-partition") 90 LogtailUpdatePartitonGetLockDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("get-lock") 91 LogtailUpdatePartitonGetCatalogDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("get-catalog") 92 LogtailUpdatePartitonHandleCheckpointDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("handle-checkpoint") 93 LogtailUpdatePartitonConsumeLogtailDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("consume") 94 LogtailUpdatePartitonConsumeLogtailCatalogTableDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("consume-catalog-table") 95 LogtailUpdatePartitonConsumeLogtailCommandsDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("consume-commands") 96 LogtailUpdatePartitonConsumeLogtailOneEntryDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("consume-one-entry") 97 LogtailUpdatePartitonConsumeLogtailOneEntryLogtailReplayDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("consume-one-entry-logtailreplay") 98 LogtailUpdatePartitonConsumeLogtailOneEntryUpdateCatalogCacheDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("consume-one-entry-catalog-cache") 99 LogtailUpdatePartitonUpdateTimestampsDurationHistogram = logtailUpdatePartitionDurationHistogram.WithLabelValues("update-timestamps") 100 101 LogTailAppendDurationHistogram = prometheus.NewHistogram( 102 prometheus.HistogramOpts{ 103 Namespace: "mo", 104 Subsystem: "logtail", 105 Name: "append_duration_seconds", 106 Help: "Bucketed histogram of append log tail into logservice duration.", 107 Buckets: getDurationBuckets(), 108 }) 109 110 logTailSendDurationHistogram = prometheus.NewHistogramVec( 111 prometheus.HistogramOpts{ 112 Namespace: "mo", 113 Subsystem: "logtail", 114 Name: "send_duration_seconds", 115 Help: "Bucketed histogram of send logtail log duration.", 116 Buckets: prometheus.ExponentialBuckets(0.00001, 2.0, 10), 117 }, []string{"step"}) 118 LogtailSendTotalHistogram = logTailSendDurationHistogram.WithLabelValues("total") 119 LogtailSendLatencyHistogram = logTailSendDurationHistogram.WithLabelValues("latency") 120 LogtailSendNetworkHistogram = logTailSendDurationHistogram.WithLabelValues("network") 121 122 LogTailLoadCheckpointDurationHistogram = prometheus.NewHistogram( 123 prometheus.HistogramOpts{ 124 Namespace: "mo", 125 Subsystem: "logtail", 126 Name: "load_checkpoint_duration_seconds", 127 Help: "Bucketed histogram of load check point duration.", 128 Buckets: getDurationBuckets(), 129 }) 130 131 LogTailCollectDurationHistogram = prometheus.NewHistogram( 132 prometheus.HistogramOpts{ 133 Namespace: "mo", 134 Subsystem: "logtail", 135 Name: "collect_duration_seconds", 136 Help: "Bucketed histogram of logtail collecting duration.", 137 Buckets: getDurationBuckets(), 138 }) 139 ) 140 141 var ( 142 LogTailSubscriptionCounter = prometheus.NewCounter( 143 prometheus.CounterOpts{ 144 Namespace: "mo", 145 Subsystem: "logtail", 146 Name: "subscription_request_total", 147 Help: "Total numbers of logtail subscription the tn have received.", 148 }) 149 )