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