feat: add trace.SpanIDFromContext and trace.TraceIDFromContext (#2654)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
ztrace "github.com/zeromicro/go-zero/internal/trace"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
|
||||
"google.golang.org/grpc/peer"
|
||||
@@ -12,6 +13,13 @@ import (
|
||||
|
||||
const localhost = "127.0.0.1"
|
||||
|
||||
var (
|
||||
// SpanIDFromContext returns the span id from ctx.
|
||||
SpanIDFromContext = ztrace.SpanIDFromContext
|
||||
// TraceIDFromContext returns the trace id from ctx.
|
||||
TraceIDFromContext = ztrace.TraceIDFromContext
|
||||
)
|
||||
|
||||
// PeerFromCtx returns the peer from ctx.
|
||||
func PeerFromCtx(ctx context.Context) string {
|
||||
p, ok := peer.FromContext(ctx)
|
||||
|
||||
Reference in New Issue
Block a user