File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
tests/test_litellm/integrations Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -218,11 +218,21 @@ def test_exclude_labels_strips_label_from_metrics():
218218
219219 logger = PrometheusLogger ()
220220
221+ # Force at least one observation so the labeled histogram emits samples to
222+ # the registry; without this, family.samples is empty and the assertion
223+ # below never executes (trivially passing even if exclude_labels is broken).
224+ _observe_once (logger )
225+
221226 # Verify via the registry: no sample for litellm_request_total_latency_metric
222227 # should carry the end_user label key
228+ found_any_sample = False
223229 for family in REGISTRY .collect ():
224230 if family .name == "litellm_request_total_latency_metric" :
225231 for sample in family .samples :
232+ found_any_sample = True
226233 assert (
227234 "end_user" not in sample .labels
228235 ), f"end_user label found in sample { sample } "
236+ assert (
237+ found_any_sample
238+ ), "No samples found; _observe_once did not populate the registry"
You can’t perform that action at this time.
0 commit comments