Skip to content

Commit 298bfb6

Browse files
committed
fix
1 parent 7c0e814 commit 298bfb6

File tree

2 files changed

+7
-9
lines changed
  • instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src

2 files changed

+7
-9
lines changed

instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/trace/ApplicationSpanBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public SpanBuilder addLink(SpanContext applicationSpanContext) {
5050
@Override
5151
@CanIgnoreReturnValue
5252
public SpanBuilder addLink(SpanContext applicationSpanContext, Attributes applicationAttributes) {
53-
agentBuilder.addLink(Bridging.toAgent(applicationSpanContext));
53+
agentBuilder.addLink(
54+
Bridging.toAgent(applicationSpanContext), Bridging.toAgent(applicationAttributes));
5455
return this;
5556
}
5657

instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/TracerTest.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,7 @@ void captureSpanLinkWithoutAttributes() {
334334
linkedSpan.end();
335335
SpanContext linkedSpanContext = linkedSpan.getSpanContext();
336336

337-
Span testSpan =
338-
tracer.spanBuilder("test").addLink(linkedSpanContext).startSpan();
337+
Span testSpan = tracer.spanBuilder("test").addLink(linkedSpanContext).startSpan();
339338
testSpan.end();
340339

341340
// Then
@@ -353,7 +352,6 @@ void captureSpanLinkWithoutAttributes() {
353352
links -> {
354353
assertThat(links).hasSize(1);
355354
LinkData link = links.get(0);
356-
// Compare SpanContext fields individually due to classloader isolation
357355
assertThat(link.getSpanContext().getTraceId())
358356
.isEqualTo(linkedSpanContext.getTraceId());
359357
assertThat(link.getSpanContext().getSpanId())
@@ -364,7 +362,9 @@ void captureSpanLinkWithoutAttributes() {
364362
.isEqualTo(linkedSpanContext.isRemote());
365363
assertThat(link.getAttributes().size()).isEqualTo(0);
366364
})));
367-
} @Test
365+
}
366+
367+
@Test
368368
@DisplayName("capture span link with attributes")
369369
void captureSpanLinkWithAttributes() {
370370
// When
@@ -381,10 +381,7 @@ void captureSpanLinkWithAttributes() {
381381
.put("boolean", true)
382382
.build();
383383
Span testSpan =
384-
tracer
385-
.spanBuilder("test")
386-
.addLink(linkedSpanContext, linkAttributes)
387-
.startSpan();
384+
tracer.spanBuilder("test").addLink(linkedSpanContext, linkAttributes).startSpan();
388385
testSpan.end();
389386

390387
// Then

0 commit comments

Comments
 (0)