Browse Source

add cgroups options

master cgroups/v0.0.1
andrey 8 months ago
parent
commit
87d9f87a6d
  1. 24
      cgroups/cpu.go

24
cgroups/cpu.go

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

Loading…
Cancel
Save