Skip to content

Commit 935b66d

Browse files
authored
Merge branch 'main' into tyler.finethy/DEBUG-4341
2 parents d875594 + e23ac10 commit 935b66d

Some content is hidden

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

47 files changed

+396
-369
lines changed

pyproject.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,7 @@ ignore = [
174174
"tests/*test_*.py" = [
175175
"ANN201", # missing-return-type-undocumented-public-function: allow test_method to not declare their return type
176176
]
177-
178-
"tests/{parametric,apm_tracing_e2e,appsec,debugger,serverless,remote_config,k8,integrations}*/test_*.py" = [
179-
"ANN001", # missing-type-function-argument: TODO
180-
]
181-
"tests/{test_te,test_b,test_c,test_d,test_g,test_i,test_l,test_n,test_p,test_s}*.py" = [
177+
"tests/{parametric,appsec,debugger,remote_config}*/test_*.py" = [
182178
"ANN001", # missing-type-function-argument: TODO
183179
]
184180
"tests/*" = [

tests/apm_tracing_e2e/test_otel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ def test_distributed_otel_trace(self):
8080
assert len(spans) == 3
8181

8282

83-
def _get_span_by_name(spans, span_name):
83+
def _get_span_by_name(spans: list[dict], span_name: str):
8484
for s in spans:
8585
if s["name"] == span_name:
8686
return s
8787
return {}
8888

8989

90-
def _get_span_by_resource(spans, resource_name):
90+
def _get_span_by_resource(spans: list[dict], resource_name: str):
9191
for s in spans:
9292
if s["resource"] == resource_name:
9393
return s

tests/apm_tracing_e2e/test_single_span.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def test_child_span_is_single_span(self):
6767
_assert_single_span_event(spans[0], "child.span.single_span_submitted", is_root=False)
6868

6969

70-
def _assert_single_span_event(event, name, is_root):
70+
def _assert_single_span_event(event: dict, name: str, *, is_root: bool):
7171
assert event["operation_name"] == name
7272
assert event["single_span"] is True
7373
assert event["ingestion_reason"] == "single_span"
@@ -79,7 +79,7 @@ def _assert_single_span_event(event, name, is_root):
7979
assert len(parent_id) > 0, f"In a child span the parent_id should be specified. Actual: {parent_id}"
8080

8181

82-
def _assert_single_span_metrics(span):
82+
def _assert_single_span_metrics(span: dict):
8383
assert span["metrics"][SAMPLING_PRIORITY_KEY] == -1 # due to the global sampling rate = 0
8484
assert span["metrics"][SINGLE_SPAN_SAMPLING_RATE] == 1.0
8585
assert span["metrics"][SINGLE_SPAN_SAMPLING_MECHANISM] == SINGLE_SPAN_SAMPLING_MECHANISM_VALUE

tests/auto_inject/test_auto_inject_install.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class TestContainerAutoInjectInstallScriptProfiling(base.AutoInjectBaseTest):
109109
)
110110
@bug(
111111
context.weblog_variant == "test-app-nodejs-container-25",
112-
reason="APMSP-2331",
112+
reason="PROF-12765",
113113
)
114114
def test_profiling(self):
115115
self._test_install(context.virtual_machine, profile=True)
@@ -221,10 +221,6 @@ def test_no_world_writeable(self):
221221
@scenarios.simple_installer_auto_injection
222222
@scenarios.multi_installer_auto_injection
223223
class TestSimpleInstallerAutoInjectManual(base.AutoInjectBaseTest):
224-
@irrelevant(
225-
context.library > "python@2.21.0" and context.installed_language_runtime < "3.8.0",
226-
reason="python 3.7 is not supported on ddtrace >= 3.x",
227-
)
228224
def test_install(self):
229225
virtual_machine = context.virtual_machine
230226
logger.info(

tests/debugger/test_debugger_probe_snapshot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import tests.debugger.utils as debugger
77

88

9-
from utils import scenarios, features, missing_feature, context, irrelevant
9+
from utils import scenarios, features, missing_feature, context, irrelevant, bug
1010
from utils.interfaces._library.miscs import validate_process_tags
1111

1212

@@ -213,6 +213,7 @@ class Test_Debugger_Line_Probe_Snaphots(BaseDebuggerProbeSnaphotTest):
213213
def setup_log_line_snapshot(self):
214214
self._setup("probe_snapshot_log_line", "/debugger/log", "log", lines=None)
215215

216+
@bug(context.library == "nodejs", reason="DEBUG-4611")
216217
def test_log_line_snapshot(self):
217218
self._assert()
218219
self._validate_snapshots()
@@ -223,7 +224,6 @@ def setup_log_line_snapshot_debug_track(self):
223224

224225
@missing_feature(context.library == "ruby", reason="DEBUG-4343")
225226
@missing_feature(context.library == "nodejs", reason="DEBUG-4345")
226-
@missing_feature(context.library == "java", reason="APMRP-360")
227227
def test_log_line_snapshot_debug_track(self):
228228
"""Test that the library sends snapshots to the debug track endpoint (fallback or not)"""
229229
self._assert()
@@ -235,7 +235,7 @@ def setup_log_line_snapshot_new_destination(self):
235235

236236
@missing_feature(context.library == "ruby", reason="DEBUG-4343")
237237
@missing_feature(context.library == "nodejs", reason="DEBUG-4345")
238-
@missing_feature(context.library == "java", reason="APMRP-360")
238+
@missing_feature(context.agent_version < "7.72.0", reason="Endpoint was introduced in 7.72.0", force_skip=True)
239239
def test_log_line_snapshot_new_destination(self):
240240
"""Test that the library sends snapshots to the debugger/v2/input endpoint"""
241241
self._assert()
@@ -298,6 +298,7 @@ class Test_Debugger_Line_Probe_Snaphots_With_SCM(BaseDebuggerProbeSnaphotTest):
298298
def setup_log_line_snapshot(self):
299299
self._setup("probe_snapshot_log_line", "/debugger/log", "log", lines=None)
300300

301+
@bug(context.library == "nodejs", reason="DEBUG-4611")
301302
def test_log_line_snapshot(self):
302303
self._assert()
303304
self._validate_snapshots()

tests/debugger/utils/probes/probe_snapshot_log_line.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"type": "",
55
"id": "",
66
"version": 0,
7+
"captureSnapshot": true,
78
"where": {
89
"typeName": null,
910
"sourceFile": "ACTUAL_SOURCE_FILE",

tests/docker_ssi/test_docker_ssi_appsec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def setup_telemetry_source_ssi(self):
1717
@missing_feature(condition=context.library in ("nodejs", "java", "php", "dotnet"), reason="No implemented")
1818
@missing_feature(context.library < "python@3.15.0", reason="No implemented")
1919
@irrelevant(context.library == "python" and context.installed_language_runtime < "3.8.0")
20+
@irrelevant(context.library >= "python@3.32.0" and context.installed_language_runtime < "3.9.0")
2021
def test_telemetry_source_ssi(self):
2122
root_span = interfaces.test_agent.get_traces(request=self.r)
2223
assert root_span, f"No traces found for request {self.r.get_rid()}"

tests/integrations/crossed_integrations/test_kafka.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class _BaseKafka:
1515
buddy_interface: interfaces.LibraryInterfaceValidator
1616

1717
@classmethod
18-
def get_span(cls, interface, span_kind, topic) -> dict | None:
18+
def get_span(cls, interface: interfaces.LibraryInterfaceValidator, span_kind: str, topic: str) -> dict | None:
1919
logger.debug(f"Trying to find traces with span kind: {span_kind} and topic: {topic} in {interface}")
2020

2121
for data, trace in interface.get_traces():
@@ -36,7 +36,7 @@ def get_span(cls, interface, span_kind, topic) -> dict | None:
3636
return None
3737

3838
@staticmethod
39-
def get_topic(span) -> str | None:
39+
def get_topic(span: dict) -> str | None:
4040
"""Extracts the topic from a span by trying various fields"""
4141
topic = span["meta"].get("kafka.topic") # this is in python
4242
if topic is None:
@@ -131,7 +131,12 @@ def test_consume_trace_equality(self):
131131
assert consumer_span is not None
132132
assert producer_span["trace_id"] == consumer_span["trace_id"]
133133

134-
def validate_kafka_spans(self, producer_interface, consumer_interface, topic):
134+
def validate_kafka_spans(
135+
self,
136+
producer_interface: interfaces.LibraryInterfaceValidator,
137+
consumer_interface: interfaces.LibraryInterfaceValidator,
138+
topic: str,
139+
):
135140
"""Validates production/consumption of kafka message.
136141
It works the same for both test_produce and test_consume
137142
"""

tests/integrations/crossed_integrations/test_kinesis.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ class _BaseKinesis:
1515
unique_id: str
1616

1717
@classmethod
18-
def get_span(cls, interface, span_kind, stream, operation) -> dict | None:
18+
def get_span(
19+
cls, interface: interfaces.LibraryInterfaceValidator, span_kind: list[str], stream: str, operation: str
20+
) -> dict | None:
1921
logger.debug(f"Trying to find traces with span kind: {span_kind} and stream: {stream} in {interface}")
2022

2123
for data, trace in interface.get_traces():
@@ -53,7 +55,7 @@ def get_span(cls, interface, span_kind, stream, operation) -> dict | None:
5355
return None
5456

5557
@staticmethod
56-
def get_stream(span) -> str | None:
58+
def get_stream(span: dict) -> str | None:
5759
"""Extracts the stream from a span by trying various fields"""
5860
stream = span["meta"].get("streamname", None) # this is in nodejs, java, python
5961

@@ -187,7 +189,12 @@ def test_consume_trace_equality(self):
187189
assert consumer_span is not None
188190
assert producer_span["trace_id"] == consumer_span["trace_id"]
189191

190-
def validate_kinesis_spans(self, producer_interface, consumer_interface, stream):
192+
def validate_kinesis_spans(
193+
self,
194+
producer_interface: interfaces.LibraryInterfaceValidator,
195+
consumer_interface: interfaces.LibraryInterfaceValidator,
196+
stream: str,
197+
):
191198
"""Validates production/consumption of Kinesis message.
192199
It works the same for both test_produce and test_consume
193200
"""

tests/integrations/crossed_integrations/test_rabbitmq.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ class _BaseRabbitMQ:
1919
buddy_interface: interfaces.LibraryInterfaceValidator
2020

2121
@classmethod
22-
def get_span(cls, interface, span_kind, queue, exchange, operation) -> dict | None:
22+
def get_span(
23+
cls,
24+
interface: interfaces.LibraryInterfaceValidator,
25+
span_kind: str,
26+
queue: str,
27+
exchange: str,
28+
operation: list[str],
29+
) -> dict | None:
2330
logger.debug(f"Trying to find traces with span kind: {span_kind} and queue: {queue} in {interface}")
2431

2532
for data, trace in interface.get_traces():
@@ -32,17 +39,17 @@ def get_span(cls, interface, span_kind, queue, exchange, operation) -> dict | No
3239

3340
operation_found = False
3441
for op in operation:
35-
if op.lower() in span.get("resource").lower() or op.lower() in span.get("name").lower():
42+
if op.lower() in span["resource"].lower() or op.lower() in span["name"].lower():
3643
operation_found = True
3744
break
3845

3946
if not operation_found:
4047
continue
4148

42-
meta = span.get("meta")
49+
meta: dict[str, str] = span["meta"]
4350
if (
44-
queue.lower() not in span.get("resource").lower()
45-
and exchange.lower() not in span.get("resource").lower()
51+
queue.lower() not in span["resource"].lower()
52+
and exchange.lower() not in span["resource"].lower()
4653
and queue.lower() not in meta.get("rabbitmq.routing_key", "").lower()
4754
# this is where we find the queue name in dotnet 👇
4855
and queue.lower() not in meta.get("amqp.routing_key", "").lower()
@@ -188,7 +195,13 @@ def test_consume_trace_equality(self):
188195
assert consumer_span is not None
189196
assert producer_span["trace_id"] == consumer_span["trace_id"]
190197

191-
def validate_rabbitmq_spans(self, producer_interface, consumer_interface, queue, exchange):
198+
def validate_rabbitmq_spans(
199+
self,
200+
producer_interface: interfaces.LibraryInterfaceValidator,
201+
consumer_interface: interfaces.LibraryInterfaceValidator,
202+
queue: str,
203+
exchange: str,
204+
):
192205
"""Validates production/consumption of RabbitMQ message.
193206
It works the same for both test_produce and test_consume
194207
"""

0 commit comments

Comments
 (0)