package org.elasticsoftware.elasticactors.serialization.internal.tracing;

import org.elasticsoftware.elasticactors.serialization.protobuf.Messaging;
import org.elasticsoftware.elasticactors.tracing.TraceContext;

import javax.annotation.Nullable;

public final class TraceContextSerializer {

    private TraceContextSerializer() {
    }

    @Nullable
    public static Messaging.TraceContext serialize(@Nullable TraceContext traceContext) {
        if (traceContext != null && !traceContext.isEmpty()) {
            Messaging.TraceContext.Builder serialized = Messaging.TraceContext.newBuilder();
            serialized.setSpanId(traceContext.getSpanId());
            serialized.setTraceId(traceContext.getTraceId());
            if (traceContext.getParentId() != null) {
                serialized.setParentId(traceContext.getParentId());
            }
            return serialized.build();
        }
        return null;
    }

}

@@ -843,32 +843,208 @@
 ;%0A            %7D%0A
+            if (traceContext.getBaggage() != null && !traceContext.getBaggage().isEmpty()) %7B%0A                serialized.putAllBaggage(traceContext.getBaggage());%0A            %7D%0A
             retu

Fix trace baggage propagation