From 5f4a773f97404f75e331b0b3b57158c32aca30e5 Mon Sep 17 00:00:00 2001 From: Sam Xie Date: Fri, 5 Mar 2021 11:20:32 +0800 Subject: [PATCH] Depend on OTel 0.18.0 --- .../database/sql/otelsql/config.go | 4 +-- .../database/sql/otelsql/config_test.go | 4 +-- .../database/sql/otelsql/conn_test.go | 8 ++--- .../database/sql/otelsql/example/go.mod | 8 ++--- .../database/sql/otelsql/example/go.sum | 32 +++++++++---------- instrumentation/database/sql/otelsql/go.mod | 8 ++--- instrumentation/database/sql/otelsql/go.sum | 16 +++++----- .../database/sql/otelsql/option.go | 4 +-- .../database/sql/otelsql/option_test.go | 12 +++---- .../database/sql/otelsql/sql_test.go | 14 ++++---- .../database/sql/otelsql/stmt_test.go | 6 ++-- .../database/sql/otelsql/tx_test.go | 4 +-- .../database/sql/otelsql/utils_test.go | 18 +++++------ 13 files changed, 69 insertions(+), 69 deletions(-) diff --git a/instrumentation/database/sql/otelsql/config.go b/instrumentation/database/sql/otelsql/config.go index ccb66b976dd..8a90e096871 100644 --- a/instrumentation/database/sql/otelsql/config.go +++ b/instrumentation/database/sql/otelsql/config.go @@ -18,7 +18,7 @@ import ( "context" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/semconv" "go.opentelemetry.io/otel/trace" @@ -43,7 +43,7 @@ type config struct { DBSystem string // Attributes will be set to each span. - Attributes []label.KeyValue + Attributes []attribute.KeyValue // SpanNameFormatter will be called to produce span's name. // Default use method as span name diff --git a/instrumentation/database/sql/otelsql/config_test.go b/instrumentation/database/sql/otelsql/config_test.go index 1224f247078..402736d6af7 100644 --- a/instrumentation/database/sql/otelsql/config_test.go +++ b/instrumentation/database/sql/otelsql/config_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/semconv" "go.opentelemetry.io/otel/trace" @@ -37,7 +37,7 @@ func TestNewConfig(t *testing.T) { ), SpanOptions: SpanOptions{Ping: true}, DBSystem: "db", - Attributes: []label.KeyValue{ + Attributes: []attribute.KeyValue{ semconv.DBSystemKey.String(cfg.DBSystem), }, SpanNameFormatter: &defaultSpanNameFormatter{}, diff --git a/instrumentation/database/sql/otelsql/conn_test.go b/instrumentation/database/sql/otelsql/conn_test.go index 6ee39ac1829..1e66bdafaea 100644 --- a/instrumentation/database/sql/otelsql/conn_test.go +++ b/instrumentation/database/sql/otelsql/conn_test.go @@ -23,8 +23,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/semconv" "go.opentelemetry.io/otel/trace" @@ -236,7 +236,7 @@ func TestOtConn_ExecContext(t *testing.T) { span := spanList[1] assert.True(t, span.Ended()) assert.Equal(t, trace.SpanKindClient, span.SpanKind()) - assert.Equal(t, attributesListToMap(append([]label.KeyValue{semconv.DBStatementKey.String("query")}, + assert.Equal(t, attributesListToMap(append([]attribute.KeyValue{semconv.DBStatementKey.String("query")}, cfg.Attributes...)), span.Attributes()) assert.Equal(t, string(MethodConnExec), span.Name()) assert.Equal(t, dummySpan.SpanContext().TraceID, span.SpanContext().TraceID) @@ -291,7 +291,7 @@ func TestOtConn_QueryContext(t *testing.T) { span := spanList[1] assert.True(t, span.Ended()) assert.Equal(t, trace.SpanKindClient, span.SpanKind()) - assert.Equal(t, attributesListToMap(append([]label.KeyValue{semconv.DBStatementKey.String("query")}, + assert.Equal(t, attributesListToMap(append([]attribute.KeyValue{semconv.DBStatementKey.String("query")}, cfg.Attributes...)), span.Attributes()) assert.Equal(t, string(MethodConnQuery), span.Name()) assert.Equal(t, dummySpan.SpanContext().TraceID, span.SpanContext().TraceID) @@ -352,7 +352,7 @@ func TestOtConn_PrepareContext(t *testing.T) { span := spanList[1] assert.True(t, span.Ended()) assert.Equal(t, trace.SpanKindClient, span.SpanKind()) - assert.Equal(t, attributesListToMap(append([]label.KeyValue{semconv.DBStatementKey.String("query")}, + assert.Equal(t, attributesListToMap(append([]attribute.KeyValue{semconv.DBStatementKey.String("query")}, cfg.Attributes...)), span.Attributes()) assert.Equal(t, string(MethodConnPrepare), span.Name()) assert.Equal(t, dummySpan.SpanContext().TraceID, span.SpanContext().TraceID) diff --git a/instrumentation/database/sql/otelsql/example/go.mod b/instrumentation/database/sql/otelsql/example/go.mod index 9a1428e74c7..dc0647cb2d5 100644 --- a/instrumentation/database/sql/otelsql/example/go.mod +++ b/instrumentation/database/sql/otelsql/example/go.mod @@ -9,8 +9,8 @@ replace ( require ( github.com/go-sql-driver/mysql v1.5.0 - go.opentelemetry.io/contrib/instrumentation/database/sql/otelsql v0.17.0 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/exporters/stdout v0.17.0 - go.opentelemetry.io/otel/sdk v0.17.0 + go.opentelemetry.io/contrib/instrumentation/database/sql/otelsql v0.18.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/exporters/stdout v0.18.0 + go.opentelemetry.io/otel/sdk v0.18.0 ) diff --git a/instrumentation/database/sql/otelsql/example/go.sum b/instrumentation/database/sql/otelsql/example/go.sum index 1f181128c75..35db35c5a8f 100644 --- a/instrumentation/database/sql/otelsql/example/go.sum +++ b/instrumentation/database/sql/otelsql/example/go.sum @@ -11,22 +11,22 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -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/exporters/stdout v0.17.0 h1:QfS/okW9h99eT7m20E9un/TDz+Q1woZADvAgUWR8YQI= -go.opentelemetry.io/otel/exporters/stdout v0.17.0/go.mod h1:NJ6kp8glOLKmXyjTM3I/ChQwUcE6rSdWd8AqGO/Av/w= -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/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/sdk v0.17.0 h1:eHXQwanmbtSHM/GcJYbJ8FyyH/sT9a0e+1Z9ZWkF7Ug= -go.opentelemetry.io/otel/sdk v0.17.0/go.mod h1:INs1PePjjF2hf842AXsxGTe5lH023QfLTZRFPiV/RUk= -go.opentelemetry.io/otel/sdk/export/metric v0.17.0 h1:RKOa26LDq4JBRwUnWwY64ccc27v1rA20z0q71aq4WFs= -go.opentelemetry.io/otel/sdk/export/metric v0.17.0/go.mod h1:G9SxRFvGmGpdmJ8TEXnTEnnRuR5p3cg/tRvWkA/XHvo= -go.opentelemetry.io/otel/sdk/metric v0.17.0 h1:l9W/OcHwyq3ZPqk4V6OS5ED50z9A6yI8N9gWeKS7zAY= -go.opentelemetry.io/otel/sdk/metric v0.17.0/go.mod h1:zAX55SrmDMpZwfQrz1PKIPbCP5beU+JPQTfNko01deo= -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 v0.18.0 h1:d5Of7+Zw4ANFOJB+TIn2K3QWsgS2Ht7OU9DqZHI6qu8= +go.opentelemetry.io/otel v0.18.0/go.mod h1:PT5zQj4lTsR1YeARt8YNKcFb88/c2IKoSABK9mX0r78= +go.opentelemetry.io/otel/exporters/stdout v0.18.0 h1:DnB3C9IdAa3/6LqbpBYmO2QqljsBj3Mr2oSpIMnXbCc= +go.opentelemetry.io/otel/exporters/stdout v0.18.0/go.mod h1:c4vRVKdmtlGOnPriMiPhLzVzdMzH/RlM2NJioEhm+so= +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.18.0 h1:FbKDFm/LnQDOHuGjED+fy3s5YMVg0z019GJ9Er66hYo= +go.opentelemetry.io/otel/oteltest v0.18.0/go.mod h1:NyierCU3/G8DLTva7KRzGii2fdxdR89zXKH1bNWY7Bo= +go.opentelemetry.io/otel/sdk v0.18.0 h1:/UiFHiJxJyEoUN2tQ6l+5f0/P01V0G9YuHeVarktRDw= +go.opentelemetry.io/otel/sdk v0.18.0/go.mod h1:nT+UdAeGQWSeTnz9vY8BBq7SEGpmWAetyo/xHUcQvxo= +go.opentelemetry.io/otel/sdk/export/metric v0.18.0 h1:0CP4KxCGeaVO2l69NNzRCULaaGiW6UGPDSF/b6gRqDs= +go.opentelemetry.io/otel/sdk/export/metric v0.18.0/go.mod h1:CFUAd+HdaQT3efTnVFYaXXp56b6bFUqkck4iRB9wu0g= +go.opentelemetry.io/otel/sdk/metric v0.18.0 h1:16ryqzWeYMl6uzwz7or3IQlCDf366Ppfm50215Mte5I= +go.opentelemetry.io/otel/sdk/metric v0.18.0/go.mod h1:NY9c56grMpjqdaYvOFon8nnsgMPBaXpde5SO1ulDyCo= +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/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/instrumentation/database/sql/otelsql/go.mod b/instrumentation/database/sql/otelsql/go.mod index fc3e0fbbb9e..df7c1b2b350 100644 --- a/instrumentation/database/sql/otelsql/go.mod +++ b/instrumentation/database/sql/otelsql/go.mod @@ -6,8 +6,8 @@ replace go.opentelemetry.io/contrib => ../../../../ require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/contrib v0.17.0 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/oteltest v0.17.0 - go.opentelemetry.io/otel/trace v0.17.0 + go.opentelemetry.io/contrib v0.18.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/oteltest v0.18.0 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/database/sql/otelsql/go.sum b/instrumentation/database/sql/otelsql/go.sum index 128831ced02..0b94559400b 100644 --- a/instrumentation/database/sql/otelsql/go.sum +++ b/instrumentation/database/sql/otelsql/go.sum @@ -7,14 +7,14 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -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/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/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/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 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.18.0 h1:yuZCmY9e1ZTaMlZXLrrbAPmYW6tW1A5ozOZeOYGaTaY= +go.opentelemetry.io/otel/metric v0.18.0/go.mod h1:kEH2QtzAyBy3xDVQfGZKIcok4ZZFvd5xyKPfPcuK6pE= +go.opentelemetry.io/otel/oteltest v0.18.0 h1:FbKDFm/LnQDOHuGjED+fy3s5YMVg0z019GJ9Er66hYo= +go.opentelemetry.io/otel/oteltest v0.18.0/go.mod h1:NyierCU3/G8DLTva7KRzGii2fdxdR89zXKH1bNWY7Bo= +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/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/instrumentation/database/sql/otelsql/option.go b/instrumentation/database/sql/otelsql/option.go index 91ca1facd5f..ebcd4ead56d 100644 --- a/instrumentation/database/sql/otelsql/option.go +++ b/instrumentation/database/sql/otelsql/option.go @@ -15,7 +15,7 @@ package otelsql import ( - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" ) @@ -43,7 +43,7 @@ func WithTracerProvider(provider trace.TracerProvider) Option { } // WithAttributes specifies attributes that will be set to each span. -func WithAttributes(attributes ...label.KeyValue) Option { +func WithAttributes(attributes ...attribute.KeyValue) Option { return OptionFunc(func(cfg *config) { cfg.Attributes = attributes }) diff --git a/instrumentation/database/sql/otelsql/option_test.go b/instrumentation/database/sql/otelsql/option_test.go index b47c3c1798d..876c5cd1424 100644 --- a/instrumentation/database/sql/otelsql/option_test.go +++ b/instrumentation/database/sql/otelsql/option_test.go @@ -19,7 +19,7 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/oteltest" ) @@ -39,12 +39,12 @@ func TestOptions(t *testing.T) { { name: "WithAttributes", option: WithAttributes( - label.String("foo", "bar"), - label.String("foo2", "bar2"), + attribute.String("foo", "bar"), + attribute.String("foo2", "bar2"), ), - expectedConfig: config{Attributes: []label.KeyValue{ - label.String("foo", "bar"), - label.String("foo2", "bar2"), + expectedConfig: config{Attributes: []attribute.KeyValue{ + attribute.String("foo", "bar"), + attribute.String("foo2", "bar2"), }}, }, { diff --git a/instrumentation/database/sql/otelsql/sql_test.go b/instrumentation/database/sql/otelsql/sql_test.go index 652fbef640e..680946cb1c0 100644 --- a/instrumentation/database/sql/otelsql/sql_test.go +++ b/instrumentation/database/sql/otelsql/sql_test.go @@ -21,7 +21,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/semconv" ) @@ -32,7 +32,7 @@ func init() { func TestRegister(t *testing.T) { driverName, err := Register("test-driver", "test-db", - WithAttributes(label.String("foo", "bar")), + WithAttributes(attribute.String("foo", "bar")), ) require.NoError(t, err) assert.Equal(t, "test-driver-otelsql-0", driverName) @@ -43,9 +43,9 @@ func TestRegister(t *testing.T) { otelDriver, ok := db.Driver().(*otDriver) require.True(t, ok) assert.Equal(t, &mockDriver{openConnectorCount: 2}, otelDriver.driver) - assert.ElementsMatch(t, []label.KeyValue{ + assert.ElementsMatch(t, []attribute.KeyValue{ semconv.DBSystemKey.String("test-db"), - label.String("foo", "bar"), + attribute.String("foo", "bar"), }, otelDriver.cfg.Attributes) // Exceed max slot count @@ -55,15 +55,15 @@ func TestRegister(t *testing.T) { func TestWrapDriver(t *testing.T) { driver := WrapDriver(newMockDriver(false), "test-db", - WithAttributes(label.String("foo", "bar")), + WithAttributes(attribute.String("foo", "bar")), ) // Expected driver otelDriver, ok := driver.(*otDriver) require.True(t, ok) assert.Equal(t, &mockDriver{}, otelDriver.driver) - assert.ElementsMatch(t, []label.KeyValue{ + assert.ElementsMatch(t, []attribute.KeyValue{ semconv.DBSystemKey.String("test-db"), - label.String("foo", "bar"), + attribute.String("foo", "bar"), }, otelDriver.cfg.Attributes) } diff --git a/instrumentation/database/sql/otelsql/stmt_test.go b/instrumentation/database/sql/otelsql/stmt_test.go index 0390a57e3a9..bf2ad021105 100644 --- a/instrumentation/database/sql/otelsql/stmt_test.go +++ b/instrumentation/database/sql/otelsql/stmt_test.go @@ -23,8 +23,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/semconv" "go.opentelemetry.io/otel/trace" ) @@ -110,7 +110,7 @@ func TestOtStmt_ExecContext(t *testing.T) { span := spanList[1] assert.True(t, span.Ended()) assert.Equal(t, trace.SpanKindClient, span.SpanKind()) - assert.Equal(t, attributesListToMap(append([]label.KeyValue{semconv.DBStatementKey.String("query")}, + assert.Equal(t, attributesListToMap(append([]attribute.KeyValue{semconv.DBStatementKey.String("query")}, cfg.Attributes...)), span.Attributes()) assert.Equal(t, string(MethodStmtExec), span.Name()) assert.Equal(t, dummySpan.SpanContext().TraceID, span.SpanContext().TraceID) @@ -163,7 +163,7 @@ func TestOtStmt_QueryContext(t *testing.T) { span := spanList[1] assert.True(t, span.Ended()) assert.Equal(t, trace.SpanKindClient, span.SpanKind()) - assert.Equal(t, attributesListToMap(append([]label.KeyValue{semconv.DBStatementKey.String("query")}, + assert.Equal(t, attributesListToMap(append([]attribute.KeyValue{semconv.DBStatementKey.String("query")}, cfg.Attributes...)), span.Attributes()) assert.Equal(t, string(MethodStmtQuery), span.Name()) assert.Equal(t, dummySpan.SpanContext().TraceID, span.SpanContext().TraceID) diff --git a/instrumentation/database/sql/otelsql/tx_test.go b/instrumentation/database/sql/otelsql/tx_test.go index 91424bdef00..d5d94cfc2e4 100644 --- a/instrumentation/database/sql/otelsql/tx_test.go +++ b/instrumentation/database/sql/otelsql/tx_test.go @@ -23,8 +23,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/trace" ) @@ -57,7 +57,7 @@ func (m *mockTx) Rollback() error { var _ driver.Tx = (*mockTx)(nil) -var defaultLabel = label.Key("test").String("foo") +var defaultattribute = attribute.Key("test").String("foo") func TestOtTx_Commit(t *testing.T) { testCases := []struct { diff --git a/instrumentation/database/sql/otelsql/utils_test.go b/instrumentation/database/sql/otelsql/utils_test.go index 30d0db2f3f4..1665ab430fd 100644 --- a/instrumentation/database/sql/otelsql/utils_test.go +++ b/instrumentation/database/sql/otelsql/utils_test.go @@ -22,8 +22,8 @@ import ( "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/trace" ) @@ -78,8 +78,8 @@ func TestRecordSpanError(t *testing.T) { } } -func newTracerProvider() (*oteltest.StandardSpanRecorder, *oteltest.TracerProvider) { - var sr oteltest.StandardSpanRecorder +func newTracerProvider() (*oteltest.SpanRecorder, *oteltest.TracerProvider) { + var sr oteltest.SpanRecorder provider := oteltest.NewTracerProvider( oteltest.WithSpanRecorder(&sr), ) @@ -95,16 +95,16 @@ func createDummySpan(ctx context.Context, tracer trace.Tracer) (context.Context, func newMockConfig(tracer trace.Tracer) config { return config{ Tracer: tracer, - Attributes: []label.KeyValue{defaultLabel}, + Attributes: []attribute.KeyValue{defaultattribute}, SpanNameFormatter: &defaultSpanNameFormatter{}, } } -func attributesListToMap(labels []label.KeyValue) map[label.Key]label.Value { - attributes := make(map[label.Key]label.Value) +func attributesListToMap(attributes []attribute.KeyValue) map[attribute.Key]attribute.Value { + attributesMap := make(map[attribute.Key]attribute.Value) - for _, v := range labels { - attributes[v.Key] = v.Value + for _, v := range attributes { + attributesMap[v.Key] = v.Value } - return attributes + return attributesMap }