Add test for setting service/resource name via tag.
MODIFY
dd-trace/src/test/groovy/com/datadoghq/trace/SpanFactory.groovy
dd-trace/src/test/groovy/com/datadoghq/trace/SpanFactory.groovy
@@ -14,7 +14,7 @@ class SpanFactory {
"fakeType",
Collections.emptyMap(),
null,
- null)
+ new DDTracer())
return new DDSpan(timestampMicro, context)
}

MODIFY
dd-trace/src/test/groovy/com/datadoghq/trace/writer/DDApiTest.groovy
dd-trace/src/test/groovy/com/datadoghq/trace/writer/DDApiTest.groovy
package com.datadoghq.trace.writer
-import com.datadoghq.trace.DDTags
import com.datadoghq.trace.Service
import com.datadoghq.trace.SpanFactory
import com.fasterxml.jackson.core.type.TypeReference
@@ -87,26 +86,26 @@ class DDApiTest extends Specification {
where:
traces | expectedRequestBody
[] | []
- [SpanFactory.newSpanOf(1L)] | [new TreeMap<>([
+ [SpanFactory.newSpanOf(1L).setTag("service.name", "my-service")] | [new TreeMap<>([
"duration" : 0,
"error" : 0,
- "meta" : [(DDTags.THREAD_NAME): Thread.currentThread().getName(), (DDTags.THREAD_ID): "${Thread.currentThread().id}"],
+ "meta" : ["thread.name": Thread.currentThread().getName(), "thread.id": "${Thread.currentThread().id}"],
"name" : "fakeOperation",
"parent_id": 0,
"resource" : "fakeResource",
- "service" : "fakeService",
+ "service" : "my-service",
"span_id" : 1,
"start" : 1000,
"trace_id" : 1,
"type" : "fakeType"
])]
- [SpanFactory.newSpanOf(100L)] | [new TreeMap<>([
+ [SpanFactory.newSpanOf(100L).setTag("resource.name", "my-resource")] | [new TreeMap<>([
"duration" : 0,
"error" : 0,
- "meta" : [(DDTags.THREAD_NAME): Thread.currentThread().getName(), (DDTags.THREAD_ID): "${Thread.currentThread().id}"],
+ "meta" : ["thread.name": Thread.currentThread().getName(), "thread.id": "${Thread.currentThread().id}"],
"name" : "fakeOperation",
"parent_id": 0,
- "resource" : "fakeResource",
+ "resource" : "my-resource",
"service" : "fakeService",
"span_id" : 1,
"start" : 100000,
@@ -186,8 +185,8 @@ class DDApiTest extends Specification {
where:
services | expectedRequestBody
[:] | [:]
- ["my-service-name": new Service("my-service-name", "app-name", Service.AppType.CUSTOM)] | ["my-service-name": new TreeMap<>([
- "app" : "app-name",
+ ["my-service-name": new Service("my-service-name", "my-app-name", Service.AppType.CUSTOM)] | ["my-service-name": new TreeMap<>([
+ "app" : "my-app-name",
"app_type": "custom"])
]
}

Add test for setting service/resource name via tag.