-
Notifications
You must be signed in to change notification settings - Fork 0
/
meterprovider.go
49 lines (40 loc) · 1.7 KB
/
meterprovider.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
48
49
package tallyotel
import (
"github.com/mmcshane/tallyotel/internal/bridge"
tally "github.com/uber-go/tally/v4"
"go.opentelemetry.io/otel/metric"
)
type (
// Opt is the type for supplying optional configuration parameters to a
// `tallyotel.NewMeterProvider`
Opt = bridge.Opt
// HistogramBucketer is an func allowing client code to pick different
// bucketization strategies for histograms based on the information in the
// histogram's sdkapi.Descriptor.
HistogramBucketer = bridge.HistogramBucketer
// MeterScoper allows clients to override the default behavior of creating a
// named Tally sub-scope for each Meter.
MeterScoper = bridge.MeterScoper
)
var (
// WithHistogramBucketer wraps a HistogramBucketer into a tallyotel Opt so
// that it can be passed in to a MeterProvider.
WithHistogramBucketer = bridge.WithHistogramBucketer
// WithMeterScoper wraps a MeterScoper into a tallyotel Opt so that it can
// be passed in to a a MeterProvider.
WithMeterScoper = bridge.WithMeterScoper
// DefaultBucketer returns the default histogram buckets. It is exposed here
// for use as a fallback bucketing strategy within a custom
// HistogramBucketer.
DefaultBucketer = bridge.DefaultBucketer
// WithScopeNameSeparator provides a string to a MeterProvider at
// construction time to be used in splitting child Meter names into scope
// names.
WithScopeNameSeparator = bridge.WithScopeNameSeparator
)
// NewMeterProvider instantiates a tallyotel bridge metric.MeterProvider that
// uses the supplied tally.Scope as a base scope for the creation of child
// Meters and Instruments.
func NewMeterProvider(scope tally.Scope, opts ...Opt) metric.MeterProvider {
return bridge.NewMeterProvider(scope, opts...)
}