livery_instrument_metrics (livery v0.2.0)

View Source

HTTP server metrics middleware powered by the instrument library.

Records the OpenTelemetry HTTP server semantic-convention metrics on every request:

  • http.server.active_requests (up_down_counter): incremented on request entry, decremented on exit.
  • http.server.request.duration (histogram, seconds): wall-clock time from middleware entry to response return.

Attributes follow the conventions:

  • http.request.method
  • http.response.status_code
  • network.protocol.name
  • url.scheme

State: #{meter => binary() | atom()} (defaults to <<"livery">>). Instruments are resolved from the instrument registry on each request (create_* is idempotent and returns the existing handle by name), so the registry is the single source of truth and a registry restart self-heals. If the registry is unavailable, the request is served without metrics rather than failing.

Summary

Functions

call(Req, Next, State)