forked from hyperledger/fabric
-
Notifications
You must be signed in to change notification settings - Fork 11
/
metrics.go
47 lines (41 loc) · 1.35 KB
/
metrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package broadcast
import "github.com/hyperledger/fabric/common/metrics"
var (
validateDuration = metrics.HistogramOpts{
Namespace: "broadcast",
Name: "validate_duration",
Help: "The time to validate a transaction in seconds.",
LabelNames: []string{"channel", "type", "status"},
StatsdFormat: "%{#fqname}.%{channel}.%{type}.%{status}",
}
enqueueDuration = metrics.HistogramOpts{
Namespace: "broadcast",
Name: "enqueue_duration",
Help: "The time to enqueue a transaction in seconds.",
LabelNames: []string{"channel", "type", "status"},
StatsdFormat: "%{#fqname}.%{channel}.%{type}.%{status}",
}
processedCount = metrics.CounterOpts{
Namespace: "broadcast",
Name: "processed_count",
Help: "The number of transactions processed.",
LabelNames: []string{"channel", "type", "status"},
StatsdFormat: "%{#fqname}.%{channel}.%{type}.%{status}",
}
)
type Metrics struct {
ValidateDuration metrics.Histogram
EnqueueDuration metrics.Histogram
ProcessedCount metrics.Counter
}
func NewMetrics(p metrics.Provider) *Metrics {
return &Metrics{
ValidateDuration: p.NewHistogram(validateDuration),
EnqueueDuration: p.NewHistogram(enqueueDuration),
ProcessedCount: p.NewCounter(processedCount),
}
}