Skip to content

Commit 20d375c

Browse files
steveny91AAraKKe
andauthored
Add renamed metric (#21877)
* renamed metrics * changelog * fix * rename * changelog * Update litellm/changelog.d/21877.fixed Co-authored-by: Juanpe Araque <[email protected]> --------- Co-authored-by: Juanpe Araque <[email protected]>
1 parent d852836 commit 20d375c

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed

litellm/changelog.d/21877.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a renamed metric that was missed from the [1.75 release of LiteLLM](https://github.com/BerriAI/litellm/pull/13271)

litellm/datadog_checks/litellm/metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
'litellm_team_budget_remaining_hours_metric': "team.budget.remaining_hours.metric",
7979
'litellm_team_max_budget_metric': "team.max_budget.metric",
8080
'litellm_total_tokens': "total.tokens",
81+
'litellm_total_tokens_metric': "total.tokens",
8182
'process_start_time_seconds': {"name": "process.uptime.seconds", "type": "time_elapsed"},
8283
# Deprecated
8384
'litellm_llm_api_failed_requests_metric': "llm.api.failed_requests.metric",

litellm/tests/common.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,9 @@ def get_fixture_path(filename):
119119
'litellm.endpoint.healthy_count',
120120
'litellm.endpoint.unhealthy_count',
121121
]
122+
123+
RENAMED_METRICS_V1_75 = [
124+
'litellm.total.tokens.count',
125+
'litellm.input_tokens.metric.count',
126+
'litellm.output_tokens.metric.count',
127+
]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# HELP litellm_total_tokens_metric_total Total number of input + output tokens from LLM requests
2+
# TYPE litellm_total_tokens_metric_total counter
3+
litellm_total_tokens_metric_total 0.0
4+
# HELP litellm_input_tokens_metric_total Total number of input tokens from LLM requests
5+
# TYPE litellm_input_tokens_metric_total counter
6+
litellm_input_tokens_metric_total 0.0
7+
# HELP litellm_output_tokens_metric_total Total number of output tokens from LLM requests
8+
# TYPE litellm_output_tokens_metric_total counter
9+
litellm_output_tokens_metric_total 0.0

litellm/tests/test_unit.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
ENDPOINT_METRICS,
1313
METRICS,
1414
OM_MOCKED_INSTANCE,
15+
RENAMED_METRICS_V1_75,
1516
get_fixture_path,
1617
)
1718

@@ -89,3 +90,14 @@ def test__extract_error_type_not_found():
8990
check = LitellmCheck('litellm', {}, [{}])
9091
error_msg = 'no litellm error here'
9192
assert check._extract_error_type(error_msg) == 'unknown'
93+
94+
95+
def test_litellm_renamed_metrics(dd_run_check, aggregator, mock_http_response):
96+
# Some metrics were renamed here: https://github.com/BerriAI/litellm/pull/13271
97+
mock_http_response(file_path=get_fixture_path('renamed_metrics.txt'))
98+
check = LitellmCheck('litellm', {}, [OM_MOCKED_INSTANCE])
99+
dd_run_check(check)
100+
for metric in RENAMED_METRICS_V1_75:
101+
aggregator.assert_metric(metric)
102+
aggregator.assert_all_metrics_covered()
103+
aggregator.assert_service_check('litellm.openmetrics.health', ServiceCheck.OK)

0 commit comments

Comments
 (0)