github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/actor/middleware/protozip/outbound_middleware.go (about)

     1  package protozip
     2  
     3  import (
     4  	"github.com/asynkron/protoactor-go/actor"
     5  )
     6  
     7  func ZipkinTracer(next actor.SenderFunc) actor.SenderFunc {
     8  	return func(ctx actor.SenderContext, target *actor.PID, envelope *actor.MessageEnvelope) {
     9  		header := ctx.MessageHeader()
    10  
    11  		envelope.SetHeader("trace-id", header.Get("trace-id"))
    12  		envelope.SetHeader("span-id", header.Get("child-id"))
    13  		envelope.SetHeader("child-id", "123random")
    14  
    15  		next(ctx, target, envelope)
    16  	}
    17  }