mirror of https://github.com/go-redis/redis.git
Merge branch 'master' of github.com:go-redis/redis
This commit is contained in:
commit
47ac23e055
|
@ -33,6 +33,7 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
|
||||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||||
github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
|
github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
|
||||||
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
|
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
|
||||||
|
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
|
||||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||||
github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c=
|
github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c=
|
||||||
|
|
|
@ -27,11 +27,16 @@ func (TracingHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.
|
||||||
return ctx, nil
|
return ctx, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, span := tracer.Start(ctx, cmd.FullName())
|
attrs := []attribute.KeyValue{
|
||||||
span.SetAttributes(
|
|
||||||
attribute.String("db.system", "redis"),
|
attribute.String("db.system", "redis"),
|
||||||
attribute.String("db.statement", rediscmd.CmdString(cmd)),
|
attribute.String("db.statement", rediscmd.CmdString(cmd)),
|
||||||
)
|
}
|
||||||
|
opts := []trace.SpanStartOption{
|
||||||
|
trace.WithSpanKind(trace.SpanKindClient),
|
||||||
|
trace.WithAttributes(attrs...),
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, _ = tracer.Start(ctx, cmd.FullName(), opts...)
|
||||||
|
|
||||||
return ctx, nil
|
return ctx, nil
|
||||||
}
|
}
|
||||||
|
@ -52,12 +57,17 @@ func (TracingHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder
|
||||||
|
|
||||||
summary, cmdsString := rediscmd.CmdsString(cmds)
|
summary, cmdsString := rediscmd.CmdsString(cmds)
|
||||||
|
|
||||||
ctx, span := tracer.Start(ctx, "pipeline "+summary)
|
attrs := []attribute.KeyValue{
|
||||||
span.SetAttributes(
|
|
||||||
attribute.String("db.system", "redis"),
|
attribute.String("db.system", "redis"),
|
||||||
attribute.Int("db.redis.num_cmd", len(cmds)),
|
attribute.Int("db.redis.num_cmd", len(cmds)),
|
||||||
attribute.String("db.statement", cmdsString),
|
attribute.String("db.statement", cmdsString),
|
||||||
)
|
}
|
||||||
|
opts := []trace.SpanStartOption{
|
||||||
|
trace.WithSpanKind(trace.SpanKindClient),
|
||||||
|
trace.WithAttributes(attrs...),
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, _ = tracer.Start(ctx, "pipeline "+summary, opts...)
|
||||||
|
|
||||||
return ctx, nil
|
return ctx, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue