Skip to content

Commit

Permalink
Merge branch 'main' into avara1986/SCRS-1210_improve_iast_startup_time
Browse files Browse the repository at this point in the history
  • Loading branch information
avara1986 authored Dec 30, 2024
2 parents 6141006 + e472d5b commit 10af881
Show file tree
Hide file tree
Showing 22 changed files with 403 additions and 111 deletions.
18 changes: 9 additions & 9 deletions .riot/requirements/14ebf3b.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/14ebf3b.in
#
attrs==24.2.0
coverage[toml]==7.6.1
attrs==24.3.0
coverage[toml]==7.6.9
exceptiongroup==1.2.2
hypothesis==6.45.0
iniconfig==2.0.0
mako==1.3.5
markupsafe==2.1.5
mako==1.3.8
markupsafe==3.0.2
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest-cov==5.0.0
pytest==8.3.4
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
pytest-randomly==3.16.0
sortedcontainers==2.4.0
tomli==2.0.1
tomli==2.2.1
16 changes: 8 additions & 8 deletions .riot/requirements/175d0d6.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/175d0d6.in
#
attrs==24.2.0
coverage[toml]==7.6.1
attrs==24.3.0
coverage[toml]==7.6.9
hypothesis==6.45.0
iniconfig==2.0.0
mako==1.3.5
markupsafe==2.1.5
mako==1.3.8
markupsafe==3.0.2
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest-cov==5.0.0
pytest==8.3.4
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
pytest-randomly==3.16.0
sortedcontainers==2.4.0
16 changes: 8 additions & 8 deletions .riot/requirements/19255aa.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/19255aa.in
#
attrs==24.2.0
coverage[toml]==7.6.1
attrs==24.3.0
coverage[toml]==7.6.9
exceptiongroup==1.2.2
hypothesis==6.45.0
iniconfig==2.0.0
mako==1.1.6
markupsafe==2.1.5
markupsafe==3.0.2
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest-cov==5.0.0
pytest==8.3.4
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
pytest-randomly==3.16.0
sortedcontainers==2.4.0
tomli==2.0.1
tomli==2.2.1
18 changes: 9 additions & 9 deletions .riot/requirements/1b16023.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1b16023.in
#
attrs==24.2.0
coverage[toml]==7.6.1
attrs==24.3.0
coverage[toml]==7.6.9
exceptiongroup==1.2.2
hypothesis==6.45.0
importlib-metadata==8.5.0
iniconfig==2.0.0
mako==1.1.6
markupsafe==2.1.5
markupsafe==3.0.2
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest-cov==5.0.0
pytest==8.3.4
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
pytest-randomly==3.16.0
sortedcontainers==2.4.0
tomli==2.0.1
zipp==3.20.2
tomli==2.2.1
zipp==3.21.0
10 changes: 5 additions & 5 deletions .riot/requirements/1b19707.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1b19707.in
#
attrs==24.2.0
attrs==24.3.0
coverage[toml]==7.6.1
exceptiongroup==1.2.2
hypothesis==6.45.0
importlib-metadata==8.5.0
iniconfig==2.0.0
mako==1.3.5
mako==1.3.8
markupsafe==2.1.5
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest==8.3.4
pytest-cov==5.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
sortedcontainers==2.4.0
tomli==2.0.1
tomli==2.2.1
zipp==3.20.2
14 changes: 7 additions & 7 deletions .riot/requirements/1b8d922.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1b8d922.in
#
attrs==24.2.0
coverage[toml]==7.6.1
attrs==24.3.0
coverage[toml]==7.6.9
hypothesis==6.45.0
iniconfig==2.0.0
mako==1.1.6
markupsafe==2.1.5
markupsafe==3.0.2
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest-cov==5.0.0
pytest==8.3.4
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
pytest-randomly==3.16.0
sortedcontainers==2.4.0
14 changes: 7 additions & 7 deletions .riot/requirements/1d5ebaf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1d5ebaf.in
#
attrs==24.2.0
coverage[toml]==7.6.1
attrs==24.3.0
coverage[toml]==7.6.9
hypothesis==6.45.0
iniconfig==2.0.0
mako==1.1.6
markupsafe==2.1.5
markupsafe==3.0.2
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest-cov==5.0.0
pytest==8.3.4
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
pytest-randomly==3.16.0
sortedcontainers==2.4.0
20 changes: 10 additions & 10 deletions .riot/requirements/1e53fef.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1e53fef.in
#
attrs==24.2.0
coverage[toml]==7.6.1
attrs==24.3.0
coverage[toml]==7.6.9
exceptiongroup==1.2.2
hypothesis==6.45.0
importlib-metadata==8.5.0
iniconfig==2.0.0
mako==1.3.5
markupsafe==2.1.5
mako==1.3.8
markupsafe==3.0.2
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest-cov==5.0.0
pytest==8.3.4
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
pytest-randomly==3.16.0
sortedcontainers==2.4.0
tomli==2.0.1
zipp==3.20.2
tomli==2.2.1
zipp==3.21.0
16 changes: 8 additions & 8 deletions .riot/requirements/27d0ff8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/27d0ff8.in
#
attrs==24.2.0
coverage[toml]==7.6.1
attrs==24.3.0
coverage[toml]==7.6.9
hypothesis==6.45.0
iniconfig==2.0.0
mako==1.3.5
markupsafe==2.1.5
mako==1.3.8
markupsafe==3.0.2
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest-cov==5.0.0
pytest==8.3.4
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
pytest-randomly==3.16.0
sortedcontainers==2.4.0
14 changes: 7 additions & 7 deletions .riot/requirements/b48f841.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/b48f841.in
#
attrs==24.2.0
coverage[toml]==7.6.1
attrs==24.3.0
coverage[toml]==7.6.9
hypothesis==6.45.0
iniconfig==2.0.0
mako==1.1.6
markupsafe==2.1.5
markupsafe==3.0.2
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest-cov==5.0.0
pytest==8.3.4
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
pytest-randomly==3.16.0
sortedcontainers==2.4.0
16 changes: 8 additions & 8 deletions .riot/requirements/e8d8aa5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/e8d8aa5.in
#
attrs==24.2.0
coverage[toml]==7.6.1
attrs==24.3.0
coverage[toml]==7.6.9
hypothesis==6.45.0
iniconfig==2.0.0
mako==1.3.5
markupsafe==2.1.5
mako==1.3.8
markupsafe==3.0.2
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest-cov==5.0.0
pytest==8.3.4
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
pytest-randomly==3.16.0
sortedcontainers==2.4.0
8 changes: 4 additions & 4 deletions .riot/requirements/eda6d79.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile --allow-unsafe --no-annotate .riot/requirements/eda6d79.in
#
attrs==24.2.0
attrs==24.3.0
coverage[toml]==7.6.1
exceptiongroup==1.2.2
hypothesis==6.45.0
Expand All @@ -14,12 +14,12 @@ mako==1.1.6
markupsafe==2.1.5
mock==5.1.0
opentracing==2.4.0
packaging==24.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.3
pytest==8.3.4
pytest-cov==5.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
sortedcontainers==2.4.0
tomli==2.0.1
tomli==2.2.1
zipp==3.20.2
22 changes: 13 additions & 9 deletions ddtrace/contrib/internal/asgi/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ async def _blocked_asgi_app(scope, receive, send):
await send({"type": "http.response.body", "body": b""})


def _parse_response_cookies(response_headers):
cookies = {}
try:
result = response_headers.get("set-cookie", "").split("=", maxsplit=1)
if len(result) == 2:
cookie_key, cookie_value = result
cookies[cookie_key] = cookie_value
except Exception:
log.debug("failed to extract response cookies", exc_info=True)
return cookies


class TraceMiddleware:
"""
ASGI application middleware that traces the requests.
Expand Down Expand Up @@ -211,7 +223,6 @@ async def __call__(self, scope, receive, send):
peer_ip = client[0]
else:
peer_ip = None

trace_utils.set_http_meta(
span,
self.integration_config,
Expand All @@ -234,15 +245,8 @@ async def wrapped_send(message):
except Exception:
log.warning("failed to extract response headers", exc_info=True)
response_headers = None

if span and message.get("type") == "http.response.start" and "status" in message:
cookies = {}
try:
cookie_key, cookie_value = response_headers.get("set-cookie", "").split("=", maxsplit=1)
cookies[cookie_key] = cookie_value
except Exception:
log.debug("failed to extract response cookies", exc_info=True)

cookies = _parse_response_cookies(response_headers)
status_code = message["status"]
trace_utils.set_http_meta(
span,
Expand Down
Loading

0 comments on commit 10af881

Please sign in to comment.