Skip to content

Automate browser based workflows with AI

Stop using deprecated FilterRequestsOnUrl (#2645)

Asher Foa25f7cb43f7ae
diff --git a/skyvern/__init__.py b/skyvern/__init__.py
index 88f066c79..b374bba50 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()