Skip to content

Commit

Permalink
add test case for dd_llmobs_disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Gekko0114 committed Sep 29, 2024
1 parent 7e8eb0b commit ee3ff0f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/llmobs/test_llmobs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,25 @@ def test_llm_span(LLMObs, mock_llmobs_span_writer):
)


def test_llm_span_with_dd_llmobs_disabled(LLMObs, mock_llmobs_span_writer, monkeypatch):
monkeypatch.setenv("DD_LLMOBS_ENABLED", "0")
LLMObs.enable()

with LLMObs.llm(model_name="test_model", name="test_llm_call", model_provider="test_provider") as span:
assert span.name == "test_llm_call"
assert span.resource == "llm"
assert span.span_type == "llm"
assert span.get_tag(SPAN_KIND) == "llm"
assert span.get_tag(MODEL_NAME) == "test_model"
assert span.get_tag(MODEL_PROVIDER) == "test_provider"

mock_llmobs_span_writer.enqueue.assert_called_with(
_expected_llmobs_llm_span_event(span, "llm", model_name="test_model", model_provider="test_provider")
)
assert not llmobs_service.enabled



def test_llm_span_agentless(AgentlessLLMObs, mock_llmobs_span_agentless_writer):
with AgentlessLLMObs.llm(model_name="test_model", name="test_llm_call", model_provider="test_provider") as span:
assert span.name == "test_llm_call"
Expand Down

0 comments on commit ee3ff0f

Please sign in to comment.