Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ddtrace/llmobs/_integrations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def trace(self, pin: Pin, operation_id: str, submit_to_llmobs: bool = False, **k
service=int_service(pin, self.integration_config),
span_type=SpanTypes.LLM if (submit_to_llmobs and self.llmobs_enabled) else None,
)
log.debug("Creating LLM span with type %s", span.span_type)
# determine if the span represents a proxy request
base_url = self._get_base_url(**kwargs)
if self._is_instrumented_proxy_url(base_url):
Expand Down
5 changes: 5 additions & 0 deletions ddtrace/llmobs/_integrations/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from ddtrace._trace.pin import Pin
from ddtrace.internal.constants import COMPONENT
from ddtrace.internal.logger import get_logger
from ddtrace.internal.utils.version import parse_version
from ddtrace.llmobs._constants import CACHE_READ_INPUT_TOKENS_METRIC_KEY
from ddtrace.llmobs._constants import INPUT_DOCUMENTS
Expand All @@ -30,6 +31,9 @@
from ddtrace.trace import Span


log = get_logger(__name__)


class OpenAIIntegration(BaseLLMIntegration):
_integration_name = "openai"

Expand Down Expand Up @@ -59,6 +63,7 @@ def trace(self, pin: Pin, operation_id: str, submit_to_llmobs: bool = False, **k
traced_operations = ("createCompletion", "createChatCompletion", "createEmbedding", "createResponse")
if operation_id in traced_operations:
submit_to_llmobs = True
log.debug("Creating LLM span for openai operation: %s", operation_id)
return super().trace(pin, operation_id, submit_to_llmobs, **kwargs)

def _set_base_span_tags(self, span: Span, **kwargs) -> None:
Expand Down
Loading