OTEL backend for metrics/traces/logs (#4632)

Co-authored-by: Benji Visser <benji@093b.org>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Shuchang Zheng
2026-02-04 17:54:07 -08:00
committed by GitHub
parent be00c65071
commit 566a108d5d
19 changed files with 2935 additions and 2807 deletions

View File

@@ -1,4 +1,3 @@
import re
import typing
from typing import Any
@@ -7,31 +6,7 @@ from skyvern.utils import setup_windows_event_loop_policy
if typing.TYPE_CHECKING:
from skyvern.library import Skyvern # noqa: E402
try:
from ddtrace import tracer
from ddtrace.ext import http
from ddtrace.trace import TraceFilter, Span
class FilterHeartbeat(TraceFilter):
_HB_URL = re.compile(r"http://.*/heartbeat$")
def process_trace(self, trace: list[Span]) -> list[Span] | None:
for span in trace:
url = span.get_tag(http.URL)
if span.parent_id is None and url is not None and self._HB_URL.match(url):
# drop the full trace chunk
return None
return trace
_DDTRACE_AVAILABLE = True
except ImportError:
_DDTRACE_AVAILABLE = False
setup_windows_event_loop_policy()
if _DDTRACE_AVAILABLE:
tracer.configure(trace_processors=[FilterHeartbeat()])
setup_logger()
# noinspection PyUnresolvedReferences