From dd7fefe738a1d00dcb01f3e76be1bb9a6dae9b72 Mon Sep 17 00:00:00 2001 From: lawmatsuyama Date: Wed, 3 Mar 2021 22:43:10 -0300 Subject: [PATCH] change otel/label for otel/attribute --- extra/redisotel/redisotel.go | 12 ++++++------ go.mod | 6 +++--- go.sum | 7 +++++++ options.go | 4 ++-- redis.go | 4 ++-- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/extra/redisotel/redisotel.go b/extra/redisotel/redisotel.go index e3c34f61..cb321ac8 100644 --- a/extra/redisotel/redisotel.go +++ b/extra/redisotel/redisotel.go @@ -6,8 +6,8 @@ import ( "github.com/go-redis/redis/extra/rediscmd" "github.com/go-redis/redis/v8" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/trace" ) @@ -24,8 +24,8 @@ func (TracingHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context. ctx, span := tracer.Start(ctx, cmd.FullName()) span.SetAttributes( - label.String("db.system", "redis"), - label.String("db.statement", rediscmd.CmdString(cmd)), + attribute.String("db.system", "redis"), + attribute.String("db.statement", rediscmd.CmdString(cmd)), ) return ctx, nil @@ -49,9 +49,9 @@ func (TracingHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder ctx, span := tracer.Start(ctx, "pipeline "+summary) span.SetAttributes( - label.String("db.system", "redis"), - label.Int("db.redis.num_cmd", len(cmds)), - label.String("db.statement", cmdsString), + attribute.String("db.system", "redis"), + attribute.Int("db.redis.num_cmd", len(cmds)), + attribute.String("db.statement", cmdsString), ) return ctx, nil diff --git a/go.mod b/go.mod index 29182d26..ebb78e77 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f github.com/onsi/ginkgo v1.15.0 github.com/onsi/gomega v1.10.5 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/metric v0.17.0 - go.opentelemetry.io/otel/trace v0.17.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/metric v0.18.0 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/go.sum b/go.sum index 9532f045..440f4a5b 100644 --- a/go.sum +++ b/go.sum @@ -39,12 +39,19 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.opentelemetry.io/otel v0.17.0 h1:6MKOu8WY4hmfpQ4oQn34u6rYhnf2sWf1LXYO/UFm71U= go.opentelemetry.io/otel v0.17.0/go.mod h1:Oqtdxmf7UtEvL037ohlgnaYa1h7GtMh0NcSd9eqkC9s= +go.opentelemetry.io/otel v0.18.0 h1:d5Of7+Zw4ANFOJB+TIn2K3QWsgS2Ht7OU9DqZHI6qu8= +go.opentelemetry.io/otel v0.18.0/go.mod h1:PT5zQj4lTsR1YeARt8YNKcFb88/c2IKoSABK9mX0r78= go.opentelemetry.io/otel/metric v0.17.0 h1:t+5EioN8YFXQ2EH+1j6FHCKMUj+57zIDSnSGr/mWuug= go.opentelemetry.io/otel/metric v0.17.0/go.mod h1:hUz9lH1rNXyEwWAhIWCMFWKhYtpASgSnObJFnU26dJ0= +go.opentelemetry.io/otel/metric v0.18.0 h1:yuZCmY9e1ZTaMlZXLrrbAPmYW6tW1A5ozOZeOYGaTaY= +go.opentelemetry.io/otel/metric v0.18.0/go.mod h1:kEH2QtzAyBy3xDVQfGZKIcok4ZZFvd5xyKPfPcuK6pE= go.opentelemetry.io/otel/oteltest v0.17.0 h1:TyAihUowTDLqb4+m5ePAsR71xPJaTBJl4KDArIdi9k4= go.opentelemetry.io/otel/oteltest v0.17.0/go.mod h1:JT/LGFxPwpN+nlsTiinSYjdIx3hZIGqHCpChcIZmdoE= +go.opentelemetry.io/otel/oteltest v0.18.0/go.mod h1:NyierCU3/G8DLTva7KRzGii2fdxdR89zXKH1bNWY7Bo= go.opentelemetry.io/otel/trace v0.17.0 h1:SBOj64/GAOyWzs5F680yW1ITIfJkm6cJWL2YAvuL9xY= go.opentelemetry.io/otel/trace v0.17.0/go.mod h1:bIujpqg6ZL6xUTubIUgziI1jSaUPthmabA/ygf/6Cfg= +go.opentelemetry.io/otel/trace v0.18.0 h1:ilCfc/fptVKaDMK1vWk0elxpolurJbEgey9J6g6s+wk= +go.opentelemetry.io/otel/trace v0.18.0/go.mod h1:FzdUu3BPwZSZebfQ1vl5/tAa8LyMLXSJN57AXIt/iDk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/options.go b/options.go index 7a020024..5d24d531 100644 --- a/options.go +++ b/options.go @@ -14,7 +14,7 @@ import ( "github.com/go-redis/redis/v8/internal" "github.com/go-redis/redis/v8/internal/pool" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" ) @@ -295,7 +295,7 @@ func newConnPool(opt *Options) *pool.ConnPool { var conn net.Conn err := internal.WithSpan(ctx, "redis.dial", func(ctx context.Context, span trace.Span) error { span.SetAttributes( - label.String("db.connection_string", opt.Addr), + attribute.String("db.connection_string", opt.Addr), ) var err error diff --git a/redis.go b/redis.go index 712579d4..3dfdb82a 100644 --- a/redis.go +++ b/redis.go @@ -10,7 +10,7 @@ import ( "github.com/go-redis/redis/v8/internal" "github.com/go-redis/redis/v8/internal/pool" "github.com/go-redis/redis/v8/internal/proto" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" ) @@ -296,7 +296,7 @@ func (c *baseClient) withConn( if span.IsRecording() { if remoteAddr := cn.RemoteAddr(); remoteAddr != nil { - span.SetAttributes(label.String("net.peer.ip", remoteAddr.String())) + span.SetAttributes(attribute.String("net.peer.ip", remoteAddr.String())) } }