feat(middleware): RoundTripper chain; drop hackney_metrics#845
Merged
feat(middleware): RoundTripper chain; drop hackney_metrics#845
Conversation
Fun-based middleware around hackney:request/1..5, outermost-first, per-request or app-env. send_request/2 bypasses. Metrics subsystem removed; guides/middleware.md shows prometheus/telemetry recipes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a fun-based middleware layer around
hackney:request/1..5, like Go'shttp.RoundTripper. A chain[A, B, C]is outermost-first — A sees the request first and the response last — matching Plug, Rack and Tower. Configure per-request with{middleware, [Fun, ...]}or globally viaapplication:set_env(hackney, middleware, [...]). Crashes propagate;send_request/2stays transport-level and bypasses the chain.The bundled metrics subsystem is gone:
hackney_metrics, the backend behaviour, and the prometheus / dummy implementations, plus all thecounter_inc/gauge_inc/histogram_observecalls scattered throughhackney.erl,hackney_pool.erl,hackney_manager.erlandhackney_sup.erl. Metrics were always opinionated policy that did not belong in the client.guides/middleware.mddocuments the new API and ships worked prometheus and telemetry recipes so anyone upgrading can port in ~20 lines. Pool state remains observable throughhackney_pool:get_stats/1.817 tests pass (10 new middleware unit tests, 4 cowboy-based integration tests, the 10 metrics tests removed).