in propagators/gcp/src/main/java/com/google/cloud/opentelemetry/propagators/XCloudTraceContextPropagator.java [66:82]
public <C> void inject(Context context, C carrier, TextMapSetter<C> setter) {
// We never inject cloud trace context information in oneway mode.
if (oneway) {
return;
}
Span current = Span.fromContext(context);
if (!current.getSpanContext().isValid()) {
return;
}
String sampledString = current.getSpanContext().isSampled() ? "1" : "0";
String spanIdString =
java.lang.Long.toUnsignedString(
java.lang.Long.parseUnsignedLong(current.getSpanContext().getSpanId(), 16));
String value =
current.getSpanContext().getTraceId() + "/" + spanIdString + ";o=" + sampledString;
setter.set(carrier, FIELD, value);
}