fix: resolve type gate regressions in prometheus caller identity validation

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Devin AI 2026-08-26 08:01:48 +00:00
parent d675b904e0
commit 64c8931077
4 changed files with 16 additions and 15 deletions

View file

@ -1,6 +1,6 @@
{
"reportAny": {
"limit": 18494
"limit": 18483
},
"reportArgumentType": {
"limit": 2564
@ -24,7 +24,7 @@
"limit": 19
},
"reportExplicitAny": {
"limit": 5968
"limit": 5960
},
"reportFunctionMemberAccess": {
"limit": 7
@ -57,7 +57,7 @@
"limit": 5659
},
"reportMissingTypeArgument": {
"limit": 15494
"limit": 15484
},
"reportMissingTypeStubs": {
"limit": 40
@ -105,13 +105,13 @@
"limit": 109
},
"reportUnknownMemberType": {
"limit": 38818
"limit": 38808
},
"reportUnknownParameterType": {
"limit": 19838
"limit": 19829
},
"reportUnknownVariableType": {
"limit": 30371
"limit": 30356
},
"reportUnnecessaryCast": {
"limit": 117

View file

@ -332,16 +332,17 @@ def validate_caller_identity_settings(litellm_settings: Mapping[str, object]) ->
that request a label the selected mode removes."""
if "prometheus_deployment_and_latency_caller_identity" not in litellm_settings:
return
litellm.prometheus_deployment_and_latency_caller_identity = cast(
litellm.prometheus_deployment_and_latency_caller_identity = cast( # cast-ok: validated on the next line, which raises on an invalid value
'Literal["api_key_alias", "user_email", "both"]',
litellm_settings["prometheus_deployment_and_latency_caller_identity"],
) # cast-ok: validated on the next line, which raises on an invalid value
)
caller_identity_mode: Final = validate_prometheus_deployment_and_latency_caller_identity()
if caller_identity_mode != "user_email":
return
raw_metrics_config: Final = litellm_settings.get("prometheus_metrics_config")
conflicting_metrics: Final = tuple(
metric_name
for metric_config in (litellm_settings.get("prometheus_metrics_config") or ())
for metric_config in (raw_metrics_config if isinstance(raw_metrics_config, list) else ())
if isinstance(metric_config, dict) and "api_key_alias" in (metric_config.get("include_labels") or ())
for metric_name in (metric_config.get("metrics") or ())
if metric_name in PROMETHEUS_DEPLOYMENT_AND_LATENCY_CALLER_IDENTITY_METRICS

View file

@ -12,10 +12,10 @@
"limit": 2012
},
"ANN202": {
"limit": 848
"limit": 847
},
"ANN204": {
"limit": 707
"limit": 706
},
"ANN205": {
"limit": 112
@ -24,7 +24,7 @@
"limit": 133
},
"ANN401": {
"limit": 1155
"limit": 1153
},
"ASYNC230": {
"limit": 11

View file

@ -1,9 +1,9 @@
{
"LIT001": {
"limit": 22741
"limit": 22733
},
"LIT002": {
"limit": 26865
"limit": 26864
},
"LIT003": {
"limit": 269
@ -27,7 +27,7 @@
"limit": 0
},
"LIT010": {
"limit": 16638
"limit": 16621
},
"LIT011": {
"limit": 5585