|
@ -32,9 +32,9 @@ func WithControllers(ctrls ...Controller) Option { |
|
|
// Option supports configuring optional settings for runtime metrics.
|
|
|
// Option supports configuring optional settings for runtime metrics.
|
|
|
type Option func(*config) |
|
|
type Option func(*config) |
|
|
|
|
|
|
|
|
func newConfig(controllers []Controller, opts ...Option) config { |
|
|
func newConfig(opts ...Option) config { |
|
|
cfg := config{ |
|
|
cfg := config{ |
|
|
controllers: controllers, |
|
|
controllers: []Controller{ControllerCPU}, |
|
|
provider: otel.GetMeterProvider(), |
|
|
provider: otel.GetMeterProvider(), |
|
|
prefix: "cgroups.", |
|
|
prefix: "cgroups.", |
|
|
} |
|
|
} |
|
@ -179,20 +179,7 @@ func Start(group string, opts ...Option) (metric.Registration, error) { |
|
|
return nil, fmt.Errorf("load:%w", err) |
|
|
return nil, fmt.Errorf("load:%w", err) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
controllers, cerr := manager.Controllers() |
|
|
cfg := newConfig(opts...) |
|
|
if cerr != nil { |
|
|
|
|
|
return nil, fmt.Errorf("controllers:%w", cerr) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ctrls := make([]Controller, 0, len(controllers)) |
|
|
|
|
|
for _, controller := range controllers { |
|
|
|
|
|
ctrl, err := ParseController(controller) |
|
|
|
|
|
if err == nil { |
|
|
|
|
|
ctrls = append(ctrls, ctrl) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cfg := newConfig(ctrls, opts...) |
|
|
|
|
|
|
|
|
|
|
|
cgr := cgroup{ |
|
|
cgr := cgroup{ |
|
|
meter: cfg.provider.Meter( |
|
|
meter: cfg.provider.Meter( |
|
|