Skip to content

Commit 3004acf

Browse files
Merge pull request #2454 from DataDog/drodriguezhdez/ciapp_configuration_tags
[CIAPP] Add configuration tags to TestDecorator
2 parents f11d1e3 + c824f0a commit 3004acf

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

dd-java-agent/agent-bootstrap/src/main/java/datadog/trace/bootstrap/instrumentation/decorator/TestDecorator.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,30 @@ protected String spanKind() {
4343
return Tags.SPAN_KIND_TEST;
4444
}
4545

46+
protected String runtimeName() {
47+
return System.getProperty("java.runtime.name");
48+
}
49+
50+
protected String runtimeVendor() {
51+
return System.getProperty("java.vendor");
52+
}
53+
54+
protected String runtimeVersion() {
55+
return System.getProperty("java.version");
56+
}
57+
58+
protected String osArch() {
59+
return System.getProperty("os.arch");
60+
}
61+
62+
protected String osPlatform() {
63+
return System.getProperty("os.name");
64+
}
65+
66+
protected String osVersion() {
67+
return System.getProperty("os.version");
68+
}
69+
4670
@Override
4771
protected CharSequence spanType() {
4872
return DDSpanTypes.TEST;
@@ -54,6 +78,12 @@ public AgentSpan afterStart(final AgentSpan span) {
5478
span.setTag(Tags.TEST_FRAMEWORK, testFramework());
5579
span.setTag(Tags.TEST_TYPE, testType());
5680
span.setSamplingPriority(PrioritySampling.SAMPLER_KEEP);
81+
span.setTag(Tags.RUNTIME_NAME, runtimeName());
82+
span.setTag(Tags.RUNTIME_VENDOR, runtimeVendor());
83+
span.setTag(Tags.RUNTIME_VERSION, runtimeVersion());
84+
span.setTag(Tags.OS_ARCHITECTURE, osArch());
85+
span.setTag(Tags.OS_PLATFORM, osPlatform());
86+
span.setTag(Tags.OS_VERSION, osVersion());
5787

5888
for (final Map.Entry<String, String> ciTag : ciTags.entrySet()) {
5989
span.setTag(ciTag.getKey(), ciTag.getValue());

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/TestDecoratorTest.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ class TestDecoratorTest extends BaseDecoratorTest {
2323
1 * span.setTag(Tags.TEST_FRAMEWORK, decorator.testFramework())
2424
1 * span.setTag(Tags.TEST_TYPE, decorator.testType())
2525
1 * span.setSamplingPriority(PrioritySampling.SAMPLER_KEEP)
26+
1 * span.setTag(Tags.RUNTIME_NAME, decorator.runtimeName())
27+
1 * span.setTag(Tags.RUNTIME_VENDOR, decorator.runtimeVendor())
28+
1 * span.setTag(Tags.RUNTIME_VERSION, decorator.runtimeVersion())
29+
1 * span.setTag(Tags.OS_ARCHITECTURE, decorator.osArch())
30+
1 * span.setTag(Tags.OS_PLATFORM, decorator.osPlatform())
31+
1 * span.setTag(Tags.OS_VERSION, decorator.osVersion())
2632
decorator.ciTags.each {
2733
1 * span.setTag(it.key, it.value)
2834
}

dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/base/TestFrameworkTest.groovy

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ abstract class TestFrameworkTest extends AgentTestRunner {
4949
}
5050
}
5151

52+
"$Tags.OS_VERSION" String
53+
"$Tags.OS_PLATFORM" String
54+
"$Tags.OS_ARCHITECTURE" String
55+
"$Tags.RUNTIME_VENDOR" String
56+
"$Tags.RUNTIME_NAME" String
57+
"$Tags.RUNTIME_VERSION" String
58+
5259
defaultTags()
5360
}
5461
}

internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/Tags.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ public class Tags {
5151
public static final String GIT_BRANCH = "git.branch";
5252
public static final String GIT_TAG = "git.tag";
5353

54+
public static final String RUNTIME_NAME = "runtime.name";
55+
public static final String RUNTIME_VENDOR = "runtime.vendor";
56+
public static final String RUNTIME_VERSION = "runtime.version";
57+
public static final String OS_ARCHITECTURE = "os.architecture";
58+
public static final String OS_PLATFORM = "os.platform";
59+
public static final String OS_VERSION = "os.version";
60+
5461
public static final String DD_SERVICE = "dd.service";
5562
public static final String DD_VERSION = "dd.version";
5663
public static final String DD_ENV = "dd.env";

0 commit comments

Comments
 (0)