mirror of
https://github.com/redis/go-redis.git
synced 2025-07-29 17:41:15 +03:00
Remove OpenTelemetry from the code (but leave redisotel as is) (#1782)
This commit is contained in:
committed by
GitHub
parent
036605d7c6
commit
6e4eb2e3ac
@ -4,16 +4,10 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8/internal/proto"
|
||||
"github.com/go-redis/redis/v8/internal/util"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
func Sleep(ctx context.Context, dur time.Duration) error {
|
||||
_, span := StartSpan(ctx, "time.Sleep")
|
||||
defer span.End()
|
||||
|
||||
t := time.NewTimer(dur)
|
||||
defer t.Stop()
|
||||
|
||||
@ -50,21 +44,3 @@ func isLower(s string) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
var tracer = otel.Tracer("github.com/go-redis/redis")
|
||||
|
||||
func StartSpan(ctx context.Context, name string) (context.Context, trace.Span) {
|
||||
if span := trace.SpanFromContext(ctx); !span.IsRecording() {
|
||||
return ctx, span
|
||||
}
|
||||
return tracer.Start(ctx, name)
|
||||
}
|
||||
|
||||
func RecordError(ctx context.Context, span trace.Span, err error) error {
|
||||
if err != proto.Nil {
|
||||
span.RecordError(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user