Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some Prometheus metrics #4534

Merged
merged 5 commits into from
Jun 4, 2024
Merged

add some Prometheus metrics #4534

merged 5 commits into from
Jun 4, 2024

Conversation

marten-seemann
Copy link
Member

@marten-seemann marten-seemann commented May 28, 2024

Fixes #4077.

TODO:

  • add documentation for quic-go.net

These metrics are by no means comprehensive, but it's a starting point that we can iterate from.

Copy link

codecov bot commented May 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.15%. Comparing base (459a6f3) to head (a620f1a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4534   +/-   ##
=======================================
  Coverage   85.15%   85.15%           
=======================================
  Files         154      154           
  Lines       14801    14801           
=======================================
  Hits        12603    12603           
  Misses       1690     1690           
  Partials      508      508           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

metrics/pool.go Outdated Show resolved Hide resolved
metrics/tracer.go Show resolved Hide resolved

// DefaultTracerWithRegisterer returns a callback that creates a metrics ConnectionTracer
// using a given Prometheus registerer.
func DefaultTracerWithRegisterer(registerer prometheus.Registerer) func(_ context.Context, p logging.Perspective, _ logging.ConnectionID) *logging.ConnectionTracer {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can register the metrics here once instead of registering them in the callback. The current method also works but all but the first registration will return AlreadyRegistrationError so we can just register them upfront here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewClientConnectionTracerWithRegisterer and NewServerConnectionTracerWithRegisterer are public functions though, so we'll need to register in these code paths as well (and catch the AlreadyRegisteredErrors there).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point.

@marten-seemann marten-seemann merged commit 950de0d into master Jun 4, 2024
34 checks passed
@marten-seemann marten-seemann deleted the prometheus branch June 4, 2024 09:18
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.

provide Prometheus metrics
2 participants