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

Replace idiosyncratic metrics collector with expvar. #89

Merged
merged 2 commits into from
Oct 30, 2022

Conversation

creachadair
Copy link
Owner

This change removes the "metrics" package from the module and updates the
existing metrics to use the standard expvar package instead. The package
creates a shared *expvar.Map at initialization time, and populates expvar
metrics for the existing server details (request counts, bytes read/written,
active servers, etc.).

This is a breaking change to the module API.

Updates #46.

This change removes the "metrics" package from the module and updates the
existing metrics to use the standard expvar package instead.  The package
creates a shared *expvar.Map at initialization time, and populates expvar
metrics for the existing server details (request counts, bytes read/written,
active servers, etc.).

This is a breaking change to the module API.
Also: Update Go toolchain to 1.18.
@creachadair creachadair merged commit db6007b into main Oct 30, 2022
@creachadair creachadair deleted the mjf/expvar-metrics branch October 30, 2022 19:06
creachadair added a commit that referenced this pull request Oct 30, 2022
This release removes the idiosyncratic "metrics" collector and replaces its use
with the standard "expvar" package (see #89). This is a breaking change to the
module API.

Packages that wish to attach custom metrics can now do so by calling the new
jrpc2.ServerMetrics helper, which returns a *expvar.Map. The caller may add any
metrics it wishes to this map, and they will be propagated into the ServerInfo
value by the server. The caller is also responsible for publishing the map to a
metrics collector (e.g., calling expvar.Publish or forwarding to Prometheus) if
desired.

Other changes in this release:
- Update module dependencies
- Remove usage of the "metrics" package from examples
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.

1 participant