feat: otel metrics and expanded collecting (#2647)

(passed tests in last run)
This commit is contained in:
Andy Li
2025-06-05 17:20:14 -07:00
committed by GitHub
parent 971433f9d5
commit d2252f2953
60 changed files with 499 additions and 161 deletions

View File

@@ -5,7 +5,7 @@ from openai import AsyncStream
from openai.types.chat.chat_completion_chunk import ChatCompletionChunk
from letta.constants import DEFAULT_MESSAGE_TOOL, DEFAULT_MESSAGE_TOOL_KWARG
from letta.helpers.datetime_helpers import get_utc_timestamp_ns
from letta.helpers.datetime_helpers import get_utc_timestamp_ns, ns_to_ms
from letta.schemas.letta_message import AssistantMessage, LettaMessage, ReasoningMessage, ToolCallDelta, ToolCallMessage
from letta.schemas.letta_message_content import TextContent
from letta.schemas.message import Message
@@ -85,7 +85,7 @@ class OpenAIStreamingInterface:
now = get_utc_timestamp_ns()
ttft_ns = now - provider_request_start_timestamp_ns
ttft_span.add_event(
name="openai_time_to_first_token_ms", attributes={"openai_time_to_first_token_ms": ttft_ns // 1_000_000}
name="openai_time_to_first_token_ms", attributes={"openai_time_to_first_token_ms": ns_to_ms(ttft_ns)}
)
first_chunk = False