divviup / divviup/janus

Switch the http_handler's `Extension` layer for metrics to a State fn

Open
#4,448 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
70
Forks
16
Avg merge
4h 36m
Merged PRs (30d)
30

Description

We could probably eliminate the Extension layer, storing the instruments on the middleware instead of on the request, by switching to https://docs.rs/axum/latest/axum/middleware/fn.from_fn_with_state.html

Originally posted by @divergentdave in https://github.com/divviup/janus/pull/4426#discussion_r2914079743

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the http_handler metrics middleware and read axum's middleware::from_fn_with_state documentation. Trace how the instruments are currently placed in the request Extension and determine how to store them on the middleware state instead. Done means the Extension layer is removed and metrics still work through the state-based middleware.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, observability
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.