Monitorex.ConsumerIdentifier
(monitorex v0.3.0)
Copy Markdown
Extracts a consumer label from an inbound Plug.Conn for per-consumer dashboard breakdowns.
Priority order
- Custom function —
consumer_fnin Application config (arity 1, receivesconn) - Basic-auth username — decoded from
authorizationheader, password discarded - API key header — value of
x-api-keytruncated to 8 characters nil— unknown / anonymous consumer
Summary
Functions
@spec identify(conn :: Plug.Conn.t()) :: String.t() | nil
Identifies the consumer from a Plug.Conn.
Returns nil when no consumer can be determined.