Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import java.util.function.BiConsumer;
import java.util.function.Function;

import static java.util.Collections.singletonMap;

/**
* Basic tracing implementation class for use with REST and AMQP Service Clients to create {@link Span} and in-process
* context propagation. Singleton OpenTelemetry tracer capable of starting and exporting spans.
Expand Down Expand Up @@ -150,16 +152,15 @@ public Context start(String spanName, StartSpanOptions options, Context context)
spanBuilder.setStartTimestamp(options.getStartTimestamp());
}

Span span = spanBuilder.startSpan();
if (span.isRecording()) {
// If span is sampled in, add additional attributes

String tracingNamespace = getAzNamespace(context);
if (tracingNamespace != null) {
OpenTelemetryUtils.addAttribute(span, AZ_TRACING_NAMESPACE_KEY, tracingNamespace);
}
String tracingNamespace = getAzNamespace(context);
if (tracingNamespace != null) {
Attributes attributes
= OpenTelemetryUtils.convert(singletonMap(AZ_TRACING_NAMESPACE_KEY, tracingNamespace));
spanBuilder.setAllAttributes(attributes);
}

Span span = spanBuilder.startSpan();

return context.addData(PARENT_TRACE_CONTEXT_KEY,
(traceContext != null ? traceContext : io.opentelemetry.context.Context.current()).with(span));
}
Expand Down
Loading