Skip to content

Commit c9ecd86

Browse files
amarzialidevflow.devflow-routing-intake
andauthored
Add test on service source inheritance (#10994)
Add test on service source inheritance Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>
1 parent bce9eaf commit c9ecd86

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

dd-trace-core/src/test/groovy/datadog/trace/core/DDSpanContextTest.groovy

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,26 @@ class DDSpanContextTest extends DDCoreSpecification {
314314
context.toString().contains("id=-") == false
315315
}
316316

317+
def "service name source is propagated from parent to child span"() {
318+
setup:
319+
def parent = tracer.buildSpan("parentOperation")
320+
.withServiceName("fakeService")
321+
.start()
322+
323+
when:
324+
def child = tracer.buildSpan("childOperation")
325+
.asChildOf(parent.context())
326+
.start()
327+
def childContext = child.context() as DDSpanContext
328+
329+
then:
330+
childContext.getServiceNameSource() == ServiceNameSources.MANUAL
331+
332+
cleanup:
333+
child.finish()
334+
parent.finish()
335+
}
336+
317337
static void assertTagmap(Map source, Map comparison, boolean removeThread = false) {
318338
def sourceWithoutCommonTags = new HashMap(source)
319339
sourceWithoutCommonTags.remove("runtime-id")

0 commit comments

Comments
 (0)