Skip to content

Commit 761ea70

Browse files
committed
Fix size calculations and improve DDTracerTest
1 parent 8b910b4 commit 761ea70

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

dd-trace-api/src/main/java/datadog/trace/api/Config.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,13 @@ public Map<String, String> getMergedSpanTags() {
182182
}
183183

184184
public Map<String, String> getMergedJmxTags() {
185-
final Map<String, String> result = newHashMap(globalTags.size() + jmxTags.size() + 1);
185+
final Map<String, String> runtimeTags = getRuntimeTags();
186+
final Map<String, String> result =
187+
newHashMap(
188+
globalTags.size() + jmxTags.size() + runtimeTags.size() + 1 /* for serviceName */);
186189
result.putAll(globalTags);
187190
result.putAll(jmxTags);
188-
result.putAll(getRuntimeTags());
191+
result.putAll(runtimeTags);
189192
// service name set here instead of getRuntimeTags because apm already manages the service tag
190193
// and may chose to override it.
191194
result.put(SERVICE_NAME, serviceName);

dd-trace-ot/src/test/groovy/datadog/trace/DDTracerTest.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ class DDTracerTest extends Specification {
121121
tracer.serviceName == DEFAULT_SERVICE_NAME
122122
tracer.sampler == sampler
123123
tracer.writer == writer
124-
tracer.runtimeTags.size() > 0
124+
tracer.runtimeTags[Config.RUNTIME_ID_TAG].size() > 0 // not null or empty
125+
tracer.runtimeTags[Config.LANGUAGE_TAG_KEY] == Config.LANGUAGE_TAG_VALUE
125126
}
126127

127128
def "Shares TraceCount with DDApi with #key = #value"() {
@@ -134,7 +135,7 @@ class DDTracerTest extends Specification {
134135
tracer.traceCount.is(((DDAgentWriter) tracer.writer).getApi().traceCount)
135136

136137
where:
137-
key | value
138+
key | value
138139
PRIORITY_SAMPLING | "true"
139140
PRIORITY_SAMPLING | "false"
140141
}

0 commit comments

Comments
 (0)