add cgroups options

This commit is contained in:
andrey
2024-04-06 16:14:14 +03:00
parent 96dbd73e98
commit 87d9f87a6d

View File

@@ -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