Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test_awesome_otel_with_message_logging_off

Ishaan Jaff202b5cc2cd3b
diff --git a/tests/logging_callback_tests/test_otel_logging.py b/tests/logging_callback_tests/test_otel_logging.py
index c8aefa71389..49212607b89 100644
--- a/tests/logging_callback_tests/test_otel_logging.py
+++ b/tests/logging_callback_tests/test_otel_logging.py
@@ -200,6 +200,12 @@ def test_completion_claude_3_function_call_with_otel(model):
@pytest.mark.parametrize("streaming", [True, False])
@pytest.mark.parametrize("global_redact", [True, False])
async def test_awesome_otel_with_message_logging_off(streaming, global_redact):
+ """
+ No content should be logged when message logging is off
+
+ tests when litellm.turn_off_message_logging is set to True
+ tests when OpenTelemetry(message_logging=False) is set
+ """
litellm.set_verbose = True
litellm.callbacks = [OpenTelemetry(config=OpenTelemetryConfig(exporter=exporter))]
if global_redact is False:
@@ -256,4 +262,9 @@ def validate_redacted_message_span_attributes(span):
"gen_ai.usage.prompt_tokens",
]
+ _all_attributes = set([name for name in span.attributes.keys()])
+ print("all_attributes", _all_attributes)
+
+ assert _all_attributes == set(expected_attributes)
+
pass