Skip to content

Commit 48202e4

Browse files
authored
Separate OTLP Runtime Metrics Tests into 2 Tests (#6955)
1 parent d57c05c commit 48202e4

2 files changed

Lines changed: 20 additions & 13 deletions

File tree

manifests/java.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4242,7 +4242,8 @@ manifest:
42424242
akka-http: irrelevant (integration injects Date header after bytecode injection occurs)
42434243
play: irrelevant (integration injects Date header after bytecode injection occurs)
42444244
tests/test_library_logs.py::Test_NoExceptions::test_dotnet: irrelevant (only for .NET)
4245-
tests/test_otlp_runtime_metrics.py::Test_OtlpRuntimeMetrics: missing_feature
4245+
tests/test_otlp_runtime_metrics.py::Test_OtlpRuntimeMetrics::test_dd_metrics_are_absent: bug (APMAPI-1952)
4246+
tests/test_otlp_runtime_metrics.py::Test_OtlpRuntimeMetrics::test_otel_metrics_are_present: missing_feature
42464247
tests/test_profiling.py::Test_Profile:
42474248
- weblog_declaration:
42484249
akka-http: v1.22.0

tests/test_otlp_runtime_metrics.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,11 @@
6868
"jvm.cpu.count",
6969
"jvm.cpu.recent_utilization",
7070
"jvm.cpu.time",
71-
"jvm.file_descriptor.count",
72-
"jvm.file_descriptor.limit",
7371
"jvm.memory.committed",
7472
"jvm.memory.init",
7573
"jvm.memory.limit",
7674
"jvm.memory.used",
7775
"jvm.memory.used_after_last_gc",
78-
"jvm.system.cpu.utilization",
7976
"jvm.thread.count",
8077
],
8178
}
@@ -106,10 +103,10 @@ def get_runtime_metric_names():
106103
class Test_OtlpRuntimeMetrics:
107104
"""Verify runtime metrics are sent via OTLP with OTel names, not DD-proprietary names."""
108105

109-
def setup_main(self):
106+
def setup_otel_metrics_are_present(self):
110107
self.req = weblog.get("/")
111108

112-
def test_main(self):
109+
def test_otel_metrics_are_present(self):
113110
assert self.req.status_code == 200
114111

115112
library = context.library.name
@@ -118,18 +115,27 @@ def test_main(self):
118115

119116
metric_names = get_runtime_metric_names()
120117

121-
# All expected OTel-named metrics must be present
122118
expected = EXPECTED_METRICS[library]
123119
for expected_name in expected:
124120
assert expected_name in metric_names, (
125121
f"Expected OTel runtime metric '{expected_name}' not found for {library}. "
126122
f"Got metrics: {sorted(metric_names)}"
127123
)
128124

129-
# DD-proprietary names must NOT be present
125+
def setup_dd_metrics_are_absent(self):
126+
self.req = weblog.get("/")
127+
128+
def test_dd_metrics_are_absent(self):
129+
assert self.req.status_code == 200
130+
131+
library = context.library.name
130132
dd_prefix = DD_PROPRIETARY_PREFIXES.get(library)
131-
if dd_prefix:
132-
dd_named_metrics = [n for n in metric_names if n.startswith(dd_prefix)]
133-
assert len(dd_named_metrics) == 0, (
134-
f"Found DD-proprietary metric names for {library}: {dd_named_metrics}. Expected OTel-native names only."
135-
)
133+
if not dd_prefix:
134+
return
135+
136+
metric_names = get_runtime_metric_names()
137+
138+
dd_named_metrics = [n for n in metric_names if n.startswith(dd_prefix)]
139+
assert len(dd_named_metrics) == 0, (
140+
f"Found DD-proprietary metric names for {library}: {dd_named_metrics}. Expected OTel-native names only."
141+
)

0 commit comments

Comments
 (0)