You can now access the Request object from an exemplars callback. Example:
python
def exemplars(r: Request):
return {"trace_id": r.headers.get("x-trace-id", "")}
app.add_middleware(
PrometheusMiddleware,
exemplars=exemplars
)
This will allow you to use header values as exemplars. Note that if you want to use OpenTelemetry traces with exemplars, see [this example](https://github.com/stephenhillier/starlette_exporter/issues/90#issuecomment-1913465367).
Thank you backbord (92)!