Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Incorrect label count in prometheus metrics reporting #7611

Closed
micahjsmith opened this issue Jan 7, 2025 · 1 comment · Fixed by #7618
Closed

[Bug]: Incorrect label count in prometheus metrics reporting #7611

micahjsmith opened this issue Jan 7, 2025 · 1 comment · Fixed by #7618
Assignees
Labels
bug Something isn't working mlops user request

Comments

@micahjsmith
Copy link

What happened?

Seeing an error in async callback deading with prometheus label count. This does not cause any completion requests to fail, but errors like this make me worried that prometheus metrics are not accurate representation of system health and performance. This is a regression as in v1.54.1 this error was not present.

Relevant log output

Task exception was never retrieved
future: <Task finished name='Task-769554' coro=<ServiceLogging.async_service_failure_hook() done, defined at /usr/local/lib/python3.13/site-packages/litellm/_service_logger.py:207> exception=ValueError('Incorrect label count')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/litellm/_service_logger.py", line 243, in async_service_failure_hook
    await self.prometheusServicesLogger.async_service_failure_hook(
    ...<2 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/litellm/integrations/prometheus_services.py", line 207, in async_service_failure_hook
    self.increment_counter(
    ~~~~~~~~~~~~~~~~~~~~~~^
        counter=obj,
        ^^^^^^^^^^^^
    ...<3 lines>...
        amount=1,  # LOG ERROR COUNT TO PROMETHEUS
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/litellm/integrations/prometheus_services.py", line 131, in increment_counter
    counter.labels(labels, *additional_labels).inc(amount)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/prometheus_client/metrics.py", line 199, in labels
    raise ValueError('Incorrect label count')
ValueError: Incorrect label count


### Are you a ML Ops Team?

Yes

### What LiteLLM version are you on ?

v1.56.5

### Twitter / LinkedIn details

_No response_
@micahjsmith micahjsmith added the bug Something isn't working label Jan 7, 2025
@krrishdholakia
Copy link
Contributor

able to repro

@krrishdholakia krrishdholakia self-assigned this Jan 7, 2025
rajatvig pushed a commit to rajatvig/litellm that referenced this issue Jan 16, 2025
* fix(main.py): pass custom llm provider on litellm logging provider update

* fix(cost_calculator.py): don't append provider name to return model if existing llm provider

Fixes BerriAI#7607

* fix(prometheus_services.py): fix prometheus system health error logging

Fixes BerriAI#7611
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mlops user request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants