diff --git a/tests/unit/integrations/otel/test_otel_v2_vendor_mappers.py b/tests/unit/integrations/otel/test_otel_v2_vendor_mappers.py index efc43b16305..ca7a9b424ad 100644 --- a/tests/unit/integrations/otel/test_otel_v2_vendor_mappers.py +++ b/tests/unit/integrations/otel/test_otel_v2_vendor_mappers.py @@ -6,7 +6,6 @@ backends, so one trace lights up every configured destination. """ import json -import time from collections.abc import Mapping from itertools import chain from typing import Final @@ -434,8 +433,8 @@ def test_openinference_raw_tool_arguments_fall_back_to_repr_instead_of_raising() ) ) attrs: Final = OpenInferenceMapper().map(data) - assert ( - attrs["llm.output_messages.0.message.tool_calls.0.tool_call.function.arguments"] == repr(raw_arguments) + assert attrs["llm.output_messages.0.message.tool_calls.0.tool_call.function.arguments"] == repr( + raw_arguments ), label assert attrs["llm.output_messages.0.message.role"] == "assistant" @@ -482,24 +481,13 @@ def test_openinference_payload_tool_arguments_with_raw_objects_map_without_raisi assert json.loads(attrs["metadata"]) == {"user_api_key_alias": "edge-key"} -def test_openinference_attribute_fit_stays_linear_on_long_prompts(): - """Attribute fitting is linear in the message count, not quadratic. - - Rescanning the full group map once per message made the fit quadratic in - the prompt length (~1.9s of callback time at 8000 messages); indexing the - groups once keeps it in milliseconds. The bound sits far above the linear - runtime so it cannot flake on slow runners, while the quadratic path - exceeds it several times over. - """ +def test_openinference_attribute_fit_keeps_pinned_messages_on_long_prompts(): messages: Final = _long_prompt_messages(4000) mapped: Final = OpenInferenceMapper().map( _llm_call(messages_in=messages, promoted_metadata={"user_api_key_alias": "k"}) ) - started: Final = time.perf_counter() fitted: Final = fit_indexed_messages(mapped, 128) - elapsed: Final = time.perf_counter() - started - assert elapsed < 0.25 assert len(fitted) <= 128 assert fitted["llm.input_messages.0.message.role"] == "user" assert fitted["llm.input_messages.3999.message.role"] == "assistant"