Stop using deprecated FilterRequestsOnUrl (#2645)

This commit is contained in:
Asher Foa
2025-06-10 10:37:19 -04:00
committed by GitHub
parent dc032e8a55
commit 25f7cb43f7

View File

@@ -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()