20
)
21
22
>
func NewTimerDef(name string, opts ...Option) timerDefinition {
defs.go
23
>
// This line cannot be combined with others!
24
>
// This ensures the stack trace has information of the caller.
25
>
def := newMetricDefinition(name, opts...)
26
>
globalRegistry.register(def)
27
>
return timerDefinition{def}
28
>
}
29
30
>
func NewBytesHistogramDef(name string, opts ...Option) histogramDefinition {
defs.go
31
>
// This line cannot be combined with others!
32
>
// This ensures the stack trace has information of the caller.
33
>
def := newMetricDefinition(name, append(opts, WithUnit(Bytes))...)
34
>
globalRegistry.register(def)
35
>
return histogramDefinition{def}
36
>
}
37
38
>
func NewDimensionlessHistogramDef(name string, opts ...Option) histogramDefinition {
defs.go
39
>
// This line cannot be combined with others!
40
>
// This ensures the stack trace has information of the caller.
41
>
def := newMetricDefinition(name, append(opts, WithUnit(Dimensionless))...)
42
>
globalRegistry.register(def)
43
>
return histogramDefinition{def}
44
>
}
45
46
>
func NewCounterDef(name string, opts ...Option) counterDefinition {
defs.go
47
>
// This line cannot be combined with others!
48
>
// This ensures the stack trace has information of the caller.
49
>
def := newMetricDefinition(name, opts...)
50
>
globalRegistry.register(def)
51
>
return counterDefinition{def}
52
>
}
53
54
>
func NewGaugeDef(name string, opts ...Option) gaugeDefinition {
defs.go
55
>
// This line cannot be combined with others!
56
>
// This ensures the stack trace has information of the caller.
57
>
def := newMetricDefinition(name, opts...)
58
>
globalRegistry.register(def)
59
>
return gaugeDefinition{def}
60
>
}
61
62
func (d histogramDefinition) With(handler Handler) HistogramIface {