add cgroups options
This commit is contained in:
@@ -11,11 +11,27 @@ import (
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
)
|
||||
|
||||
// Option supports configuring optional settings for runtime metrics.
|
||||
type Option interface {
|
||||
apply(*config)
|
||||
func WithProvider(provider metric.MeterProvider) Option {
|
||||
return func(c *config) {
|
||||
c.provider = provider
|
||||
}
|
||||
}
|
||||
|
||||
func WithPrefic(name string) Option {
|
||||
return func(c *config) {
|
||||
c.prefix = name
|
||||
}
|
||||
}
|
||||
|
||||
func WithControllers(ctrls ...Controller) Option {
|
||||
return func(c *config) {
|
||||
c.controllers = ctrls
|
||||
}
|
||||
}
|
||||
|
||||
// Option supports configuring optional settings for runtime metrics.
|
||||
type Option func(*config)
|
||||
|
||||
func newConfig(controllers []Controller, opts ...Option) config {
|
||||
cfg := config{
|
||||
controllers: controllers,
|
||||
@@ -24,7 +40,7 @@ func newConfig(controllers []Controller, opts ...Option) config {
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
opt.apply(&cfg)
|
||||
opt(&cfg)
|
||||
}
|
||||
|
||||
return cfg
|
||||
|
||||
Reference in New Issue
Block a user