mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(coderd): export metric indicating each experiment's status (#12657)
This commit is contained in:
@@ -258,6 +258,7 @@ func enablePrometheus(
|
||||
), nil
|
||||
}
|
||||
|
||||
//nolint:gocognit // TODO(dannyk): reduce complexity of this function
|
||||
func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Closer, error)) *serpent.Command {
|
||||
if newAPI == nil {
|
||||
newAPI = func(_ context.Context, o *coderd.Options) (*coderd.API, io.Closer, error) {
|
||||
@@ -893,6 +894,15 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
|
||||
return xerrors.Errorf("register agents prometheus metric: %w", err)
|
||||
}
|
||||
defer closeAgentsFunc()
|
||||
|
||||
var active codersdk.Experiments
|
||||
for _, exp := range options.DeploymentValues.Experiments.Value() {
|
||||
active = append(active, codersdk.Experiment(exp))
|
||||
}
|
||||
|
||||
if err = prometheusmetrics.Experiments(options.PrometheusRegistry, active); err != nil {
|
||||
return xerrors.Errorf("register experiments metric: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
client := codersdk.New(localURL)
|
||||
|
||||
Reference in New Issue
Block a user