This libary can be used to enhance the looplab/eventhorizon library with the functionality to trace the X-Correlation-ID
through events.
Supported Go Versions:
This library supports two most recent Go, currently 1.16
go get github.com/Clarilab/eh-tracygo
Get Correlation-ID from Context:
import (
ehtracygo "github.com/Clarilab/eh-tracygo"
)
func someFunction(ctx context.Context) {
correlationID := ehtracygo.FromContext(ctx)
}
Add Correlation-ID to Context:
import (
ehtracygo "github.com/Clarilab/eh-tracygo"
)
func someFunction(ctx context.Context, correlationID string) {
ctx = ehtracygo.NewContext(ctx, correlationID)
}
If the Correlation-ID is already present in the context, simply initialize this libary to use it in combination with the looplab/eventhorizon library.
import (
_ "github.com/Clarilab/eh-tracygo"
)