mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 02:34:29 +00:00
PrometheusAuthMiddleware
This commit is contained in:
parent
86b473d267
commit
eaad3b2402
1 changed files with 13 additions and 0 deletions
|
@ -11,6 +11,19 @@ from litellm.proxy.auth.user_api_key_auth import user_api_key_auth
|
|||
|
||||
|
||||
class PrometheusAuthMiddleware(BaseHTTPMiddleware):
|
||||
"""
|
||||
Middleware to authenticate requests to the metrics endpoint
|
||||
|
||||
By default, auth is not run on the metrics endpoint
|
||||
|
||||
Enabled by setting the following in proxy_config.yaml:
|
||||
|
||||
```yaml
|
||||
litellm_settings:
|
||||
require_auth_for_metrics_endpoint: true
|
||||
```
|
||||
"""
|
||||
|
||||
async def dispatch(self, request: Request, call_next):
|
||||
# Check if this is a request to the metrics endpoint
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue