dubbo.apache.org/dubbo-go/v3@v3.1.1/metrics/metadata/metric_set.go (about)

     1  /*
     2   * Licensed to the Apache Software Foundation (ASF) under one or more
     3   * contributor license agreements.  See the NOTICE file distributed with
     4   * this work for additional information regarding copyright ownership.
     5   * The ASF licenses this file to You under the Apache License, Version 2.0
     6   * (the "License"); you may not use this file except in compliance with
     7   * the License.  You may obtain a copy of the License at
     8   *
     9   *     http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17  
    18  package metadata
    19  
    20  import (
    21  	"dubbo.apache.org/dubbo-go/v3/metrics"
    22  )
    23  
    24  type MetricName int8
    25  
    26  const (
    27  	MetadataPush MetricName = iota
    28  	MetadataSub
    29  	StoreProvider
    30  	// PushRt
    31  	// SubscribeRt
    32  	// StoreProviderInterfaceRt
    33  	SubscribeServiceRt
    34  )
    35  
    36  const (
    37  	dubboMetadataPush             = "dubbo_metadata_push_num"
    38  	dubboPushRt                   = "dubbo_push_rt_milliseconds"
    39  	dubboMetadataSubscribe        = "dubbo_metadata_subscribe_num"
    40  	dubboSubscribeRt              = "dubbo_subscribe_rt_milliseconds"
    41  	dubboMetadataStoreProvider    = "dubbo_metadata_store_provider"
    42  	dubboStoreProviderInterfaceRt = "dubbo_store_provider_interface_rt_milliseconds"
    43  	dubboSubscribeServiceRt       = "dubbo_subscribe_service_rt_milliseconds"
    44  )
    45  
    46  const (
    47  	totalSuffix  = "_total"
    48  	succSuffix   = "_succeed_total"
    49  	failedSuffix = "_failed_total"
    50  )
    51  
    52  var (
    53  	// app level
    54  	metadataPushNum     = metrics.NewMetricKey(dubboMetadataPush+totalSuffix, "Total Num")
    55  	metadataPushSucceed = metrics.NewMetricKey(dubboMetadataPush+succSuffix, "Succeed Push Num")
    56  	metadataPushFailed  = metrics.NewMetricKey(dubboMetadataPush+failedSuffix, "Failed Push Num")
    57  	// app level
    58  	metadataSubNum     = metrics.NewMetricKey(dubboMetadataSubscribe+totalSuffix, "Total Metadata Subscribe Num")
    59  	metadataSubSucceed = metrics.NewMetricKey(dubboMetadataSubscribe+succSuffix, "Succeed Metadata Subscribe Num")
    60  	metadataSubFailed  = metrics.NewMetricKey(dubboMetadataSubscribe+failedSuffix, "Failed Metadata Subscribe Num")
    61  	// app level
    62  	pushRt = metrics.NewMetricKey(dubboPushRt, "Response Time")
    63  	// app level
    64  	subscribeRt = metrics.NewMetricKey(dubboSubscribeRt, "Response Time")
    65  
    66  	/*
    67  	   # HELP dubbo_metadata_store_provider_succeed_total Succeed Store Provider Metadata
    68  	   # TYPE dubbo_metadata_store_provider_succeed_total gauge
    69  	   dubbo_metadata_store_provider_succeed_total{application_name="metrics-provider",hostname="localhost",interface="org.apache.dubbo.samples.metrics.prometheus.api.DemoService2",ip="10.252.156.213",} 1.0
    70  	   dubbo_metadata_store_provider_succeed_total{application_name="metrics-provider",hostname="localhost",interface="org.apache.dubbo.samples.metrics.prometheus.api.DemoService",ip="10.252.156.213",} 1.0
    71  	*/
    72  	// service level
    73  	metadataStoreProviderFailed  = metrics.NewMetricKey(dubboMetadataStoreProvider+failedSuffix, "Total Failed Provider Metadata Store")
    74  	metadataStoreProviderSucceed = metrics.NewMetricKey(dubboMetadataStoreProvider+succSuffix, "Total Succeed Provider Metadata Store")
    75  	metadataStoreProviderNum     = metrics.NewMetricKey(dubboMetadataStoreProvider+totalSuffix, "Total Provider Metadata Store")
    76  
    77  	/*
    78  	   # HELP dubbo_store_provider_interface_rt_milliseconds_avg Average Response Time
    79  	   # TYPE dubbo_store_provider_interface_rt_milliseconds_avg gauge
    80  	   dubbo_store_provider_interface_rt_milliseconds_avg{application_name="metrics-provider",application_version="3.2.1",git_commit_id="20de8b22ffb2a23531f6d9494a4963fcabd52561",hostname="localhost",interface="org.apache.dubbo.samples.metrics.prometheus.api.DemoService",ip="10.252.156.213",} 504.0
    81  	   dubbo_store_provider_interface_rt_milliseconds_avg{application_name="metrics-provider",application_version="3.2.1",git_commit_id="20de8b22ffb2a23531f6d9494a4963fcabd52561",hostname="localhost",interface="org.apache.dubbo.samples.metrics.prometheus.api.DemoService2",ip="10.252.156.213",} 10837.0
    82  	*/
    83  	// service level
    84  	storeProviderInterfaceRt = metrics.NewMetricKey(dubboStoreProviderInterfaceRt, "Store Provider Interface Time")
    85  
    86  	subscribeServiceRt = metrics.NewMetricKey(dubboSubscribeServiceRt, "Subscribe Service Time")
    87  )