add opentelemetry tracing
This commit is contained in:
@ -6,6 +6,16 @@ import (
|
||||
)
|
||||
|
||||
type ctxLogKey struct{}
|
||||
type ctxRequestID struct{}
|
||||
|
||||
func WithRequestID(ctx context.Context, requestID string) context.Context {
|
||||
return context.WithValue(ctx, ctxRequestID{}, requestID)
|
||||
}
|
||||
|
||||
func GetRequestID(ctx context.Context) string {
|
||||
reqid, _ := ctx.Value(ctxRequestID{}).(string)
|
||||
return reqid
|
||||
}
|
||||
|
||||
type ctxLogAttrStore struct {
|
||||
attrs []slog.Attr
|
||||
|
||||
Reference in New Issue
Block a user