Skip to content

Commit 6074594

Browse files
committed
Merge branch 'main' into test/symdb-fork-behaviour
2 parents 8d95b4e + 4d0ed61 commit 6074594

File tree

133 files changed

+4891
-2124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+4891
-2124
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ tests/appsec/ @DataDog/asm-python
126126
tests/contrib/subprocess @DataDog/asm-python
127127
tests/snapshots/tests*appsec*.json @DataDog/asm-python
128128
tests/contrib/*/test*appsec*.py @DataDog/asm-python
129+
tests/contrib/*/test*iast*.py @DataDog/asm-python
129130
scripts/iast/* @DataDog/asm-python
130131

131132
# Profiling

.github/workflows/build_deploy.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,12 @@ jobs:
5050
"$GITHUB_REF_NAME" =~ ^[0-9]+\.x$ ]]; then
5151
LIBRARY_VERSION=$(setuptools-scm --strip-dev)
5252
else
53-
# All else, maintain the dev version
54-
LIBRARY_VERSION=$(setuptools-scm)
53+
# use version string explicitly set in the project metadata, if exists
54+
LIBRARY_VERSION=$(grep '^version = ' pyproject.toml | tr -d '"' | cut -d' ' -f3)
55+
if [[ -z $LIBRARY_VERSION ]]; then
56+
# All else, maintain the dev version
57+
LIBRARY_VERSION=$(setuptools-scm)
58+
fi
5559
fi
5660
5761
echo "${LIBRARY_VERSION}" | tee version.txt

.github/workflows/generate-package-versions.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ jobs:
4949
with:
5050
python-version: "3.13"
5151

52+
- name: Setup Python 3.14
53+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
54+
with:
55+
python-version: "3.14"
56+
5257
- name: Set up QEMU
5358
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
5459

@@ -82,6 +87,8 @@ jobs:
8287
pip install riot==0.20.1
8388
pip install PyYAML
8489
pip install ddtrace
90+
# Install latest pip-tools from main branch for Python 3.14 compatibility
91+
pip install --upgrade git+https://github.com/jazzband/pip-tools.git@934b46a8795554f994b984ac743957f8458a29d6
8592
8693
- name: Run regenerate-riot-latest
8794
run: scripts/regenerate-riot-latest.sh

.gitlab/package.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ publish-wheels-to-s3:
8787
tags: ["arch:amd64"]
8888
image: registry.ddbuild.io/images/mirror/amazon/aws-cli:2.4.29
8989
stage: package
90-
rules:
91-
- when: always
9290
needs:
9391
- job: download_ddtrace_artifacts
9492
artifacts: true

benchmarks/bm/flask_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ def setup(self):
101101

102102
if self.profiler_enabled:
103103
os.environ.update(
104-
{"DD_PROFILING_ENABLED": "1", "DD_PROFILING_API_TIMEOUT": "0.1", "DD_PROFILING_UPLOAD_INTERVAL": "10"}
104+
{
105+
"DD_PROFILING_ENABLED": "1",
106+
"DD_PROFILING_API_TIMEOUT_MS": "100",
107+
"DD_PROFILING_UPLOAD_INTERVAL": "10",
108+
}
105109
)
106110
if not self.tracer_enabled:
107111
import ddtrace.profiling.auto # noqa:F401

benchmarks/coverage_fibonacci/config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Coverage benchmark configurations for fibonacci code
22
# Tests sys.monitoring.DISABLE optimization performance
3+
# Configurations for both line-level and file-level coverage modes
34

5+
# Line-level coverage configurations (original mode)
46
small: &base
57
fib_n_recursive: 10
8+
env_dd_coverage_file_level: "false"
69

710
medium:
811
<<: *base
@@ -11,3 +14,16 @@ medium:
1114
large:
1215
<<: *base
1316
fib_n_recursive: 20
17+
18+
# File-level coverage configurations (lightweight mode)
19+
small_file: &base_file
20+
fib_n_recursive: 10
21+
env_dd_coverage_file_level: "true"
22+
23+
medium_file:
24+
<<: *base_file
25+
fib_n_recursive: 15
26+
27+
large_file:
28+
<<: *base_file
29+
fib_n_recursive: 20

benchmarks/coverage_fibonacci/scenario.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ class CoverageFibonacci(bm.Scenario):
2121
2222
Tests the DISABLE optimization: returning sys.monitoring.DISABLE prevents
2323
the handler from being called repeatedly for the same line.
24+
25+
Can run in either line-level or file-level coverage mode.
2426
"""
2527

2628
fib_n_recursive: int
29+
env_dd_coverage_file_level: str
2730

2831
def run(self) -> Generator[Callable[[int], None], None, None]:
2932
import os
@@ -32,6 +35,9 @@ def run(self) -> Generator[Callable[[int], None], None, None]:
3235
from ddtrace.internal.coverage.code import ModuleCodeCollector
3336
from ddtrace.internal.coverage.installer import install
3437

38+
# Set coverage mode directly from parameter
39+
os.environ["_DD_COVERAGE_FILE_LEVEL"] = self.env_dd_coverage_file_level
40+
3541
# Install coverage
3642
install(include_paths=[Path(os.getcwd())])
3743

benchmarks/django_simple/scenario.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ def run(self):
3838

3939
if self.profiler_enabled:
4040
os.environ.update(
41-
{"DD_PROFILING_ENABLED": "1", "DD_PROFILING_API_TIMEOUT": "0.1", "DD_PROFILING_UPLOAD_INTERVAL": "10"}
41+
{
42+
"DD_PROFILING_ENABLED": "1",
43+
"DD_PROFILING_API_TIMEOUT_MS": "100",
44+
"DD_PROFILING_UPLOAD_INTERVAL": "10",
45+
}
4246
)
4347
if self.appsec_enabled:
4448
os.environ.update({"DD_APPSEC_ENABLED ": "1"})

ddtrace/_trace/processor/resource_renaming.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from urllib.parse import urlparse
55

66
from ddtrace._trace.processor import SpanProcessor
7+
from ddtrace._trace.span import Span
78
from ddtrace.ext import SpanTypes
89
from ddtrace.ext import http
910
from ddtrace.internal.logger import get_logger
@@ -13,7 +14,7 @@
1314
log = get_logger(__name__)
1415

1516

16-
class ResourceRenamingProcessor(SpanProcessor):
17+
class SimplifiedEndpointComputer:
1718
def __init__(self):
1819
self._INT_RE = re.compile(r"^[1-9][0-9]+$")
1920
self._INT_ID_RE = re.compile(r"^(?=.*[0-9].*)[0-9._-]{3,}$")
@@ -35,7 +36,7 @@ def _compute_simplified_endpoint_path_element(self, elem: str) -> str:
3536
return "{param:str}"
3637
return elem
3738

38-
def _compute_simplified_endpoint(self, url: Optional[str]) -> str:
39+
def from_url(self, url: Optional[str]) -> str:
3940
"""Extracts and simplifies the path from an HTTP URL."""
4041
if not url:
4142
return "/"
@@ -62,16 +63,24 @@ def _compute_simplified_endpoint(self, url: Optional[str]) -> str:
6263
elements = [self._compute_simplified_endpoint_path_element(elem) for elem in elements]
6364
return "/" + "/".join(elements)
6465

65-
def on_span_start(self, span):
66+
67+
class ResourceRenamingProcessor(SpanProcessor):
68+
def __init__(self):
69+
self.simplified_endpoint_computer = SimplifiedEndpointComputer()
70+
71+
def on_span_start(self, span: Span):
6672
pass
6773

68-
def on_span_finish(self, span):
74+
def on_span_finish(self, span: Span):
6975
if not span._is_top_level or span.span_type not in (SpanTypes.WEB, SpanTypes.HTTP, SpanTypes.SERVERLESS):
7076
return
7177

78+
status = span.get_tag(http.STATUS_CODE)
79+
is_404 = status == "404" or status == 404
80+
7281
route = span.get_tag(http.ROUTE)
7382

74-
if not route or config._trace_resource_renaming_always_simplified_endpoint:
83+
if not is_404 and (not route or config._trace_resource_renaming_always_simplified_endpoint):
7584
url = span.get_tag(http.URL)
76-
endpoint = self._compute_simplified_endpoint(url)
77-
span._set_tag_str(http.ENDPOINT, endpoint)
85+
endpoint = self.simplified_endpoint_computer.from_url(url)
86+
span.set_tag_str(http.ENDPOINT, endpoint)

ddtrace/_trace/tracer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ def __init__(self) -> None:
172172
service_name=config.service or None,
173173
service_env=config.env or None,
174174
service_version=config.version or None,
175+
process_tags=None,
176+
container_id=None,
175177
)
176178
try:
177179
self._config_on_disk = store_metadata(metadata)

0 commit comments

Comments
 (0)