Browse Source

add cgroups options

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

24
cgroups/cpu.go

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

Loading…
Cancel
Save