github.com/extrame/fabric-ca@v2.0.0-alpha+incompatible/lib/server/db/metrics.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package db 8 9 import "github.com/hyperledger/fabric/common/metrics" 10 11 var ( 12 // APICounterOpts define the counter opts for database APIs 13 APICounterOpts = metrics.CounterOpts{ 14 Namespace: "db_api_request", 15 Subsystem: "", 16 Name: "count", 17 Help: "Number of requests made to a database API", 18 LabelNames: []string{"ca_name", "func_name", "dbapi_name"}, 19 StatsdFormat: "%{#fqname}.%{ca_name}.%{func_name}.%{dbapi_name}", 20 } 21 22 // APIDurationOpts define the duration opts for database APIs 23 APIDurationOpts = metrics.HistogramOpts{ 24 Namespace: "db_api_request", 25 Subsystem: "", 26 Name: "duration", 27 Help: "Time taken in seconds for the request to a database API to be completed", 28 LabelNames: []string{"ca_name", "func_name", "dbapi_name"}, 29 StatsdFormat: "%{#fqname}.%{ca_name}.%{func_name}.%{dbapi_name}", 30 } 31 ) 32 33 // Metrics is the set of meters for the database 34 type Metrics struct { 35 // APICounter keeps track of number of times a database API is called 36 APICounter metrics.Counter 37 // APIDuration keeps track of time taken for request to complete to a database API 38 APIDuration metrics.Histogram 39 }