github.com/matrixorigin/matrixone@v1.2.0/pkg/util/metric/v2/fileservice.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  	S3ConnectCounter = prometheus.NewCounter(
    23  		prometheus.CounterOpts{
    24  			Namespace: "mo",
    25  			Subsystem: "fs",
    26  			Name:      "s3_connect_total",
    27  			Help:      "Total number of s3 connect count.",
    28  		})
    29  
    30  	S3DNSResolveCounter = prometheus.NewCounter(
    31  		prometheus.CounterOpts{
    32  			Namespace: "mo",
    33  			Subsystem: "fs",
    34  			Name:      "s3_dns_resolve_total",
    35  			Help:      "Total number of s3 dns resolve count.",
    36  		})
    37  
    38  	fsReadCounter = prometheus.NewCounterVec(
    39  		prometheus.CounterOpts{
    40  			Namespace: "mo",
    41  			Subsystem: "fs",
    42  			Name:      "read_total",
    43  			Help:      "Total number of read count.",
    44  		}, []string{"type"})
    45  	FSReadS3Counter        = fsReadCounter.WithLabelValues("s3")
    46  	FSReadHitMemCounter    = fsReadCounter.WithLabelValues("hit-mem")
    47  	FSReadHitDiskCounter   = fsReadCounter.WithLabelValues("hit-disk")
    48  	FSReadHitRemoteCounter = fsReadCounter.WithLabelValues("hit-remote")
    49  
    50  	fsWriteCounter = prometheus.NewCounterVec(
    51  		prometheus.CounterOpts{
    52  			Namespace: "mo",
    53  			Subsystem: "fs",
    54  			Name:      "write_total",
    55  			Help:      "Total number of write count.",
    56  		}, []string{"type"})
    57  	FSWriteS3Counter    = fsWriteCounter.WithLabelValues("s3")
    58  	FSWriteLocalCounter = fsWriteCounter.WithLabelValues("local")
    59  )
    60  
    61  var (
    62  	s3IOBytesHistogram = prometheus.NewHistogramVec(
    63  		prometheus.HistogramOpts{
    64  			Namespace: "mo",
    65  			Subsystem: "fs",
    66  			Name:      "s3_io_bytes",
    67  			Help:      "Bucketed histogram of s3 io bytes.",
    68  			Buckets:   prometheus.ExponentialBuckets(1, 2.0, 10),
    69  		}, []string{"type"})
    70  	S3WriteIOBytesHistogram = s3IOBytesHistogram.WithLabelValues("write")
    71  	S3ReadIOBytesHistogram  = s3IOBytesHistogram.WithLabelValues("read")
    72  
    73  	s3IODurationHistogram = prometheus.NewHistogramVec(
    74  		prometheus.HistogramOpts{
    75  			Namespace: "mo",
    76  			Subsystem: "fs",
    77  			Name:      "s3_io_duration_seconds",
    78  			Help:      "Bucketed histogram of s3 io duration.",
    79  			Buckets:   getDurationBuckets(),
    80  		}, []string{"type"})
    81  	S3WriteIODurationHistogram = s3IODurationHistogram.WithLabelValues("write")
    82  	S3ReadIODurationHistogram  = s3IODurationHistogram.WithLabelValues("read")
    83  	S3ListIODurationHistogram  = s3IODurationHistogram.WithLabelValues("list")
    84  	S3StatIODurationHistogram  = s3IODurationHistogram.WithLabelValues("stat")
    85  
    86  	s3ConnDurationHistogram = prometheus.NewHistogramVec(
    87  		prometheus.HistogramOpts{
    88  			Namespace: "mo",
    89  			Subsystem: "fs",
    90  			Name:      "s3_conn_duration_seconds",
    91  			Help:      "Bucketed histogram of s3 get conn duration.",
    92  			Buckets:   getDurationBuckets(),
    93  		}, []string{"type"})
    94  	S3GetConnDurationHistogram      = s3ConnDurationHistogram.WithLabelValues("get-conn")
    95  	S3DNSResolveDurationHistogram   = s3ConnDurationHistogram.WithLabelValues("dns-resolve")
    96  	S3ConnectDurationHistogram      = s3ConnDurationHistogram.WithLabelValues("connect")
    97  	S3TLSHandshakeDurationHistogram = s3ConnDurationHistogram.WithLabelValues("tls-handshake")
    98  
    99  	localIOBytesHistogram = prometheus.NewHistogramVec(
   100  		prometheus.HistogramOpts{
   101  			Namespace: "mo",
   102  			Subsystem: "fs",
   103  			Name:      "local_io_bytes",
   104  			Help:      "Bucketed histogram of local io bytes.",
   105  			Buckets:   prometheus.ExponentialBuckets(1, 2.0, 10),
   106  		}, []string{"type"})
   107  	LocalWriteIOBytesHistogram = localIOBytesHistogram.WithLabelValues("write")
   108  	LocalReadIOBytesHistogram  = localIOBytesHistogram.WithLabelValues("read")
   109  
   110  	localIODurationHistogram = prometheus.NewHistogramVec(
   111  		prometheus.HistogramOpts{
   112  			Namespace: "mo",
   113  			Subsystem: "fs",
   114  			Name:      "local_io_duration_seconds",
   115  			Help:      "Bucketed histogram of local io duration.",
   116  			Buckets:   getDurationBuckets(),
   117  		}, []string{"type"})
   118  	LocalWriteIODurationHistogram = localIODurationHistogram.WithLabelValues("write")
   119  	LocalReadIODurationHistogram  = localIODurationHistogram.WithLabelValues("read")
   120  )
   121  
   122  var (
   123  	ioMergerCounter = prometheus.NewCounterVec(
   124  		prometheus.CounterOpts{
   125  			Namespace: "mo",
   126  			Subsystem: "fs",
   127  			Name:      "io_merger_counter",
   128  			Help:      "io merger counter",
   129  		},
   130  		[]string{"type"},
   131  	)
   132  	IOMergerCounterInitiate = ioMergerCounter.WithLabelValues("initiate")
   133  	IOMergerCounterWait     = ioMergerCounter.WithLabelValues("wait")
   134  
   135  	ioMergerDuration = prometheus.NewHistogramVec(
   136  		prometheus.HistogramOpts{
   137  			Namespace: "mo",
   138  			Subsystem: "fs",
   139  			Name:      "io_merger_duration_seconds",
   140  			Help:      "io merger duration seconds",
   141  			Buckets:   getDurationBuckets(),
   142  		}, []string{"type"})
   143  	IOMergerDurationInitiate = ioMergerDuration.WithLabelValues("initiate")
   144  	IOMergerDurationWait     = ioMergerDuration.WithLabelValues("wait")
   145  )