Skip to content

Conversation

@alienx5499
Copy link

Summary

  • Implement metrics registration when a Prometheus registerer is provided via WithPrometheus.
  • Previously, WithPrometheus only stored the registerer and never bound metrics, acting as a no-op.

Changes

  • In client/client.go:
    • Import github.com/drand/go-clients/internal/metrics.
    • During client creation (makeClient), if cfg.prometheus != nil, call metrics.RegisterClientMetrics(cfg.prometheus) to bind all client metrics.

Why

  • Ensures WithPrometheus behaves as documented/expected and client metrics become observable/exported.

Testing

  • Ran go build ./... and go test ./...: all green..

Backward compatibility

  • No breaking changes; metrics registration is additive when a registerer is supplied.

Notes

  • Errors from duplicate registration are intentionally ignored at the call-site to allow registry reuse across multiple clients.

Closes #6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix WithPrometheus

1 participant