github.com/matrixorigin/matrixone@v1.2.0/pkg/util/metric/v2/frontend.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  	acceptConnDurationHistogram = prometheus.NewHistogramVec(
    21  		prometheus.HistogramOpts{
    22  			Namespace: "mo",
    23  			Subsystem: "frontend",
    24  			Name:      "accept_connection_duration",
    25  			Help:      "Bucketed histogram of accept connection duration.",
    26  			Buckets:   getDurationBuckets(),
    27  		}, []string{"label"})
    28  	CreatedDurationHistogram          = acceptConnDurationHistogram.WithLabelValues("created")
    29  	EstablishDurationHistogram        = acceptConnDurationHistogram.WithLabelValues("establish")
    30  	UpgradeTLSDurationHistogram       = acceptConnDurationHistogram.WithLabelValues("upgradeTLS")
    31  	AuthenticateDurationHistogram     = acceptConnDurationHistogram.WithLabelValues("authenticate")
    32  	SendErrPacketDurationHistogram    = acceptConnDurationHistogram.WithLabelValues("send-err-packet")
    33  	SendOKPacketDurationHistogram     = acceptConnDurationHistogram.WithLabelValues("send-ok-packet")
    34  	CheckTenantDurationHistogram      = acceptConnDurationHistogram.WithLabelValues("check-tenant")
    35  	CheckUserDurationHistogram        = acceptConnDurationHistogram.WithLabelValues("check-user")
    36  	CheckRoleDurationHistogram        = acceptConnDurationHistogram.WithLabelValues("check-role")
    37  	CheckDbNameDurationHistogram      = acceptConnDurationHistogram.WithLabelValues("check-dbname")
    38  	InitGlobalSysVarDurationHistogram = acceptConnDurationHistogram.WithLabelValues("init-global-sys-var")
    39  
    40  	routineCounter = prometheus.NewCounterVec(
    41  		prometheus.CounterOpts{
    42  			Namespace: "mo",
    43  			Subsystem: "frontend",
    44  			Name:      "routine_count",
    45  			Help:      "routine counter.",
    46  		}, []string{"label"})
    47  	CreatedRoutineCounter = routineCounter.WithLabelValues("created")
    48  	CloseRoutineCounter   = routineCounter.WithLabelValues("close")
    49  
    50  	requestCounter = prometheus.NewCounterVec(
    51  		prometheus.CounterOpts{
    52  			Namespace: "mo",
    53  			Subsystem: "frontend",
    54  			Name:      "request_count",
    55  			Help:      "request counter.",
    56  		}, []string{"label"})
    57  	StartHandleRequestCounter = requestCounter.WithLabelValues("start-handle")
    58  	EndHandleRequestCounter   = requestCounter.WithLabelValues("end-handle")
    59  )