From 25f7cb43f7ae8474467c8c6a1979876146534118 Mon Sep 17 00:00:00 2001 From: Asher Foa Date: Tue, 10 Jun 2025 10:37:19 -0400 Subject: [PATCH] Stop using deprecated FilterRequestsOnUrl (#2645) --- skyvern/__init__.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/skyvern/__init__.py b/skyvern/__init__.py index 88f066c7..b374bba5 100644 --- a/skyvern/__init__.py +++ b/skyvern/__init__.py @@ -1,15 +1,23 @@ from ddtrace import tracer -from ddtrace.filters import FilterRequestsOnUrl - +from ddtrace.trace import TraceFilter, Span +from ddtrace.ext import http +import re from skyvern.forge.sdk.forge_log import setup_logger -tracer.configure( - settings={ - "FILTERS": [ - FilterRequestsOnUrl(r"http://.*/heartbeat$"), - ], - }, -) + +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 + + +tracer.configure(trace_processors=[FilterHeartbeat()]) setup_logger()