# `Zharp.Plug`
[🔗](https://github.com/zharp-io/zharp-elixir-lib/blob/v0.1.0/lib/zharp/plug.ex#L1)

Puts each request's headers, user and session on its span. Add it to your endpoint (Phoenix)
or router (Plug), as early as you can:

    # lib/my_app_web/endpoint.ex
    plug Zharp.Plug

- All request and response headers, as `http.request.header.<name>` and
  `http.response.header.<name>`; secrets (authorization, cookies, API keys, tokens, sessions)
  as `[REDACTED]`, so you see one was sent but never its value. `capture_headers: false` turns
  this off; `capture_headers: [redact: ["x-tenant"]]` filters more names.
- The user and session a Zharp browser or mobile SDK sends in `baggage`, as `enduser.id` and
  `session.id`.
- Plug.Router apps: the span named by the route (`GET /orders/:id`); Phoenix names its own.

The request's span itself comes from Bandit or Cowboy; Zharp starts their instrumentation.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
