in metrics/internal/pipelines/observer.go [55:82]
func Observe(ctx context.Context, log *logrus.Logger, token string) error {
metric, err := initMetric()
if err != nil {
return fmt.Errorf("can't init the pipelines_total metric: %w", err)
}
errorMetric, err := initErrorMetric()
if err != nil {
return fmt.Errorf("can't init the pipelines_observer_errors metric: %w", err)
}
client, err := newClient(token)
if err != nil {
return fmt.Errorf("can't create a gitlab client: %w", err)
}
obs := observer{
ctx: ctx,
ops: client,
log: log,
metric: metric,
errorMetric: errorMetric,
}
go obs.mainLoop()
return nil
}