From 839e505a67ca9fb5a3089cd1af5943061fcaf1ef Mon Sep 17 00:00:00 2001 From: Anthony Mirabella Date: Thu, 4 Mar 2021 19:39:40 -0500 Subject: [PATCH] Bumping otel version to v0.18.0. Prepare for releasing v0.18.0 (#600) * Bumping otel version to v0.18.0. Prepare for releasing v0.18.0 * Update CHANGELOG * Address review feedback --- CHANGELOG.md | 6 +- contrib.go | 2 +- detectors/aws/aws.go | 18 +- detectors/aws/aws_test.go | 4 +- detectors/aws/ecs/ecs.go | 6 +- detectors/aws/ecs/ecs_test.go | 6 +- detectors/aws/ecs/go.mod | 4 +- detectors/aws/ecs/go.sum | 20 +- detectors/aws/eks/detector.go | 14 +- detectors/aws/eks/detector_test.go | 4 +- detectors/aws/eks/go.mod | 4 +- detectors/aws/eks/go.sum | 20 +- detectors/aws/go.mod | 4 +- detectors/aws/go.sum | 20 +- detectors/gcp/cloud-run.go | 16 +- detectors/gcp/cloud-run_test.go | 14 +- detectors/gcp/gce.go | 18 +- detectors/gcp/gke.go | 12 +- detectors/gcp/go.mod | 4 +- detectors/gcp/go.sum | 20 +- exporters/metric/cortex/cortex.go | 60 +-- exporters/metric/cortex/cortex_test.go | 22 +- exporters/metric/cortex/example/go.mod | 12 +- exporters/metric/cortex/example/go.sum | 28 +- exporters/metric/cortex/example/main.go | 8 +- exporters/metric/cortex/go.mod | 10 +- exporters/metric/cortex/go.sum | 28 +- exporters/metric/cortex/utils/go.mod | 2 +- exporters/metric/cortex/utils/go.sum | 28 +- exporters/metric/datadog/datadog.go | 8 +- exporters/metric/datadog/example_test.go | 6 +- exporters/metric/datadog/go.mod | 8 +- exporters/metric/datadog/go.sum | 28 +- exporters/metric/dogstatsd/dogstatsd.go | 14 +- exporters/metric/dogstatsd/dogstatsd_test.go | 56 +-- exporters/metric/dogstatsd/example_test.go | 6 +- exporters/metric/dogstatsd/go.mod | 10 +- exporters/metric/dogstatsd/go.sum | 28 +- .../dogstatsd/internal/statsd/conn_test.go | 38 +- exporters/metric/dogstatsd/labels.go | 26 +- exporters/metric/dogstatsd/labels_test.go | 34 +- .../sarama/otelsarama/consumer_test.go | 24 +- .../Shopify/sarama/otelsarama/dispatcher.go | 6 +- .../Shopify/sarama/otelsarama/example/go.mod | 10 +- .../Shopify/sarama/otelsarama/example/go.sum | 32 +- .../Shopify/sarama/otelsarama/go.mod | 8 +- .../Shopify/sarama/otelsarama/go.sum | 16 +- .../Shopify/sarama/otelsarama/message.go | 18 + .../Shopify/sarama/otelsarama/message_test.go | 72 +++ .../Shopify/sarama/otelsarama/option.go | 4 +- .../Shopify/sarama/otelsarama/producer.go | 6 +- .../sarama/otelsarama/producer_test.go | 66 +-- .../astaxie/beego/otelbeego/beego_test.go | 34 +- .../astaxie/beego/otelbeego/common.go | 6 +- .../astaxie/beego/otelbeego/example/go.mod | 10 +- .../astaxie/beego/otelbeego/example/go.sum | 32 +- .../github.com/astaxie/beego/otelbeego/go.mod | 12 +- .../github.com/astaxie/beego/otelbeego/go.sum | 16 +- .../memcache/otelmemcache/attributes.go | 10 +- .../memcache/otelmemcache/example/go.mod | 8 +- .../memcache/otelmemcache/example/go.sum | 32 +- .../gomemcache/memcache/otelmemcache/go.mod | 8 +- .../gomemcache/memcache/otelmemcache/go.sum | 16 +- .../memcache/otelmemcache/gomemcache.go | 10 +- .../memcache/otelmemcache/gomemcache_test.go | 26 +- .../go-restful/otelrestful/example/go.mod | 10 +- .../go-restful/otelrestful/example/go.sum | 32 +- .../go-restful/otelrestful/example/server.go | 4 +- .../emicklei/go-restful/otelrestful/go.mod | 10 +- .../emicklei/go-restful/otelrestful/go.sum | 16 +- .../go-restful/otelrestful/restful.go | 3 +- .../go-restful/otelrestful/restful_test.go | 10 +- .../gin-gonic/gin/otelgin/example/go.mod | 10 +- .../gin-gonic/gin/otelgin/example/go.sum | 32 +- .../gin-gonic/gin/otelgin/example/server.go | 4 +- .../gin-gonic/gin/otelgin/gintrace.go | 9 +- .../gin-gonic/gin/otelgin/gintrace_test.go | 36 +- .../github.com/gin-gonic/gin/otelgin/go.mod | 10 +- .../github.com/gin-gonic/gin/otelgin/go.sum | 16 +- .../github.com/gocql/gocql/otelgocql/cass.go | 46 +- .../gocql/gocql/otelgocql/example/go.mod | 8 +- .../gocql/gocql/otelgocql/example/go.sum | 36 +- .../github.com/gocql/gocql/otelgocql/go.mod | 10 +- .../github.com/gocql/gocql/otelgocql/go.sum | 16 +- .../gocql/gocql/otelgocql/gocql_test.go | 38 +- .../gocql/gocql/otelgocql/observer.go | 8 +- .../gorilla/mux/otelmux/example/go.mod | 10 +- .../gorilla/mux/otelmux/example/go.sum | 32 +- .../gorilla/mux/otelmux/example/server.go | 4 +- .../github.com/gorilla/mux/otelmux/go.mod | 10 +- .../github.com/gorilla/mux/otelmux/go.sum | 16 +- .../github.com/gorilla/mux/otelmux/mux.go | 2 +- .../gorilla/mux/otelmux/mux_test.go | 32 +- .../github.com/labstack/echo/otelecho/echo.go | 7 +- .../labstack/echo/otelecho/echo_test.go | 32 +- .../labstack/echo/otelecho/example/go.mod | 10 +- .../labstack/echo/otelecho/example/go.sum | 32 +- .../labstack/echo/otelecho/example/server.go | 4 +- .../github.com/labstack/echo/otelecho/go.mod | 10 +- .../github.com/labstack/echo/otelecho/go.sum | 16 +- .../mongo-driver/mongo/otelmongo/db.go | 26 +- .../mongo-driver/mongo/otelmongo/go.mod | 8 +- .../mongo-driver/mongo/otelmongo/go.sum | 16 +- .../mongo-driver/mongo/otelmongo/mongo.go | 4 +- .../mongo/otelmongo/mongo_test.go | 2 +- .../mongo-driver/mongo/otelmongo/peer.go | 10 +- .../mongo-driver/mongo/otelmongo/tags.go | 26 +- .../grpc/otelgrpc/example/go.mod | 8 +- .../grpc/otelgrpc/example/go.sum | 32 +- .../google.golang.org/grpc/otelgrpc/go.mod | 8 +- .../google.golang.org/grpc/otelgrpc/go.sum | 16 +- .../grpc/otelgrpc/grpc_test.go | 434 +++++++++--------- .../grpc/otelgrpc/grpctrace.go | 21 +- .../grpc/otelgrpc/interceptor.go | 30 +- .../grpc/otelgrpc/interceptor_test.go | 274 ++++++----- .../macaron.v1/otelmacaron/example/go.mod | 10 +- .../macaron.v1/otelmacaron/example/go.sum | 32 +- .../macaron.v1/otelmacaron/example/server.go | 4 +- .../gopkg.in/macaron.v1/otelmacaron/go.mod | 10 +- .../gopkg.in/macaron.v1/otelmacaron/go.sum | 16 +- .../macaron.v1/otelmacaron/macaron.go | 3 +- .../macaron.v1/otelmacaron/macaron_test.go | 28 +- instrumentation/host/doc.go | 4 +- instrumentation/host/example/go.mod | 6 +- instrumentation/host/example/go.sum | 32 +- instrumentation/host/go.mod | 8 +- instrumentation/host/go.sum | 16 +- instrumentation/host/host.go | 58 +-- instrumentation/host/host_test.go | 30 +- .../httptrace/otelhttptrace/clienttrace.go | 16 +- .../otelhttptrace/clienttrace_test.go | 110 ++--- .../otelhttptrace/example/client/client.go | 4 +- .../httptrace/otelhttptrace/example/go.mod | 12 +- .../httptrace/otelhttptrace/example/go.sum | 32 +- .../otelhttptrace/example/server/server.go | 4 +- .../net/http/httptrace/otelhttptrace/go.mod | 8 +- .../net/http/httptrace/otelhttptrace/go.sum | 16 +- .../http/httptrace/otelhttptrace/httptrace.go | 12 +- .../httptrace/otelhttptrace/httptrace_test.go | 20 +- .../net/http/otelhttp/client_test.go | 2 +- instrumentation/net/http/otelhttp/common.go | 10 +- .../net/http/otelhttp/config_test.go | 4 +- .../http/otelhttp/example/client/client.go | 4 +- .../net/http/otelhttp/example/go.mod | 10 +- .../net/http/otelhttp/example/go.sum | 32 +- .../http/otelhttp/example/server/server.go | 4 +- instrumentation/net/http/otelhttp/go.mod | 10 +- instrumentation/net/http/otelhttp/go.sum | 16 +- instrumentation/net/http/otelhttp/handler.go | 28 +- .../net/http/otelhttp/handler_example_test.go | 10 +- .../net/http/otelhttp/handler_test.go | 16 +- instrumentation/net/http/otelhttp/labeler.go | 24 +- .../net/http/otelhttp/transport.go | 2 +- .../net/http/otelhttp/transport_test.go | 2 +- instrumentation/net/http/otelhttp/wrap.go | 2 +- instrumentation/runtime/example/go.mod | 6 +- instrumentation/runtime/example/go.sum | 32 +- instrumentation/runtime/go.mod | 8 +- instrumentation/runtime/go.sum | 16 +- propagators/aws/go.mod | 6 +- propagators/aws/go.sum | 20 +- propagators/b3/b3_benchmark_test.go | 5 +- propagators/b3/b3_integration_test.go | 5 +- propagators/go.mod | 6 +- propagators/go.sum | 16 +- propagators/jaeger/jaeger_integration_test.go | 5 +- propagators/opencensus/binary_test.go | 5 +- propagators/opencensus/examples/go.mod | 10 +- propagators/opencensus/examples/go.sum | 36 +- propagators/opencensus/go.mod | 8 +- propagators/opencensus/go.sum | 20 +- propagators/ot/ot_data_test.go | 20 +- propagators/ot/ot_integration_test.go | 13 +- propagators/ot/ot_propagator.go | 4 +- 174 files changed, 1835 insertions(+), 1727 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f31b049836f..99970c855b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [0.18.0] - 2021-03-04 + ### Fixed - `otelmemcache` no longer sets span status to OK instead of leaving it unset. (#477) +- Fix goroutine leak in gRPC `StreamClientInterceptor`. (#581) ### Removed @@ -281,7 +284,8 @@ First official tagged release of `contrib` repository. - Prefix support for dogstatsd (#34) - Update Go Runtime package to use batch observer (#44) -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go-contrib/compare/v0.17.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go-contrib/compare/v0.18.0...HEAD +[0.18.0]: https://github.com/open-telemetry/opentelemetry-go-contrib/releases/tag/v0.18.0 [0.17.0]: https://github.com/open-telemetry/opentelemetry-go-contrib/releases/tag/v0.17.0 [0.16.0]: https://github.com/open-telemetry/opentelemetry-go-contrib/releases/tag/v0.16.0 [0.15.1]: https://github.com/open-telemetry/opentelemetry-go-contrib/releases/tag/v0.15.1 diff --git a/contrib.go b/contrib.go index 7e95f992a29..2758ce7a852 100644 --- a/contrib.go +++ b/contrib.go @@ -18,7 +18,7 @@ package contrib // import "go.opentelemetry.io/contrib" // Version is the current release version of OpenTelemetry Contrib in use. func Version() string { - return "0.17.0" + return "0.18.0" // This string is updated by the pre_release.sh script during release } diff --git a/detectors/aws/aws.go b/detectors/aws/aws.go index 204dd820ce0..e2c87b0afaa 100644 --- a/detectors/aws/aws.go +++ b/detectors/aws/aws.go @@ -23,7 +23,7 @@ import ( "github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/session" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/semconv" ) @@ -58,7 +58,7 @@ func (aws *AWS) Detect(ctx context.Context) (*resource.Resource, error) { return nil, err } - labels := []label.KeyValue{ + attributes := []attribute.KeyValue{ semconv.CloudProviderAWS, semconv.CloudRegionKey.String(doc.Region), semconv.CloudZoneKey.String(doc.AvailabilityZone), @@ -71,13 +71,13 @@ func (aws *AWS) Detect(ctx context.Context) (*resource.Resource, error) { m := &metadata{client: client} m.add(semconv.HostNameKey, "hostname") - labels = append(labels, m.labels...) + attributes = append(attributes, m.attributes...) if len(m.errs) > 0 { err = fmt.Errorf("%w: %s", resource.ErrPartialResource, m.errs) } - return resource.NewWithAttributes(labels...), err + return resource.NewWithAttributes(attributes...), err } func (aws *AWS) client() (client, error) { @@ -94,15 +94,15 @@ func (aws *AWS) client() (client, error) { } type metadata struct { - client client - errs []error - labels []label.KeyValue + client client + errs []error + attributes []attribute.KeyValue } -func (m *metadata) add(k label.Key, n string) { +func (m *metadata) add(k attribute.Key, n string) { v, err := m.client.GetMetadata(n) if err == nil { - m.labels = append(m.labels, k.String(v)) + m.attributes = append(m.attributes, k.String(v)) return } diff --git a/detectors/aws/aws_test.go b/detectors/aws/aws_test.go index 4c7d5a0ab98..d81b9b8bb80 100644 --- a/detectors/aws/aws_test.go +++ b/detectors/aws/aws_test.go @@ -26,7 +26,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/sdk/resource" "go.opentelemetry.io/otel/semconv" ) @@ -61,7 +61,7 @@ func TestAWS_Detect(t *testing.T) { return doc, nil } - usWestIDLabels := []label.KeyValue{ + usWestIDLabels := []attribute.KeyValue{ semconv.CloudProviderAWS, semconv.CloudRegionKey.String("us-west-2"), semconv.CloudZoneKey.String("us-west-2b"), diff --git a/detectors/aws/ecs/ecs.go b/detectors/aws/ecs/ecs.go index 2e21bb080b0..93c0537addb 100644 --- a/detectors/aws/ecs/ecs.go +++ b/detectors/aws/ecs/ecs.go @@ -21,7 +21,7 @@ import ( "os" "strings" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/semconv" ) @@ -83,12 +83,12 @@ func (detector *resourceDetector) Detect(ctx context.Context) (*resource.Resourc if err != nil { return empty, err } - labels := []label.KeyValue{ + attributes := []attribute.KeyValue{ semconv.ContainerNameKey.String(hostName), semconv.ContainerIDKey.String(containerID), } - return resource.NewWithAttributes(labels...), nil + return resource.NewWithAttributes(attributes...), nil } // returns docker container ID from default c group path diff --git a/detectors/aws/ecs/ecs_test.go b/detectors/aws/ecs/ecs_test.go index 408b390acbf..ac18377610b 100644 --- a/detectors/aws/ecs/ecs_test.go +++ b/detectors/aws/ecs/ecs_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/semconv" ) @@ -53,11 +53,11 @@ func TestDetect(t *testing.T) { detectorUtils.On("getContainerName").Return("container-Name", nil) detectorUtils.On("getContainerID").Return("0123456789A", nil) - labels := []label.KeyValue{ + attributes := []attribute.KeyValue{ semconv.ContainerNameKey.String("container-Name"), semconv.ContainerIDKey.String("0123456789A"), } - expectedResource := resource.NewWithAttributes(labels...) + expectedResource := resource.NewWithAttributes(attributes...) detector := &resourceDetector{utils: detectorUtils} res, _ := detector.Detect(context.Background()) diff --git a/detectors/aws/ecs/go.mod b/detectors/aws/ecs/go.mod index 34452dddd01..ad410e50dc5 100644 --- a/detectors/aws/ecs/go.mod +++ b/detectors/aws/ecs/go.mod @@ -4,6 +4,6 @@ go 1.15 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/sdk v0.17.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/sdk v0.18.0 ) diff --git a/detectors/aws/ecs/go.sum b/detectors/aws/ecs/go.sum index a5941df7846..4f0c5be5223 100644 --- a/detectors/aws/ecs/go.sum +++ b/detectors/aws/ecs/go.sum @@ -8,16 +8,16 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/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/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/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/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/detectors/aws/eks/detector.go b/detectors/aws/eks/detector.go index 4a67478bd85..35df4b42f06 100644 --- a/detectors/aws/eks/detector.go +++ b/detectors/aws/eks/detector.go @@ -27,7 +27,7 @@ import ( "strings" "time" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/semconv" ) @@ -88,28 +88,28 @@ func (detector *resourceDetector) Detect(ctx context.Context) (*resource.Resourc } // Create variable to hold resource attributes - labels := []label.KeyValue{} + attributes := []attribute.KeyValue{} - // Get clusterName and append to labels + // Get clusterName and append to attributes clusterName, err := getClusterName(detector.utils) if err != nil { return nil, err } if clusterName != "" { - labels = append(labels, semconv.K8SClusterNameKey.String(clusterName)) + attributes = append(attributes, semconv.K8SClusterNameKey.String(clusterName)) } - // Get containerID and append to labels + // Get containerID and append to attributes containerID, err := detector.utils.getContainerID() if err != nil { return nil, err } if containerID != "" { - labels = append(labels, semconv.ContainerIDKey.String(containerID)) + attributes = append(attributes, semconv.ContainerIDKey.String(containerID)) } // Return new resource object with clusterName and containerID as attributes - return resource.NewWithAttributes(labels...), nil + return resource.NewWithAttributes(attributes...), nil } diff --git a/detectors/aws/eks/detector_test.go b/detectors/aws/eks/detector_test.go index aab5737e480..947a3669423 100644 --- a/detectors/aws/eks/detector_test.go +++ b/detectors/aws/eks/detector_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/semconv" ) @@ -62,7 +62,7 @@ func TestEks(t *testing.T) { detectorUtils.On("getContainerID").Return("0123456789A", nil) // Expected resource object - eksResourceLabels := []label.KeyValue{ + eksResourceLabels := []attribute.KeyValue{ semconv.K8SClusterNameKey.String("my-cluster"), semconv.ContainerIDKey.String("0123456789A"), } diff --git a/detectors/aws/eks/go.mod b/detectors/aws/eks/go.mod index 1cf84084ec5..f2f601accec 100644 --- a/detectors/aws/eks/go.mod +++ b/detectors/aws/eks/go.mod @@ -4,6 +4,6 @@ go 1.15 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/sdk v0.17.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/sdk v0.18.0 ) diff --git a/detectors/aws/eks/go.sum b/detectors/aws/eks/go.sum index a5941df7846..4f0c5be5223 100644 --- a/detectors/aws/eks/go.sum +++ b/detectors/aws/eks/go.sum @@ -8,16 +8,16 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/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/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/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/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/detectors/aws/go.mod b/detectors/aws/go.mod index 90ffd431e2f..ffef37db8d4 100644 --- a/detectors/aws/go.mod +++ b/detectors/aws/go.mod @@ -5,6 +5,6 @@ go 1.14 require ( github.com/aws/aws-sdk-go v1.37.20 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/sdk v0.17.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/sdk v0.18.0 ) diff --git a/detectors/aws/go.sum b/detectors/aws/go.sum index 8858d289142..fa3a5ba67fb 100644 --- a/detectors/aws/go.sum +++ b/detectors/aws/go.sum @@ -15,16 +15,16 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/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/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/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/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-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= diff --git a/detectors/gcp/cloud-run.go b/detectors/gcp/cloud-run.go index f80e70d5c1f..5b1d4555986 100644 --- a/detectors/gcp/cloud-run.go +++ b/detectors/gcp/cloud-run.go @@ -21,7 +21,7 @@ import ( "cloud.google.com/go/compute/metadata" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/semconv" ) @@ -57,7 +57,7 @@ func NewCloudRun() *CloudRun { } // Detect detects associated resources when running on Cloud Run hosts. -// NOTE: the service.namespace label is currently hardcoded to be +// NOTE: the service.namespace attribute is currently hardcoded to be // "cloud-run-managed". This may change in the future, please do not rely on // this behavior yet. func (c *CloudRun) Detect(ctx context.Context) (*resource.Resource, error) { @@ -67,7 +67,7 @@ func (c *CloudRun) Detect(ctx context.Context) (*resource.Resource, error) { return nil, nil } - labels := []label.KeyValue{ + attributes := []attribute.KeyValue{ semconv.CloudProviderGCP, semconv.ServiceNamespaceKey.String(serviceNamespace), } @@ -77,19 +77,19 @@ func (c *CloudRun) Detect(ctx context.Context) (*resource.Resource, error) { if projectID, err := c.mc.ProjectID(); hasProblem(err) { errInfo = append(errInfo, err.Error()) } else if projectID != "" { - labels = append(labels, semconv.CloudAccountIDKey.String(projectID)) + attributes = append(attributes, semconv.CloudAccountIDKey.String(projectID)) } if region, err := c.mc.Get("instance/region"); hasProblem(err) { errInfo = append(errInfo, err.Error()) } else if region != "" { - labels = append(labels, semconv.CloudRegionKey.String(region)) + attributes = append(attributes, semconv.CloudRegionKey.String(region)) } if instanceID, err := c.mc.InstanceID(); hasProblem(err) { errInfo = append(errInfo, err.Error()) } else if instanceID != "" { - labels = append(labels, semconv.ServiceInstanceIDKey.String(instanceID)) + attributes = append(attributes, semconv.ServiceInstanceIDKey.String(instanceID)) } // Part of Cloud Run container runtime contract. @@ -97,9 +97,9 @@ func (c *CloudRun) Detect(ctx context.Context) (*resource.Resource, error) { if service := c.getenv("K_SERVICE"); service == "" { errInfo = append(errInfo, "envvar K_SERVICE contains empty string.") } else { - labels = append(labels, semconv.ServiceNameKey.String(service)) + attributes = append(attributes, semconv.ServiceNameKey.String(service)) } - resource, err := resource.New(ctx, resource.WithAttributes(labels...)) + resource, err := resource.New(ctx, resource.WithAttributes(attributes...)) if err != nil { errInfo = append(errInfo, err.Error()) } diff --git a/detectors/gcp/cloud-run_test.go b/detectors/gcp/cloud-run_test.go index 8ff1e00e054..d8abcc3b9c3 100644 --- a/detectors/gcp/cloud-run_test.go +++ b/detectors/gcp/cloud-run_test.go @@ -21,7 +21,7 @@ import ( "github.com/google/go-cmp/cmp" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" ) @@ -93,12 +93,12 @@ func TestCloudRunDetectorExpectSuccess(t *testing.T) { want, err := resource.New( ctx, resource.WithAttributes( - label.String("cloud.account.id", "foo"), - label.String("cloud.provider", "gcp"), - label.String("cloud.region", "utopia"), - label.String("service.instance.id", "bar"), - label.String("service.name", "x-service"), - label.String("service.namespace", "cloud-run-managed"), + attribute.String("cloud.account.id", "foo"), + attribute.String("cloud.provider", "gcp"), + attribute.String("cloud.region", "utopia"), + attribute.String("service.instance.id", "bar"), + attribute.String("service.name", "x-service"), + attribute.String("service.namespace", "cloud-run-managed"), ), ) if err != nil { diff --git a/detectors/gcp/gce.go b/detectors/gcp/gce.go index f5a699736bf..727c92df893 100644 --- a/detectors/gcp/gce.go +++ b/detectors/gcp/gce.go @@ -22,7 +22,7 @@ import ( "cloud.google.com/go/compute/metadata" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/semconv" ) @@ -39,7 +39,7 @@ func (gce *GCE) Detect(ctx context.Context) (*resource.Resource, error) { return nil, nil } - labels := []label.KeyValue{ + attributes := []attribute.KeyValue{ semconv.CloudProviderGCP, } @@ -48,13 +48,13 @@ func (gce *GCE) Detect(ctx context.Context) (*resource.Resource, error) { if projectID, err := metadata.ProjectID(); hasProblem(err) { errInfo = append(errInfo, err.Error()) } else if projectID != "" { - labels = append(labels, semconv.CloudAccountIDKey.String(projectID)) + attributes = append(attributes, semconv.CloudAccountIDKey.String(projectID)) } if zone, err := metadata.Zone(); hasProblem(err) { errInfo = append(errInfo, err.Error()) } else if zone != "" { - labels = append(labels, semconv.CloudZoneKey.String(zone)) + attributes = append(attributes, semconv.CloudZoneKey.String(zone)) splitArr := strings.SplitN(zone, "-", 3) if len(splitArr) == 3 { @@ -65,25 +65,25 @@ func (gce *GCE) Detect(ctx context.Context) (*resource.Resource, error) { if instanceID, err := metadata.InstanceID(); hasProblem(err) { errInfo = append(errInfo, err.Error()) } else if instanceID != "" { - labels = append(labels, semconv.HostIDKey.String(instanceID)) + attributes = append(attributes, semconv.HostIDKey.String(instanceID)) } if name, err := metadata.InstanceName(); hasProblem(err) { errInfo = append(errInfo, err.Error()) } else if name != "" { - labels = append(labels, semconv.HostNameKey.String(name)) + attributes = append(attributes, semconv.HostNameKey.String(name)) } if hostname, err := os.Hostname(); hasProblem(err) { errInfo = append(errInfo, err.Error()) } else if hostname != "" { - labels = append(labels, semconv.HostNameKey.String(hostname)) + attributes = append(attributes, semconv.HostNameKey.String(hostname)) } if hostType, err := metadata.Get("instance/machine-type"); hasProblem(err) { errInfo = append(errInfo, err.Error()) } else if hostType != "" { - labels = append(labels, semconv.HostTypeKey.String(hostType)) + attributes = append(attributes, semconv.HostTypeKey.String(hostType)) } var aggregatedErr error @@ -91,7 +91,7 @@ func (gce *GCE) Detect(ctx context.Context) (*resource.Resource, error) { aggregatedErr = fmt.Errorf("detecting GCE resources: %s", errInfo) } - return resource.NewWithAttributes(labels...), aggregatedErr + return resource.NewWithAttributes(attributes...), aggregatedErr } // hasProblem checks if the err is not nil or for missing resources diff --git a/detectors/gcp/gke.go b/detectors/gcp/gke.go index 012f97b0af2..056ecc45d59 100644 --- a/detectors/gcp/gke.go +++ b/detectors/gcp/gke.go @@ -21,7 +21,7 @@ import ( "cloud.google.com/go/compute/metadata" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/semconv" ) @@ -46,26 +46,26 @@ func (gke *GKE) Detect(ctx context.Context) (*resource.Resource, error) { errInfo = append(errInfo, err.Error()) } - labels := []label.KeyValue{ + attributes := []attribute.KeyValue{ semconv.K8SNamespaceNameKey.String(os.Getenv("NAMESPACE")), semconv.K8SPodNameKey.String(os.Getenv("HOSTNAME")), } if containerName := os.Getenv("CONTAINER_NAME"); containerName != "" { - labels = append(labels, semconv.ContainerNameKey.String(containerName)) + attributes = append(attributes, semconv.ContainerNameKey.String(containerName)) } if clusterName, err := metadata.InstanceAttributeValue("cluster-name"); hasProblem(err) { errInfo = append(errInfo, err.Error()) } else if clusterName != "" { - labels = append(labels, semconv.K8SClusterNameKey.String(clusterName)) + attributes = append(attributes, semconv.K8SClusterNameKey.String(clusterName)) } - k8sLabelRes := resource.NewWithAttributes(labels...) + k8sattributeRes := resource.NewWithAttributes(attributes...) var aggregatedErr error if len(errInfo) > 0 { aggregatedErr = fmt.Errorf("detecting GKE resources: %s", errInfo) } - return resource.Merge(gceLablRes, k8sLabelRes), aggregatedErr + return resource.Merge(gceLablRes, k8sattributeRes), aggregatedErr } diff --git a/detectors/gcp/go.mod b/detectors/gcp/go.mod index e3f2c2460d1..566c7a7b0af 100644 --- a/detectors/gcp/go.mod +++ b/detectors/gcp/go.mod @@ -5,6 +5,6 @@ go 1.14 require ( cloud.google.com/go v0.78.0 github.com/google/go-cmp v0.5.4 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/sdk v0.17.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/sdk v0.18.0 ) diff --git a/detectors/gcp/go.sum b/detectors/gcp/go.sum index e9b8f8a44db..f25b563771c 100644 --- a/detectors/gcp/go.sum +++ b/detectors/gcp/go.sum @@ -149,16 +149,16 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -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/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/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/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/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-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/metric/cortex/cortex.go b/exporters/metric/cortex/cortex.go index 93c46d36cf4..0bedf70c961 100644 --- a/exporters/metric/cortex/cortex.go +++ b/exporters/metric/cortex/cortex.go @@ -27,7 +27,7 @@ import ( "github.com/golang/snappy" "github.com/prometheus/prometheus/prompb" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" apimetric "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/number" @@ -177,18 +177,18 @@ func (e *Exporter) ConvertToTimeSeries(checkpointSet export.CheckpointSet) ([]*p return timeSeries, nil } -// createTimeSeries is a helper function to create a timeseries from a value and labels -func createTimeSeries(record metric.Record, value number.Number, valueNumberKind number.Kind, extraLabels ...label.KeyValue) *prompb.TimeSeries { +// createTimeSeries is a helper function to create a timeseries from a value and attributes +func createTimeSeries(record metric.Record, value number.Number, valueNumberKind number.Kind, extraAttributes ...attribute.KeyValue) *prompb.TimeSeries { sample := prompb.Sample{ Value: value.CoerceToFloat64(valueNumberKind), Timestamp: int64(time.Nanosecond) * record.EndTime().UnixNano() / int64(time.Millisecond), } - labels := createLabelSet(record, extraLabels...) + attributes := createLabelSet(record, extraAttributes...) return &prompb.TimeSeries{ Samples: []prompb.Sample{sample}, - Labels: labels, + Labels: attributes, } } @@ -200,11 +200,11 @@ func convertFromSum(record metric.Record, sum aggregation.Sum) (*prompb.TimeSeri return nil, err } - // Create TimeSeries. Note that Cortex requires the name label to be in the format + // Create TimeSeries. Note that Cortex requires the name attribute to be in the format // "__name__". This is the case for all time series created by this exporter. name := sanitize(record.Descriptor().Name()) numberKind := record.Descriptor().NumberKind() - tSeries := createTimeSeries(record, value, numberKind, label.String("__name__", name)) + tSeries := createTimeSeries(record, value, numberKind, attribute.String("__name__", name)) return tSeries, nil } @@ -220,7 +220,7 @@ func convertFromLastValue(record metric.Record, lastValue aggregation.LastValue) // Create TimeSeries name := sanitize(record.Descriptor().Name()) numberKind := record.Descriptor().NumberKind() - tSeries := createTimeSeries(record, value, numberKind, label.String("__name__", name)) + tSeries := createTimeSeries(record, value, numberKind, attribute.String("__name__", name)) return tSeries, nil } @@ -235,7 +235,7 @@ func convertFromMinMaxSumCount(record metric.Record, minMaxSumCount aggregation. return nil, err } name := sanitize(record.Descriptor().Name() + "_min") - minTimeSeries := createTimeSeries(record, min, numberKind, label.String("__name__", name)) + minTimeSeries := createTimeSeries(record, min, numberKind, attribute.String("__name__", name)) // Convert Max max, err := minMaxSumCount.Max() @@ -243,7 +243,7 @@ func convertFromMinMaxSumCount(record metric.Record, minMaxSumCount aggregation. return nil, err } name = sanitize(record.Descriptor().Name() + "_max") - maxTimeSeries := createTimeSeries(record, max, numberKind, label.String("__name__", name)) + maxTimeSeries := createTimeSeries(record, max, numberKind, attribute.String("__name__", name)) // Convert Count count, err := minMaxSumCount.Count() @@ -251,7 +251,7 @@ func convertFromMinMaxSumCount(record metric.Record, minMaxSumCount aggregation. return nil, err } name = sanitize(record.Descriptor().Name() + "_count") - countTimeSeries := createTimeSeries(record, number.NewInt64Number(int64(count)), number.Int64Kind, label.String("__name__", name)) + countTimeSeries := createTimeSeries(record, number.NewInt64Number(int64(count)), number.Int64Kind, attribute.String("__name__", name)) // Return all timeSeries tSeries := []*prompb.TimeSeries{ @@ -272,7 +272,7 @@ func convertFromHistogram(record metric.Record, histogram aggregation.Histogram) if err != nil { return nil, err } - sumTimeSeries := createTimeSeries(record, sum, numberKind, label.String("__name__", metricName+"_sum")) + sumTimeSeries := createTimeSeries(record, sum, numberKind, attribute.String("__name__", metricName+"_sum")) timeSeries = append(timeSeries, sumTimeSeries) // Handle Histogram buckets @@ -290,11 +290,11 @@ func convertFromHistogram(record metric.Record, histogram aggregation.Histogram) totalCount += float64(buckets.Counts[i]) counts[boundary] = totalCount - // Add upper boundary as a label. e.g. {le="5"} + // Add upper boundary as a attribute. e.g. {le="5"} boundaryStr := strconv.FormatFloat(boundary, 'f', -1, 64) // Create timeSeries and append - boundaryTimeSeries := createTimeSeries(record, number.NewFloat64Number(totalCount), number.Float64Kind, label.String("__name__", metricName), label.String("le", boundaryStr)) + boundaryTimeSeries := createTimeSeries(record, number.NewFloat64Number(totalCount), number.Float64Kind, attribute.String("__name__", metricName), attribute.String("le", boundaryStr)) timeSeries = append(timeSeries, boundaryTimeSeries) } @@ -304,9 +304,9 @@ func convertFromHistogram(record metric.Record, histogram aggregation.Histogram) // Create a timeSeries for the +inf bucket and total count // These are the same and are both required by Prometheus-based backends - upperBoundTimeSeries := createTimeSeries(record, number.NewFloat64Number(totalCount), number.Float64Kind, label.String("__name__", metricName), label.String("le", "+inf")) + upperBoundTimeSeries := createTimeSeries(record, number.NewFloat64Number(totalCount), number.Float64Kind, attribute.String("__name__", metricName), attribute.String("le", "+inf")) - countTimeSeries := createTimeSeries(record, number.NewFloat64Number(totalCount), number.Float64Kind, label.String("__name__", metricName+"_count")) + countTimeSeries := createTimeSeries(record, number.NewFloat64Number(totalCount), number.Float64Kind, attribute.String("__name__", metricName+"_count")) timeSeries = append(timeSeries, upperBoundTimeSeries) timeSeries = append(timeSeries, countTimeSeries) @@ -314,34 +314,34 @@ func convertFromHistogram(record metric.Record, histogram aggregation.Histogram) return timeSeries, nil } -// createLabelSet combines labels from a Record, resource, and extra labels to create a +// createLabelSet combines attributes from a Record, resource, and extra attributes to create a // slice of prompb.Label. -func createLabelSet(record metric.Record, extraLabels ...label.KeyValue) []*prompb.Label { +func createLabelSet(record metric.Record, extraAttributes ...attribute.KeyValue) []*prompb.Label { // Map ensure no duplicate label names. labelMap := map[string]prompb.Label{} - // mergeLabels merges Record and Resource labels into a single set, giving precedence - // to the record's labels. - mi := label.NewMergeIterator(record.Labels(), record.Resource().LabelSet()) + // mergeAttributes merges Record and Resource attributes into a single set, giving precedence + // to the record's attributes. + mi := attribute.NewMergeIterator(record.Labels(), record.Resource().LabelSet()) for mi.Next() { - label := mi.Label() - key := string(label.Key) + attribute := mi.Label() + key := string(attribute.Key) labelMap[key] = prompb.Label{ Name: sanitize(key), - Value: label.Value.Emit(), + Value: attribute.Value.Emit(), } } - // Add extra labels created by the exporter like the metric name or labels to + // Add extra attributes created by the exporter like the metric name or attributes to // represent histogram buckets. - for _, label := range extraLabels { - // Ensure label doesn't exist. If it does, notify user that a user created label + for _, attribute := range extraAttributes { + // Ensure attribute doesn't exist. If it does, notify user that a user created attribute // is being overwritten by a Prometheus reserved label (e.g. 'le' for histograms) - key := string(label.Key) - value := label.Value.AsString() + key := string(attribute.Key) + value := attribute.Value.AsString() _, found := labelMap[key] if found { - log.Printf("Label %s is overwritten. Check if Prometheus reserved labels are used.\n", key) + log.Printf("Attribute %s is overwritten. Check if Prometheus reserved labels are used.\n", key) } labelMap[key] = prompb.Label{ Name: key, diff --git a/exporters/metric/cortex/cortex_test.go b/exporters/metric/cortex/cortex_test.go index c05aaea139b..fd5bc660013 100644 --- a/exporters/metric/cortex/cortex_test.go +++ b/exporters/metric/cortex/cortex_test.go @@ -30,7 +30,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/metric/global" "go.opentelemetry.io/otel/sdk/export/metric" export "go.opentelemetry.io/otel/sdk/export/metric" @@ -66,7 +66,7 @@ var validConfig = Config{ Quantiles: []float64{0, 0.25, 0.5, 0.75, 1}, } -var testResource = resource.NewWithAttributes(label.String("R", "V")) +var testResource = resource.NewWithAttributes(attribute.String("R", "V")) var mockTime int64 = int64(time.Nanosecond) * time.Time{}.UnixNano() / int64(time.Millisecond) func TestExportKindFor(t *testing.T) { @@ -131,20 +131,20 @@ func TestConvertToTimeSeries(t *testing.T) { // The TimeSeries cannot be compared easily using assert.ElementsMatch or // cmp.Equal since both the ordering of the timeseries and the ordering of the - // labels inside each timeseries can change. To get around this, all the - // labels and samples are added to maps first. There aren't many labels or + // attributes inside each timeseries can change. To get around this, all the + // attributes and samples are added to maps first. There aren't many attributes or // samples, so this nested loop shouldn't be a bottleneck. - gotLabels := make(map[string]bool) - wantLabels := make(map[string]bool) + gotAttributes := make(map[string]bool) + wantAttributes := make(map[string]bool) gotSamples := make(map[string]bool) wantSamples := make(map[string]bool) for i := 0; i < len(got); i++ { - for _, label := range got[i].Labels { - gotLabels[label.String()] = true + for _, attribute := range got[i].Labels { + gotAttributes[attribute.String()] = true } - for _, label := range want[i].Labels { - wantLabels[label.String()] = true + for _, attribute := range want[i].Labels { + wantAttributes[attribute.String()] = true } for _, sample := range got[i].Samples { gotSamples[sample.String()] = true @@ -153,7 +153,7 @@ func TestConvertToTimeSeries(t *testing.T) { wantSamples[sample.String()] = true } } - assert.Equal(t, wantLabels, gotLabels) + assert.Equal(t, wantAttributes, gotAttributes) assert.Equal(t, wantSamples, gotSamples) }) } diff --git a/exporters/metric/cortex/example/go.mod b/exporters/metric/cortex/example/go.mod index 53226bac8b9..01bb34cef72 100644 --- a/exporters/metric/cortex/example/go.mod +++ b/exporters/metric/cortex/example/go.mod @@ -8,11 +8,11 @@ replace ( ) require ( - go.opentelemetry.io/contrib/exporters/metric/cortex v0.17.0 - go.opentelemetry.io/contrib/exporters/metric/cortex/utils v0.17.0 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/metric v0.17.0 - go.opentelemetry.io/otel/sdk v0.17.0 - go.opentelemetry.io/otel/sdk/metric v0.17.0 + go.opentelemetry.io/contrib/exporters/metric/cortex v0.18.0 + go.opentelemetry.io/contrib/exporters/metric/cortex/utils v0.18.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/metric v0.18.0 + go.opentelemetry.io/otel/sdk v0.18.0 + go.opentelemetry.io/otel/sdk/metric v0.18.0 gopkg.in/yaml.v2 v2.2.5 // indirect ) diff --git a/exporters/metric/cortex/example/go.sum b/exporters/metric/cortex/example/go.sum index cc9facdd293..82eee706628 100644 --- a/exporters/metric/cortex/example/go.sum +++ b/exporters/metric/cortex/example/go.sum @@ -207,20 +207,20 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -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/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/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= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/exporters/metric/cortex/example/main.go b/exporters/metric/cortex/example/main.go index 7fa1d8bcd88..1b8dfd6855f 100644 --- a/exporters/metric/cortex/example/main.go +++ b/exporters/metric/cortex/example/main.go @@ -21,7 +21,7 @@ import ( "time" "go.opentelemetry.io/contrib/exporters/metric/cortex" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/resource" @@ -39,7 +39,7 @@ func main() { // Create and install the exporter. Additionally, set the push interval to 5 seconds // and add a resource to the controller. - pusher, err := cortex.InstallNewPipeline(*config, controller.WithCollectPeriod(5*time.Second), controller.WithResource(resource.NewWithAttributes(label.String("R", "V")))) + pusher, err := cortex.InstallNewPipeline(*config, controller.WithCollectPeriod(5*time.Second), controller.WithResource(resource.NewWithAttributes(attribute.String("R", "V")))) if err != nil { fmt.Printf("Error: %v", err) } @@ -71,8 +71,8 @@ func main() { time.Sleep(1 * time.Second) randomValue := random.Intn(100) value := int64(randomValue * 10) - recorder.Record(ctx, value, label.String("key", "value")) - counter.Add(ctx, int64(randomValue), label.String("key", "value")) + recorder.Record(ctx, value, attribute.String("key", "value")) + counter.Add(ctx, int64(randomValue), attribute.String("key", "value")) fmt.Printf("Adding %d to counter and recording %d in recorder\n", randomValue, value) } diff --git a/exporters/metric/cortex/go.mod b/exporters/metric/cortex/go.mod index ba1204adea6..f8f1c2f7c06 100644 --- a/exporters/metric/cortex/go.mod +++ b/exporters/metric/cortex/go.mod @@ -9,9 +9,9 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.14.6 // indirect github.com/prometheus/prometheus v2.5.0+incompatible github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/metric v0.17.0 - go.opentelemetry.io/otel/sdk v0.17.0 - go.opentelemetry.io/otel/sdk/export/metric v0.17.0 - go.opentelemetry.io/otel/sdk/metric v0.17.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/metric v0.18.0 + go.opentelemetry.io/otel/sdk v0.18.0 + go.opentelemetry.io/otel/sdk/export/metric v0.18.0 + go.opentelemetry.io/otel/sdk/metric v0.18.0 ) diff --git a/exporters/metric/cortex/go.sum b/exporters/metric/cortex/go.sum index 9b1c7a7ebdd..8bedb19cfd2 100644 --- a/exporters/metric/cortex/go.sum +++ b/exporters/metric/cortex/go.sum @@ -43,20 +43,20 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 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/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/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/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/exporters/metric/cortex/utils/go.mod b/exporters/metric/cortex/utils/go.mod index 9c11390c1d7..7b01f75f4fd 100644 --- a/exporters/metric/cortex/utils/go.mod +++ b/exporters/metric/cortex/utils/go.mod @@ -8,5 +8,5 @@ require ( github.com/spf13/afero v1.5.1 github.com/spf13/viper v1.7.1 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/contrib/exporters/metric/cortex v0.17.0 + go.opentelemetry.io/contrib/exporters/metric/cortex v0.18.0 ) diff --git a/exporters/metric/cortex/utils/go.sum b/exporters/metric/cortex/utils/go.sum index 765f3c5b460..d17b02ccaec 100644 --- a/exporters/metric/cortex/utils/go.sum +++ b/exporters/metric/cortex/utils/go.sum @@ -207,20 +207,20 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -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/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/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= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/exporters/metric/datadog/datadog.go b/exporters/metric/datadog/datadog.go index bc9f1d0f0a8..4ad1d10f2c5 100644 --- a/exporters/metric/datadog/datadog.go +++ b/exporters/metric/datadog/datadog.go @@ -21,7 +21,7 @@ import ( "github.com/DataDog/datadog-go/statsd" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/number" export "go.opentelemetry.io/otel/sdk/export/metric" @@ -98,11 +98,11 @@ func (e *Exporter) Export(ctx context.Context, cs export.CheckpointSet) error { // TODO: Use the Resource() method agg := r.Aggregation() name := e.sanitizeMetricName(r.Descriptor().InstrumentationName(), r.Descriptor().Name()) - itr := label.NewMergeIterator(r.Labels(), r.Resource().LabelSet()) + itr := attribute.NewMergeIterator(r.Labels(), r.Resource().LabelSet()) tags := append([]string{}, e.opts.Tags...) for itr.Next() { - label := itr.Label() - tag := string(label.Key) + ":" + label.Value.Emit() + attribute := itr.Label() + tag := string(attribute.Key) + ":" + attribute.Value.Emit() tags = append(tags, tag) } switch agg := agg.(type) { diff --git a/exporters/metric/datadog/example_test.go b/exporters/metric/datadog/example_test.go index f14e25f7347..413c2cf8132 100644 --- a/exporters/metric/datadog/example_test.go +++ b/exporters/metric/datadog/example_test.go @@ -25,7 +25,7 @@ import ( "github.com/DataDog/datadog-go/statsd" "go.opentelemetry.io/contrib/exporters/metric/datadog" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/global" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" @@ -67,7 +67,7 @@ func ExampleExporter() { global.SetMeterProvider(pusher.MeterProvider()) meter := global.Meter("marwandist") m := metric.Must(meter).NewInt64ValueRecorder("myrecorder") - meter.RecordBatch(context.Background(), []label.KeyValue{label.Int("l", 1)}, + meter.RecordBatch(context.Background(), []attribute.KeyValue{attribute.Int("l", 1)}, m.Measurement(1), m.Measurement(50), m.Measurement(100)) }() @@ -98,7 +98,7 @@ func ExampleExporter() { } // Output: - // myrecorder.max:100|g|#env:dev,l:1 + // myrecorder.max:100|g|#env:dev,l:1,service.name:unknown_service:datadog.test,telemetry.sdk.language:go,telemetry.sdk.name:opentelemetry,telemetry.sdk.version:0.18.0 // } diff --git a/exporters/metric/datadog/go.mod b/exporters/metric/datadog/go.mod index 088c41902a3..749b8c7fe21 100644 --- a/exporters/metric/datadog/go.mod +++ b/exporters/metric/datadog/go.mod @@ -4,8 +4,8 @@ go 1.14 require ( github.com/DataDog/datadog-go v3.7.2+incompatible - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/metric v0.17.0 - go.opentelemetry.io/otel/sdk/export/metric v0.17.0 - go.opentelemetry.io/otel/sdk/metric v0.17.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/metric v0.18.0 + go.opentelemetry.io/otel/sdk/export/metric v0.18.0 + go.opentelemetry.io/otel/sdk/metric v0.18.0 ) diff --git a/exporters/metric/datadog/go.sum b/exporters/metric/datadog/go.sum index e500e0d26ec..cc94753e0eb 100644 --- a/exporters/metric/datadog/go.sum +++ b/exporters/metric/datadog/go.sum @@ -12,20 +12,20 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/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/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/exporters/metric/dogstatsd/dogstatsd.go b/exporters/metric/dogstatsd/dogstatsd.go index aa261b797a0..d9bcfea95df 100644 --- a/exporters/metric/dogstatsd/dogstatsd.go +++ b/exporters/metric/dogstatsd/dogstatsd.go @@ -32,7 +32,7 @@ type ( Config = statsd.Config // Exporter implements a dogstatsd-format statsd exporter, - // which encodes label sets as independent fields in the + // which encodes attribute sets as independent fields in the // output. // // TODO: find a link for this syntax. It's been copied out of @@ -42,7 +42,7 @@ type ( Exporter struct { *statsd.Exporter - labelEncoder *LabelEncoder + attributeEncoder *AttributeEncoder } ) @@ -53,7 +53,7 @@ var ( // NewRawExporter returns a new Dogstatsd-syntax exporter for use in a pipeline. func NewRawExporter(config Config) (*Exporter, error) { exp := &Exporter{ - labelEncoder: NewLabelEncoder(), + attributeEncoder: NewAttributeEncoder(), } var err error @@ -91,7 +91,7 @@ func NewExportPipeline(config Config, opts ...controller.Option) (*controller.Co selector := simple.NewWithExactDistribution() // The basic processor ensures that the exporter sees the full - // set of labels as dogstatsd tags. + // set of attributes as dogstatsd tags. processor := basic.New(selector, exporter) pusher := controller.New(processor, append(opts, controller.WithPusher(exporter))...) @@ -106,11 +106,11 @@ func (*Exporter) AppendName(rec export.Record, buf *bytes.Buffer) { // AppendTags is part of the stats-internal adapter interface. func (e *Exporter) AppendTags(rec export.Record, res *resource.Resource, buf *bytes.Buffer) { - rencoded := res.Encoded(e.labelEncoder) - lencoded := rec.Labels().Encoded(e.labelEncoder) + rencoded := res.Encoded(e.attributeEncoder) + lencoded := rec.Labels().Encoded(e.attributeEncoder) // Note: We do not de-duplicate tag-keys between resources and - // event labels here. Instead, include resources first so + // event attributes here. Instead, include resources first so // that the receiver can apply OTel's last-value-wins // semantcis, if desired. rlen := len(rencoded) diff --git a/exporters/metric/dogstatsd/dogstatsd_test.go b/exporters/metric/dogstatsd/dogstatsd_test.go index a99dfc458ee..2212c7c8613 100644 --- a/exporters/metric/dogstatsd/dogstatsd_test.go +++ b/exporters/metric/dogstatsd/dogstatsd_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/exporters/metric/dogstatsd" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/sdk/export/metric/metrictest" @@ -30,47 +30,47 @@ import ( "go.opentelemetry.io/otel/sdk/resource" ) -// TestDogstatsLabels that labels are formatted in the correct style, +// TestDogstatsAttributes that attributes are formatted in the correct style, // including Resources. -func TestDogstatsLabels(t *testing.T) { +func TestDogstatsAttributes(t *testing.T) { type testCase struct { - name string - resources []label.KeyValue - labels []label.KeyValue - expected string + name string + resources []attribute.KeyValue + attributes []attribute.KeyValue + expected string } - labels := func(labels ...label.KeyValue) []label.KeyValue { return labels } + attributes := func(attributes ...attribute.KeyValue) []attribute.KeyValue { return attributes } cases := []testCase{ { - name: "no labels", - resources: nil, - labels: nil, - expected: "test.name:123|c\n", + name: "no attributes", + resources: nil, + attributes: nil, + expected: "test.name:123|c\n", }, { - name: "only resources", - resources: labels(label.String("R", "S")), - labels: nil, - expected: "test.name:123|c|#R:S\n", + name: "only resources", + resources: attributes(attribute.String("R", "S")), + attributes: nil, + expected: "test.name:123|c|#R:S\n", }, { - name: "only labels", - resources: nil, - labels: labels(label.String("A", "B")), - expected: "test.name:123|c|#A:B\n", + name: "only attributes", + resources: nil, + attributes: attributes(attribute.String("A", "B")), + expected: "test.name:123|c|#A:B\n", }, { - name: "both resources and labels", - resources: labels(label.String("R", "S")), - labels: labels(label.String("A", "B")), - expected: "test.name:123|c|#R:S,A:B\n", + name: "both resources and attributes", + resources: attributes(attribute.String("R", "S")), + attributes: attributes(attribute.String("A", "B")), + expected: "test.name:123|c|#R:S,A:B\n", }, { - resources: labels(label.String("A", "R")), - labels: labels(label.String("A", "B")), - expected: "test.name:123|c|#A:R,A:B\n", + resources: attributes(attribute.String("A", "R")), + attributes: attributes(attribute.String("A", "B")), + expected: "test.name:123|c|#A:R,A:B\n", }, } for _, tc := range cases { @@ -84,7 +84,7 @@ func TestDogstatsLabels(t *testing.T) { require.NoError(t, cagg.Update(ctx, number.NewInt64Number(123), &desc)) require.NoError(t, cagg.SynchronizedMove(cckpt, &desc)) - checkpointSet.Add(&desc, cckpt, tc.labels...) + checkpointSet.Add(&desc, cckpt, tc.attributes...) var buf bytes.Buffer exp, err := dogstatsd.NewRawExporter(dogstatsd.Config{ diff --git a/exporters/metric/dogstatsd/example_test.go b/exporters/metric/dogstatsd/example_test.go index 35baf520172..184ca01ead1 100644 --- a/exporters/metric/dogstatsd/example_test.go +++ b/exporters/metric/dogstatsd/example_test.go @@ -25,7 +25,7 @@ import ( "time" "go.opentelemetry.io/contrib/exporters/metric/dogstatsd" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/resource" @@ -67,14 +67,14 @@ func ExampleNew() { // In real code, use the URL field: // // URL: fmt.Sprint("unix://", path), - }, controller.WithCollectPeriod(time.Minute), controller.WithResource(resource.NewWithAttributes(label.String("host", "name")))) + }, controller.WithCollectPeriod(time.Minute), controller.WithResource(resource.NewWithAttributes(attribute.String("host", "name")))) if err != nil { log.Fatal("Could not initialize dogstatsd exporter:", err) } ctx := context.Background() - key := label.Key("key") + key := attribute.Key("key") // pusher implements the metric.MeterProvider interface: meter := pusher.MeterProvider().Meter("example") diff --git a/exporters/metric/dogstatsd/go.mod b/exporters/metric/dogstatsd/go.mod index b711754b346..047ff85e51f 100644 --- a/exporters/metric/dogstatsd/go.mod +++ b/exporters/metric/dogstatsd/go.mod @@ -4,9 +4,9 @@ go 1.14 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/metric v0.17.0 - go.opentelemetry.io/otel/sdk v0.17.0 - go.opentelemetry.io/otel/sdk/export/metric v0.17.0 - go.opentelemetry.io/otel/sdk/metric v0.17.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/metric v0.18.0 + go.opentelemetry.io/otel/sdk v0.18.0 + go.opentelemetry.io/otel/sdk/export/metric v0.18.0 + go.opentelemetry.io/otel/sdk/metric v0.18.0 ) diff --git a/exporters/metric/dogstatsd/go.sum b/exporters/metric/dogstatsd/go.sum index e4c3f845640..912dd9792f0 100644 --- a/exporters/metric/dogstatsd/go.sum +++ b/exporters/metric/dogstatsd/go.sum @@ -10,20 +10,20 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/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/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/exporters/metric/dogstatsd/internal/statsd/conn_test.go b/exporters/metric/dogstatsd/internal/statsd/conn_test.go index e3d0e81152c..ae898313309 100644 --- a/exporters/metric/dogstatsd/internal/statsd/conn_test.go +++ b/exporters/metric/dogstatsd/internal/statsd/conn_test.go @@ -25,7 +25,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/exporters/metric/dogstatsd/internal/statsd" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/number" export "go.opentelemetry.io/otel/sdk/export/metric" @@ -38,11 +38,11 @@ import ( "go.opentelemetry.io/otel/unit" ) -var testResource = resource.NewWithAttributes(label.String("host", "value")) +var testResource = resource.NewWithAttributes(attribute.String("host", "value")) // withTagsAdapter tests a dogstatsd-style statsd exporter. type withTagsAdapter struct { - label.Encoder + attribute.Encoder } func (*withTagsAdapter) AppendName(rec export.Record, buf *bytes.Buffer) { @@ -57,7 +57,7 @@ func (ta *withTagsAdapter) AppendTags(rec export.Record, _ *resource.Resource, b func newWithTagsAdapter() *withTagsAdapter { return &withTagsAdapter{ // Note: This uses non-statsd syntax. (No problem.) - label.DefaultEncoder(), + attribute.DefaultEncoder(), } } @@ -71,7 +71,7 @@ func (*noTagsAdapter) AppendName(rec export.Record, buf *bytes.Buffer) { iter := rec.Labels().Iter() for iter.Next() { - tag := iter.Label() + tag := iter.Attribute() _, _ = buf.WriteString(".") _, _ = buf.WriteString(tag.Value.Emit()) } @@ -142,9 +142,9 @@ timer.B.D:%s|ms tdesc := metric.NewDescriptor( "timer", metric.ValueRecorderInstrumentKind, nkind, metric.WithUnit(unit.Milliseconds)) - labels := []label.KeyValue{ - label.String("A", "B"), - label.String("C", "D"), + attributes := []attribute.KeyValue{ + attribute.String("A", "B"), + attribute.String("C", "D"), } const value = 123.456 val := newNumber(t, nkind, value) @@ -164,10 +164,10 @@ timer.B.D:%s|ms require.NoError(t, magg.SynchronizedMove(mckpt, &mdesc)) require.NoError(t, tagg.SynchronizedMove(tckpt, &tdesc)) - checkpointSet.Add(&cdesc, cckpt, labels...) - checkpointSet.Add(&gdesc, gckpt, labels...) - checkpointSet.Add(&mdesc, mckpt, labels...) - checkpointSet.Add(&tdesc, tckpt, labels...) + checkpointSet.Add(&cdesc, cckpt, attributes...) + checkpointSet.Add(&gdesc, gckpt, attributes...) + checkpointSet.Add(&mdesc, mckpt, attributes...) + checkpointSet.Add(&tdesc, tckpt, attributes...) err = exp.Export(ctx, checkpointSet) require.Nil(t, err) @@ -199,10 +199,10 @@ func newNumber(t *testing.T, kind number.Kind, value float64) number.Number { panic("invalid number kind") } -func makeLabels(offset, nkeys int) []label.KeyValue { - r := make([]label.KeyValue, nkeys) +func makeAttributes(offset, nkeys int) []attribute.KeyValue { + r := make([]attribute.KeyValue, nkeys) for i := range r { - r[i] = label.String(fmt.Sprint("k", offset+i), fmt.Sprint("v", offset+i)) + r[i] = attribute.String(fmt.Sprint("k", offset+i), fmt.Sprint("v", offset+i)) } return r } @@ -328,16 +328,16 @@ func TestPacketSplit(t *testing.T) { offset := 0 tcase.setup(func(nkeys int) { - labels := makeLabels(offset, nkeys) + attributes := makeAttributes(offset, nkeys) offset += nkeys - elabels := label.NewSet(labels...) - encoded := adapter.Encoder.Encode(elabels.Iter()) + eattributes := attribute.NewSet(attributes...) + encoded := adapter.Encoder.Encode(eattributes.Iter()) expect := fmt.Sprint("counter:100|c|#", encoded, "\n") expected = append(expected, expect) agg, ckpt := metrictest.Unslice2(sum.New(2)) aggtest.CheckedUpdate(t, agg, number.NewInt64Number(100), &desc) require.NoError(t, agg.SynchronizedMove(ckpt, &desc)) - checkpointSet.Add(&desc, ckpt, labels...) + checkpointSet.Add(&desc, ckpt, attributes...) }) err = exp.Export(ctx, checkpointSet) diff --git a/exporters/metric/dogstatsd/labels.go b/exporters/metric/dogstatsd/labels.go index 988c97f7f52..08bd05af89f 100644 --- a/exporters/metric/dogstatsd/labels.go +++ b/exporters/metric/dogstatsd/labels.go @@ -18,26 +18,26 @@ import ( "bytes" "sync" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" ) -// LabelEncoder encodes metric labels in the dogstatsd syntax. +// AttributeEncoder encodes metric attributes in the dogstatsd syntax. // // TODO: find a link for this syntax. It's been copied out of code, // not a specification: // // https://github.com/stripe/veneur/blob/master/sinks/datadog/datadog.go -type LabelEncoder struct { +type AttributeEncoder struct { pool sync.Pool } -var _ label.Encoder = &LabelEncoder{} -var leID = label.NewEncoderID() +var _ attribute.Encoder = &AttributeEncoder{} +var leID = attribute.NewEncoderID() -// NewLabelEncoder returns a new encoder for dogstatsd-syntax metric -// labels. -func NewLabelEncoder() *LabelEncoder { - return &LabelEncoder{ +// NewAttributeEncoder returns a new encoder for dogstatsd-syntax metric +// attributes. +func NewAttributeEncoder() *AttributeEncoder { + return &AttributeEncoder{ pool: sync.Pool{ New: func() interface{} { return &bytes.Buffer{} @@ -47,18 +47,18 @@ func NewLabelEncoder() *LabelEncoder { } // Encode emits a string like "|#key1:value1,key2:value2". -func (e *LabelEncoder) Encode(iter label.Iterator) string { +func (e *AttributeEncoder) Encode(iter attribute.Iterator) string { buf := e.pool.Get().(*bytes.Buffer) defer e.pool.Put(buf) buf.Reset() for iter.Next() { - e.encodeOne(buf, iter.Label()) + e.encodeOne(buf, iter.Attribute()) } return buf.String() } -func (e *LabelEncoder) encodeOne(buf *bytes.Buffer, kv label.KeyValue) { +func (e *AttributeEncoder) encodeOne(buf *bytes.Buffer, kv attribute.KeyValue) { if buf.Len() != 0 { _, _ = buf.WriteRune(',') } @@ -67,6 +67,6 @@ func (e *LabelEncoder) encodeOne(buf *bytes.Buffer, kv label.KeyValue) { _, _ = buf.WriteString(kv.Value.Emit()) } -func (*LabelEncoder) ID() label.EncoderID { +func (*AttributeEncoder) ID() attribute.EncoderID { return leID } diff --git a/exporters/metric/dogstatsd/labels_test.go b/exporters/metric/dogstatsd/labels_test.go index d1dce85e234..c2ada3fff15 100644 --- a/exporters/metric/dogstatsd/labels_test.go +++ b/exporters/metric/dogstatsd/labels_test.go @@ -20,30 +20,30 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/exporters/metric/dogstatsd" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" ) -var testLabels = []label.KeyValue{ - label.String("A", "B"), - label.String("C", "D"), - label.Float64("E", 1.5), +var testAttributes = []attribute.KeyValue{ + attribute.String("A", "B"), + attribute.String("C", "D"), + attribute.Float64("E", 1.5), } -func TestLabelSyntax(t *testing.T) { - encoder := dogstatsd.NewLabelEncoder() +func TestAttributeSyntax(t *testing.T) { + encoder := dogstatsd.NewAttributeEncoder() - labels := label.NewSet(testLabels...) - require.Equal(t, `A:B,C:D,E:1.5`, encoder.Encode(labels.Iter())) + attributes := attribute.NewSet(testAttributes...) + require.Equal(t, `A:B,C:D,E:1.5`, encoder.Encode(attributes.Iter())) - kvs := []label.KeyValue{ - label.String("A", "B"), + kvs := []attribute.KeyValue{ + attribute.String("A", "B"), } - labels = label.NewSet(kvs...) - require.Equal(t, `A:B`, encoder.Encode(labels.Iter())) + attributes = attribute.NewSet(kvs...) + require.Equal(t, `A:B`, encoder.Encode(attributes.Iter())) - labels = label.NewSet() - require.Equal(t, "", encoder.Encode(labels.Iter())) + attributes = attribute.NewSet() + require.Equal(t, "", encoder.Encode(attributes.Iter())) - labels = label.Set{} - require.Equal(t, "", encoder.Encode(labels.Iter())) + attributes = attribute.Set{} + require.Equal(t, "", encoder.Encode(attributes.Iter())) } diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_test.go index 24b4def29cc..c5d94198eb4 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_test.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_test.go @@ -24,7 +24,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/oteltest" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" @@ -38,7 +38,7 @@ const ( func TestWrapPartitionConsumer(t *testing.T) { propagators := propagation.TraceContext{} // Mock provider - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // Mock partition consumer controller @@ -57,7 +57,7 @@ func TestWrapPartitionConsumer(t *testing.T) { func TestWrapConsumer(t *testing.T) { propagators := propagation.TraceContext{} // Mock provider - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // Mock partition consumer controller @@ -98,32 +98,32 @@ func consumeAndCheck(t *testing.T, mt trace.Tracer, complFn func() []*oteltest.S assert.Len(t, spans, 2) expectedList := []struct { - labelList []label.KeyValue - parentSpanID trace.SpanID - kind trace.SpanKind - msgKey []byte + attributeList []attribute.KeyValue + parentSpanID trace.SpanID + kind trace.SpanKind + msgKey []byte }{ { - labelList: []label.KeyValue{ + attributeList: []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String("test-topic"), semconv.MessagingOperationReceive, semconv.MessagingMessageIDKey.String("1"), - kafkaPartitionKey.Int32(0), + kafkaPartitionKey.Int64(0), }, parentSpanID: trace.SpanFromContext(ctx).SpanContext().SpanID, kind: trace.SpanKindConsumer, msgKey: []byte("foo"), }, { - labelList: []label.KeyValue{ + attributeList: []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String("test-topic"), semconv.MessagingOperationReceive, semconv.MessagingMessageIDKey.String("2"), - kafkaPartitionKey.Int32(0), + kafkaPartitionKey.Int64(0), }, kind: trace.SpanKindConsumer, msgKey: []byte("foo2"), @@ -143,7 +143,7 @@ func consumeAndCheck(t *testing.T, mt trace.Tracer, complFn func() []*oteltest.S assert.Equal(t, "kafka.consume", span.Name()) assert.Equal(t, expected.kind, span.SpanKind()) assert.Equal(t, expected.msgKey, msgList[i].Key) - for _, k := range expected.labelList { + for _, k := range expected.attributeList { assert.Equal(t, k.Value, span.Attributes()[k.Key], k.Key) } }) diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/dispatcher.go b/instrumentation/github.com/Shopify/sarama/otelsarama/dispatcher.go index c76f9da874f..e2af6a9e03d 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/dispatcher.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/dispatcher.go @@ -20,7 +20,7 @@ import ( "github.com/Shopify/sarama" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/semconv" "go.opentelemetry.io/otel/trace" ) @@ -59,13 +59,13 @@ func (w *consumerMessagesDispatcherWrapper) Run() { parentSpanContext := w.cfg.Propagators.Extract(context.Background(), carrier) // Create a span. - attrs := []label.KeyValue{ + attrs := []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String(msg.Topic), semconv.MessagingOperationReceive, semconv.MessagingMessageIDKey.String(strconv.FormatInt(msg.Offset, 10)), - kafkaPartitionKey.Int32(msg.Partition), + kafkaPartitionKey.Int64(int64(msg.Partition)), } opts := []trace.SpanOption{ trace.WithAttributes(attrs...), diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.mod b/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.mod index 97606f202f8..7bee554554a 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.mod +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/Shopify/sarama v1.28.0 - go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama 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/otel/trace v0.17.0 + go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama 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 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.sum b/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.sum index a4d18e04904..c8bbcf027ed 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.sum +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.sum @@ -63,22 +63,22 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -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/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/go.mod b/instrumentation/github.com/Shopify/sarama/otelsarama/go.mod index c6bce0e13e5..c0cae972234 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/go.mod +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/go.mod @@ -7,8 +7,8 @@ replace go.opentelemetry.io/contrib => ../../../../.. require ( github.com/Shopify/sarama v1.28.0 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/github.com/Shopify/sarama/otelsarama/go.sum b/instrumentation/github.com/Shopify/sarama/otelsarama/go.sum index 08e58893993..65b0b47772c 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/go.sum +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/go.sum @@ -62,14 +62,14 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -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/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/message.go b/instrumentation/github.com/Shopify/sarama/otelsarama/message.go index 797b757d557..66e39acb5ad 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/message.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/message.go @@ -58,6 +58,15 @@ func (c ProducerMessageCarrier) Set(key, val string) { }) } +// Keys returns a slice of all key identifiers in the carrier. +func (c ProducerMessageCarrier) Keys() []string { + out := make([]string, len(c.msg.Headers)) + for i, h := range c.msg.Headers { + out[i] = string(h.Key) + } + return out +} + // ConsumerMessageCarrier injects and extracts traces from a sarama.ConsumerMessage. type ConsumerMessageCarrier struct { msg *sarama.ConsumerMessage @@ -92,3 +101,12 @@ func (c ConsumerMessageCarrier) Set(key, val string) { Value: []byte(val), }) } + +// Keys returns a slice of all key identifiers in the carrier. +func (c ConsumerMessageCarrier) Keys() []string { + out := make([]string, len(c.msg.Headers)) + for i, h := range c.msg.Headers { + out[i] = string(h.Key) + } + return out +} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/message_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/message_test.go index f96aa553e67..271a28cdfd0 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/message_test.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/message_test.go @@ -70,6 +70,42 @@ func TestProducerMessageCarrierSet(t *testing.T) { }) } +func TestProducerMessageCarrierKeys(t *testing.T) { + testCases := []struct { + name string + carrier ProducerMessageCarrier + expected []string + }{ + { + name: "one", + carrier: ProducerMessageCarrier{msg: &sarama.ProducerMessage{Headers: []sarama.RecordHeader{ + {Key: []byte("foo"), Value: []byte("bar")}, + }}}, + expected: []string{"foo"}, + }, + { + name: "none", + carrier: ProducerMessageCarrier{msg: &sarama.ProducerMessage{Headers: []sarama.RecordHeader{}}}, + expected: []string{}, + }, + { + name: "many", + carrier: ProducerMessageCarrier{msg: &sarama.ProducerMessage{Headers: []sarama.RecordHeader{ + {Key: []byte("foo"), Value: []byte("bar")}, + {Key: []byte("baz"), Value: []byte("quux")}, + }}}, + expected: []string{"foo", "baz"}, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result := tc.carrier.Keys() + assert.Equal(t, tc.expected, result) + }) + } +} + func TestConsumerMessageCarrierGet(t *testing.T) { testCases := []struct { name string @@ -118,3 +154,39 @@ func TestConsumerMessageCarrierSet(t *testing.T) { {Key: []byte("foo3"), Value: []byte("bar4")}, }) } + +func TestConsumerMessageCarrierKeys(t *testing.T) { + testCases := []struct { + name string + carrier ConsumerMessageCarrier + expected []string + }{ + { + name: "one", + carrier: ConsumerMessageCarrier{msg: &sarama.ConsumerMessage{Headers: []*sarama.RecordHeader{ + {Key: []byte("foo"), Value: []byte("bar")}, + }}}, + expected: []string{"foo"}, + }, + { + name: "none", + carrier: ConsumerMessageCarrier{msg: &sarama.ConsumerMessage{Headers: []*sarama.RecordHeader{}}}, + expected: []string{}, + }, + { + name: "many", + carrier: ConsumerMessageCarrier{msg: &sarama.ConsumerMessage{Headers: []*sarama.RecordHeader{ + {Key: []byte("foo"), Value: []byte("bar")}, + {Key: []byte("baz"), Value: []byte("quux")}, + }}}, + expected: []string{"foo", "baz"}, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result := tc.carrier.Keys() + assert.Equal(t, tc.expected, result) + }) + } +} diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/option.go b/instrumentation/github.com/Shopify/sarama/otelsarama/option.go index 4fd25310150..307fe0d11d7 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/option.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/option.go @@ -17,7 +17,7 @@ package otelsarama import ( "go.opentelemetry.io/contrib" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -25,7 +25,7 @@ import ( const ( defaultTracerName = "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" - kafkaPartitionKey = label.Key("messaging.kafka.partition") + kafkaPartitionKey = attribute.Key("messaging.kafka.partition") ) type config struct { diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/producer.go b/instrumentation/github.com/Shopify/sarama/otelsarama/producer.go index 82e887fcd4c..2bb266971a1 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/producer.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/producer.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/semconv" "go.opentelemetry.io/otel/trace" ) @@ -233,7 +233,7 @@ func startProducerSpan(cfg config, version sarama.KafkaVersion, msg *sarama.Prod ctx := cfg.Propagators.Extract(context.Background(), carrier) // Create a span. - attrs := []label.KeyValue{ + attrs := []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String(msg.Topic), @@ -255,7 +255,7 @@ func startProducerSpan(cfg config, version sarama.KafkaVersion, msg *sarama.Prod func finishProducerSpan(span trace.Span, partition int32, offset int64, err error) { span.SetAttributes( semconv.MessagingMessageIDKey.String(strconv.FormatInt(offset, 10)), - kafkaPartitionKey.Int32(partition), + kafkaPartitionKey.Int64(int64(partition)), ) if err != nil { span.SetStatus(codes.Error, err.Error()) diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/producer_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/producer_test.go index dda7c006e77..429f67f1917 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/producer_test.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/producer_test.go @@ -24,8 +24,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/propagation" "go.opentelemetry.io/otel/semconv" @@ -37,7 +37,7 @@ func TestWrapSyncProducer(t *testing.T) { var err error // Mock provider - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) cfg := newSaramaConfig() @@ -54,50 +54,50 @@ func TestWrapSyncProducer(t *testing.T) { // Expected expectedList := []struct { - labelList []label.KeyValue - parentSpanID oteltrace.SpanID - kind oteltrace.SpanKind + attributeList []attribute.KeyValue + parentSpanID oteltrace.SpanID + kind oteltrace.SpanKind }{ { - labelList: []label.KeyValue{ + attributeList: []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String(topic), semconv.MessagingMessageIDKey.String("1"), - kafkaPartitionKey.Int32(0), + kafkaPartitionKey.Int64(0), }, parentSpanID: oteltrace.SpanFromContext(ctx).SpanContext().SpanID, kind: oteltrace.SpanKindProducer, }, { - labelList: []label.KeyValue{ + attributeList: []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String(topic), semconv.MessagingMessageIDKey.String("2"), - kafkaPartitionKey.Int32(0), + kafkaPartitionKey.Int64(0), }, kind: oteltrace.SpanKindProducer, }, { - labelList: []label.KeyValue{ + attributeList: []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String(topic), // TODO: The mock sync producer of sarama does not handle the offset while sending messages // https://github.com/Shopify/sarama/pull/1747 //semconv.MessagingMessageIDKey.String("3"), - kafkaPartitionKey.Int32(0), + kafkaPartitionKey.Int64(0), }, kind: oteltrace.SpanKindProducer, }, { - labelList: []label.KeyValue{ + attributeList: []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String(topic), //semconv.MessagingMessageIDKey.String("4"), - kafkaPartitionKey.Int32(0), + kafkaPartitionKey.Int64(0), }, kind: oteltrace.SpanKindProducer, }, @@ -130,7 +130,7 @@ func TestWrapSyncProducer(t *testing.T) { assert.Equal(t, expected.parentSpanID, span.ParentSpanID()) assert.Equal(t, "kafka.produce", span.Name()) assert.Equal(t, expected.kind, span.SpanKind()) - for _, k := range expected.labelList { + for _, k := range expected.attributeList { assert.Equal(t, k.Value, span.Attributes()[k.Key], k.Key) } @@ -156,7 +156,7 @@ func TestWrapAsyncProducer(t *testing.T) { t.Run("without successes config", func(t *testing.T) { // Mock provider - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider( oteltest.WithSpanRecorder(sr), ) @@ -179,28 +179,28 @@ func TestWrapAsyncProducer(t *testing.T) { // Expected expectedList := []struct { - labelList []label.KeyValue - parentSpanID oteltrace.SpanID - kind oteltrace.SpanKind + attributeList []attribute.KeyValue + parentSpanID oteltrace.SpanID + kind oteltrace.SpanKind }{ { - labelList: []label.KeyValue{ + attributeList: []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String(topic), semconv.MessagingMessageIDKey.String("0"), - kafkaPartitionKey.Int32(0), + kafkaPartitionKey.Int64(0), }, parentSpanID: oteltrace.SpanID{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2}, kind: oteltrace.SpanKindProducer, }, { - labelList: []label.KeyValue{ + attributeList: []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String(topic), semconv.MessagingMessageIDKey.String("0"), - kafkaPartitionKey.Int32(0), + kafkaPartitionKey.Int64(0), }, kind: oteltrace.SpanKindProducer, }, @@ -214,7 +214,7 @@ func TestWrapAsyncProducer(t *testing.T) { assert.Equal(t, expected.parentSpanID, span.ParentSpanID()) assert.Equal(t, "kafka.produce", span.Name()) assert.Equal(t, expected.kind, span.SpanKind()) - for _, k := range expected.labelList { + for _, k := range expected.attributeList { assert.Equal(t, k.Value, span.Attributes()[k.Key], k.Key) } @@ -226,7 +226,7 @@ func TestWrapAsyncProducer(t *testing.T) { t.Run("with successes config", func(t *testing.T) { // Mock provider - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider( oteltest.WithSpanRecorder(sr), ) @@ -256,28 +256,28 @@ func TestWrapAsyncProducer(t *testing.T) { // Expected expectedList := []struct { - labelList []label.KeyValue - parentSpanID oteltrace.SpanID - kind oteltrace.SpanKind + attributeList []attribute.KeyValue + parentSpanID oteltrace.SpanID + kind oteltrace.SpanKind }{ { - labelList: []label.KeyValue{ + attributeList: []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String(topic), semconv.MessagingMessageIDKey.String("1"), - kafkaPartitionKey.Int32(0), + kafkaPartitionKey.Int64(0), }, parentSpanID: oteltrace.SpanID{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2}, kind: oteltrace.SpanKindProducer, }, { - labelList: []label.KeyValue{ + attributeList: []attribute.KeyValue{ semconv.MessagingSystemKey.String("kafka"), semconv.MessagingDestinationKindKeyTopic, semconv.MessagingDestinationKey.String(topic), semconv.MessagingMessageIDKey.String("2"), - kafkaPartitionKey.Int32(0), + kafkaPartitionKey.Int64(0), }, kind: oteltrace.SpanKindProducer, }, @@ -291,7 +291,7 @@ func TestWrapAsyncProducer(t *testing.T) { assert.Equal(t, expected.parentSpanID, span.ParentSpanID()) assert.Equal(t, "kafka.produce", span.Name()) assert.Equal(t, expected.kind, span.SpanKind()) - for _, k := range expected.labelList { + for _, k := range expected.attributeList { assert.Equal(t, k.Value, span.Attributes()[k.Key], k.Key) } @@ -308,7 +308,7 @@ func TestWrapAsyncProducer(t *testing.T) { func TestWrapAsyncProducerError(t *testing.T) { propagators := propagation.TraceContext{} // Mock provider - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // Set producer with successes config diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go b/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go index e88e7cf6a9d..06bf26135bd 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/contrib/propagators/b3" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/propagation" @@ -233,7 +233,7 @@ func TestSpanFromContextCustomProvider(t *testing.T) { func TestStatic(t *testing.T) { defer replaceBeego() - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) meterimpl, meterProvider := oteltest.NewMeterProvider() file, err := ioutil.TempFile("", "static-*.html") @@ -293,7 +293,7 @@ func TestRender(t *testing.T) { beego.SetViewsPath(dir) _, tplName = filepath.Split(file.Name()) - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) mw := NewOTelBeegoMiddleWare( @@ -333,7 +333,7 @@ func TestRender(t *testing.T) { // ------------------------------------------ Utilities func runTest(t *testing.T, tc *testCase, url string) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) meterimpl, meterProvider := oteltest.NewMeterProvider() addTestRoutes(t) @@ -377,8 +377,8 @@ func runTest(t *testing.T, tc *testCase, url string) { assertMetrics(t, meterimpl.MeasurementBatches, tc) } -func defaultAttributes() []label.KeyValue { - return []label.KeyValue{ +func defaultAttributes() []attribute.KeyValue { + return []attribute.KeyValue{ semconv.HTTPServerNameKey.String(middleWareName), semconv.HTTPSchemeHTTP, semconv.HTTPHostKey.String("localhost"), @@ -425,7 +425,7 @@ type testCase struct { expectedSpanName string expectedHTTPStatus int expectedResponse testReply - expectedAttributes []label.KeyValue + expectedAttributes []attribute.KeyValue } var testCases = []*testCase{ @@ -438,7 +438,7 @@ var testCases = []*testCase{ expectedSpanName: "/", expectedHTTPStatus: http.StatusOK, expectedResponse: testReply{Message: defaultReply}, - expectedAttributes: []label.KeyValue{}, + expectedAttributes: []attribute.KeyValue{}, }, { name: "GET/1__All default options", @@ -449,7 +449,7 @@ var testCases = []*testCase{ expectedSpanName: "/:id", expectedHTTPStatus: http.StatusOK, expectedResponse: testReply{Message: defaultReply}, - expectedAttributes: []label.KeyValue{}, + expectedAttributes: []attribute.KeyValue{}, }, { name: "POST/greet?name=test__All default options", @@ -460,7 +460,7 @@ var testCases = []*testCase{ expectedSpanName: "/greet", expectedHTTPStatus: http.StatusOK, expectedResponse: testReply{Message: "test said hello."}, - expectedAttributes: []label.KeyValue{}, + expectedAttributes: []attribute.KeyValue{}, }, { name: "DELETE/__All default options", @@ -471,7 +471,7 @@ var testCases = []*testCase{ expectedSpanName: "/", expectedHTTPStatus: http.StatusAccepted, expectedResponse: testReply{Message: "success"}, - expectedAttributes: []label.KeyValue{}, + expectedAttributes: []attribute.KeyValue{}, }, { name: "PUT/__All default options", @@ -482,7 +482,7 @@ var testCases = []*testCase{ expectedSpanName: "/", expectedHTTPStatus: http.StatusAccepted, expectedResponse: testReply{Message: "successfully put"}, - expectedAttributes: []label.KeyValue{}, + expectedAttributes: []attribute.KeyValue{}, }, { name: "GET/__Custom propagators", @@ -495,7 +495,7 @@ var testCases = []*testCase{ expectedSpanName: "/", expectedHTTPStatus: http.StatusOK, expectedResponse: testReply{Message: defaultReply}, - expectedAttributes: []label.KeyValue{}, + expectedAttributes: []attribute.KeyValue{}, }, { name: "GET/__Custom filter filtering route", @@ -526,7 +526,7 @@ var testCases = []*testCase{ expectedSpanName: "/", expectedHTTPStatus: http.StatusOK, expectedResponse: testReply{Message: defaultReply}, - expectedAttributes: []label.KeyValue{}, + expectedAttributes: []attribute.KeyValue{}, }, { name: "POST/greet__Default options, bad request", @@ -537,7 +537,7 @@ var testCases = []*testCase{ expectedSpanName: "/greet", expectedHTTPStatus: http.StatusBadRequest, expectedResponse: testReply{Err: "missing query param \"name\""}, - expectedAttributes: []label.KeyValue{}, + expectedAttributes: []attribute.KeyValue{}, }, { name: "POST/greet?name=test__Custom span name formatter", @@ -552,7 +552,7 @@ var testCases = []*testCase{ expectedSpanName: customSpanName, expectedHTTPStatus: http.StatusOK, expectedResponse: testReply{Message: "test said hello."}, - expectedAttributes: []label.KeyValue{}, + expectedAttributes: []attribute.KeyValue{}, }, { name: "POST/greet?name=test__Custom span name formatter and custom filter", @@ -569,6 +569,6 @@ var testCases = []*testCase{ hasSpan: false, expectedHTTPStatus: http.StatusOK, expectedResponse: testReply{Message: "test said hello."}, - expectedAttributes: []label.KeyValue{}, + expectedAttributes: []attribute.KeyValue{}, }, } diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/common.go b/instrumentation/github.com/astaxie/beego/otelbeego/common.go index 1c061bdf24e..6198280b2a6 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/common.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/common.go @@ -17,7 +17,7 @@ package otelbeego import ( "net/http" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" ) // ------------------------------------------ Constants @@ -29,13 +29,13 @@ const ( renderStringSpanName = "beego.render.string" renderBytesSpanName = "beego.render.bytes" - templateKey = label.Key("go.template") + templateKey = attribute.Key("go.template") ) // ------------------------------------------ Attribute Functions // Template returns the template name as a KeyValue pair. -func Template(name string) label.KeyValue { +func Template(name string) attribute.KeyValue { return templateKey.String(name) } diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod index c52fb48fcc1..ed1d988035a 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod +++ b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod @@ -11,9 +11,9 @@ replace ( require ( github.com/astaxie/beego v1.12.3 - go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego 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/otel/trace v0.17.0 + go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego 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 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum index 6b973e78227..00a12866fa5 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum +++ b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum @@ -144,22 +144,22 @@ github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2K github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= -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/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/go.mod index dcda027e3dd..677daaf6d37 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/go.mod +++ b/instrumentation/github.com/astaxie/beego/otelbeego/go.mod @@ -11,12 +11,12 @@ replace ( require ( github.com/astaxie/beego v1.12.3 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.17.0 - go.opentelemetry.io/contrib/propagators v0.17.0 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/metric v0.17.0 - go.opentelemetry.io/otel/oteltest v0.17.0 - go.opentelemetry.io/otel/trace v0.17.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.18.0 + go.opentelemetry.io/contrib/propagators v0.18.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/metric v0.18.0 + go.opentelemetry.io/otel/oteltest v0.18.0 + go.opentelemetry.io/otel/trace v0.18.0 golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect golang.org/x/sys v0.0.0-20200803210538-64077c9b5642 // indirect golang.org/x/text v0.3.3 // indirect diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/go.sum index 0b4629c8a80..264c77bc297 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/go.sum +++ b/instrumentation/github.com/astaxie/beego/otelbeego/go.sum @@ -144,14 +144,14 @@ github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2K github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= -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/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/attributes.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/attributes.go index e355dccc255..17416fa4475 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/attributes.go +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/attributes.go @@ -15,7 +15,7 @@ package otelmemcache import ( - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/semconv" ) @@ -37,18 +37,18 @@ const ( mamcacheDBSystemValue = "memcached" - memcacheDBItemKeyName label.Key = "db.memcached.item" + memcacheDBItemKeyName attribute.Key = "db.memcached.item" ) -func memcacheDBSystem() label.KeyValue { +func memcacheDBSystem() attribute.KeyValue { return semconv.DBSystemKey.String(mamcacheDBSystemValue) } -func memcacheDBOperation(opName operation) label.KeyValue { +func memcacheDBOperation(opName operation) attribute.KeyValue { return semconv.DBOperationKey.String(string(opName)) } -func memcacheDBItemKeys(itemKeys ...string) label.KeyValue { +func memcacheDBItemKeys(itemKeys ...string) attribute.KeyValue { if len(itemKeys) > 1 { return memcacheDBItemKeyName.Array(itemKeys) } diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.mod b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.mod index eb2adb273a9..76605292470 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.mod +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.mod @@ -9,8 +9,8 @@ replace ( require ( github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b - go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache v0.17.0 - go.opentelemetry.io/otel/exporters/stdout v0.17.0 - go.opentelemetry.io/otel/sdk v0.17.0 - go.opentelemetry.io/otel/trace v0.17.0 + go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache v0.18.0 + go.opentelemetry.io/otel/exporters/stdout v0.18.0 + go.opentelemetry.io/otel/sdk v0.18.0 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.sum b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.sum index ea46d52dd98..e640979cd89 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.sum +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/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/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.mod b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.mod index 003e60282bc..5fc97308ef5 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.mod +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.mod @@ -7,8 +7,8 @@ replace go.opentelemetry.io/contrib => ../../../../../../ require ( github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b 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/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.sum b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.sum index 648d291fee8..830b25c19b8 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.sum +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.sum @@ -10,14 +10,14 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache.go index 217dfc7ce14..0be7599c577 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache.go +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache.go @@ -21,8 +21,8 @@ import ( "go.opentelemetry.io/contrib" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/label" oteltrace "go.opentelemetry.io/otel/trace" ) @@ -68,17 +68,17 @@ func NewClientWithTracing(client *memcache.Client, opts ...Option) *Client { // attrsByOperationAndItemKey returns appropriate span attributes on the basis // of the operation name and item key(s) (if available) -func (c *Client) attrsByOperationAndItemKey(operation operation, key ...string) []label.KeyValue { - labels := []label.KeyValue{ +func (c *Client) attrsByOperationAndItemKey(operation operation, key ...string) []attribute.KeyValue { + attributes := []attribute.KeyValue{ memcacheDBSystem(), memcacheDBOperation(operation), } if len(key) > 0 { - labels = append(labels, memcacheDBItemKeys(key...)) + attributes = append(attributes, memcacheDBItemKeys(key...)) } - return labels + return attributes } // Starts span with appropriate span kind and attributes diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache_test.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache_test.go index a9621ce62c2..10e3a6f9c81 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache_test.go +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache_test.go @@ -23,8 +23,8 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/internal/util" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/oteltest" oteltrace "go.opentelemetry.io/otel/trace" ) @@ -59,12 +59,12 @@ func TestOperation(t *testing.T) { assert.Equal(t, string(operationAdd), spans[0].Name()) assert.Len(t, spans[0].Attributes(), 3) - expectedLabelMap := map[label.Key]label.Value{ - memcacheDBSystem().Key: memcacheDBSystem().Value, - memcacheDBOperation(operationAdd).Key: memcacheDBOperation(operationAdd).Value, - label.Key(memcacheDBItemKeyName).String(mi.Key).Key: label.Key(memcacheDBItemKeyName).String(mi.Key).Value, + expectedAttributeMap := map[attribute.Key]attribute.Value{ + memcacheDBSystem().Key: memcacheDBSystem().Value, + memcacheDBOperation(operationAdd).Key: memcacheDBOperation(operationAdd).Value, + attribute.Key(memcacheDBItemKeyName).String(mi.Key).Key: attribute.Key(memcacheDBItemKeyName).String(mi.Key).Value, } - assert.Equal(t, expectedLabelMap, spans[0].Attributes()) + assert.Equal(t, expectedAttributeMap, spans[0].Attributes()) } func TestOperationWithCacheMissError(t *testing.T) { @@ -80,25 +80,25 @@ func TestOperationWithCacheMissError(t *testing.T) { assert.Equal(t, string(operationGet), spans[0].Name()) assert.Len(t, spans[0].Attributes(), 3) - expectedLabelMap := map[label.Key]label.Value{ - memcacheDBSystem().Key: memcacheDBSystem().Value, - memcacheDBOperation(operationGet).Key: memcacheDBOperation(operationGet).Value, - label.Key(memcacheDBItemKeyName).String(key).Key: label.Key(memcacheDBItemKeyName).String(key).Value, + expectedAttributeMap := map[attribute.Key]attribute.Value{ + memcacheDBSystem().Key: memcacheDBSystem().Value, + memcacheDBOperation(operationGet).Key: memcacheDBOperation(operationGet).Value, + attribute.Key(memcacheDBItemKeyName).String(key).Key: attribute.Key(memcacheDBItemKeyName).String(key).Value, } - assert.Equal(t, expectedLabelMap, spans[0].Attributes()) + assert.Equal(t, expectedAttributeMap, spans[0].Attributes()) assert.Equal(t, codes.Error, spans[0].StatusCode()) assert.Equal(t, err.Error(), spans[0].StatusMessage()) } // tests require running memcached instance -func initClientWithSpanRecorder(t *testing.T) (*Client, *oteltest.StandardSpanRecorder) { +func initClientWithSpanRecorder(t *testing.T) (*Client, *oteltest.SpanRecorder) { host, port := "localhost", "11211" mc := memcache.New(host + ":" + port) require.NoError(t, clearDB(mc)) - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) c := NewClientWithTracing( mc, WithTracerProvider( diff --git a/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.mod b/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.mod index efa569a2cdb..87baa102e31 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.mod +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.mod @@ -10,9 +10,9 @@ replace ( require ( github.com/emicklei/go-restful/v3 v3.4.0 - go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful 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/otel/trace v0.17.0 + go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful 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 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.sum b/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.sum index 8bb6cf78155..f634dfde1cf 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.sum +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.sum @@ -20,22 +20,22 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 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/github.com/emicklei/go-restful/otelrestful/example/server.go b/instrumentation/github.com/emicklei/go-restful/otelrestful/example/server.go index 7d438582124..a557c4e29b0 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/example/server.go +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/example/server.go @@ -23,8 +23,8 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout" - otelkv "go.opentelemetry.io/otel/label" sdktrace "go.opentelemetry.io/otel/sdk/trace" oteltrace "go.opentelemetry.io/otel/trace" ) @@ -81,7 +81,7 @@ func initTracer() { func (u UserResource) getUser(req *restful.Request, resp *restful.Response) { uid := req.PathParameter("user-id") - _, span := tracer.Start(req.Request.Context(), "getUser", oteltrace.WithAttributes(otelkv.String("id", uid))) + _, span := tracer.Start(req.Request.Context(), "getUser", oteltrace.WithAttributes(attribute.String("id", uid))) defer span.End() id, err := strconv.Atoi(uid) if err == nil && id >= 100 { diff --git a/instrumentation/github.com/emicklei/go-restful/otelrestful/go.mod b/instrumentation/github.com/emicklei/go-restful/otelrestful/go.mod index 735dbacfade..313ccb2ed51 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/go.mod +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/go.mod @@ -11,9 +11,9 @@ require ( github.com/emicklei/go-restful/v3 v3.4.0 github.com/json-iterator/go v1.1.10 // indirect github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/contrib v0.17.0 - go.opentelemetry.io/contrib/propagators 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/contrib/propagators 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/github.com/emicklei/go-restful/otelrestful/go.sum b/instrumentation/github.com/emicklei/go-restful/otelrestful/go.sum index 0a3f4538dbf..62b900f7739 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/go.sum +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/go.sum @@ -20,14 +20,14 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 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/github.com/emicklei/go-restful/otelrestful/restful.go b/instrumentation/github.com/emicklei/go-restful/otelrestful/restful.go index e456d828b26..9830d2043ff 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/restful.go +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/restful.go @@ -19,6 +19,7 @@ import ( "go.opentelemetry.io/contrib" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" oteltrace "go.opentelemetry.io/otel/trace" ) @@ -47,7 +48,7 @@ func OTelFilter(service string, opts ...Option) restful.FilterFunction { } return func(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) { r := req.Request - ctx := cfg.Propagators.Extract(r.Context(), r.Header) + ctx := cfg.Propagators.Extract(r.Context(), propagation.HeaderCarrier(r.Header)) route := req.SelectedRoutePath() spanName := route diff --git a/instrumentation/github.com/emicklei/go-restful/otelrestful/restful_test.go b/instrumentation/github.com/emicklei/go-restful/otelrestful/restful_test.go index 19512b2cb42..1e11c2d5abf 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/restful_test.go +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/restful_test.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful" b3prop "go.opentelemetry.io/contrib/propagators/b3" "go.opentelemetry.io/otel" - otelkv "go.opentelemetry.io/otel/label" + otelkv "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/propagation" oteltrace "go.opentelemetry.io/otel/trace" @@ -89,7 +89,7 @@ func TestChildSpanFromCustomTracer(t *testing.T) { } func TestChildSpanNames(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) handlerFunc := func(req *restful.Request, resp *restful.Response) { @@ -162,7 +162,7 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - otel.GetTextMapPropagator().Inject(ctx, r.Header) + otel.GetTextMapPropagator().Inject(ctx, propagation.HeaderCarrier(r.Header)) handlerFunc := func(req *restful.Request, resp *restful.Response) { span := oteltrace.SpanFromContext(req.Request.Context()) @@ -191,7 +191,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - b3.Inject(ctx, r.Header) + b3.Inject(ctx, propagation.HeaderCarrier(r.Header)) handlerFunc := func(req *restful.Request, resp *restful.Response) { span := oteltrace.SpanFromContext(req.Request.Context()) @@ -214,7 +214,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { } func TestMultiFilters(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) wrappedFunc := func(tracerName string) restful.RouteFunction { diff --git a/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.mod b/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.mod index 5c9d39aaf43..e4b0d7034ac 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.mod +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.mod @@ -10,9 +10,9 @@ replace ( require ( github.com/gin-gonic/gin v1.6.3 - go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin 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/otel/trace v0.17.0 + go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin 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 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.sum b/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.sum index 1e944654986..45902cc358e 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.sum +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.sum @@ -41,22 +41,22 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -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/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= diff --git a/instrumentation/github.com/gin-gonic/gin/otelgin/example/server.go b/instrumentation/github.com/gin-gonic/gin/otelgin/example/server.go index d51292aac76..00e6854e903 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/example/server.go +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/example/server.go @@ -23,8 +23,8 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" oteltrace "go.opentelemetry.io/otel/trace" @@ -73,7 +73,7 @@ func initTracer() { func getUser(c *gin.Context, id string) string { // Pass the built-in `context.Context` object from http.Request to OpenTelemetry APIs // where required. It is available from gin.Context.Request.Context() - _, span := tracer.Start(c.Request.Context(), "getUser", oteltrace.WithAttributes(label.String("id", id))) + _, span := tracer.Start(c.Request.Context(), "getUser", oteltrace.WithAttributes(attribute.String("id", id))) defer span.End() if id == "123" { return "otelgin tester" diff --git a/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go b/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go index 1f6f2ba5ce1..44693359148 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go @@ -26,7 +26,8 @@ import ( otelcontrib "go.opentelemetry.io/contrib" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" oteltrace "go.opentelemetry.io/otel/trace" ) @@ -60,7 +61,7 @@ func Middleware(service string, opts ...Option) gin.HandlerFunc { defer func() { c.Request = c.Request.WithContext(savedCtx) }() - ctx := cfg.Propagators.Extract(savedCtx, c.Request.Header) + ctx := cfg.Propagators.Extract(savedCtx, propagation.HeaderCarrier(c.Request.Header)) opts := []oteltrace.SpanOption{ oteltrace.WithAttributes(semconv.NetAttributesFromHTTPRequest("tcp", c.Request)...), oteltrace.WithAttributes(semconv.EndUserAttributesFromHTTPRequest(c.Request)...), @@ -86,7 +87,7 @@ func Middleware(service string, opts ...Option) gin.HandlerFunc { span.SetAttributes(attrs...) span.SetStatus(spanStatus, spanMessage) if len(c.Errors) > 0 { - span.SetAttributes(label.String("gin.errors", c.Errors.String())) + span.SetAttributes(attribute.String("gin.errors", c.Errors.String())) } } } @@ -111,7 +112,7 @@ func HTML(c *gin.Context, code int, name string, obj interface{}) { defer func() { c.Request = c.Request.WithContext(savedContext) }() - opt := oteltrace.WithAttributes(label.String("go.template", name)) + opt := oteltrace.WithAttributes(attribute.String("go.template", name)) _, span := tracer.Start(savedContext, "gin.renderer.html", opt) defer func() { if r := recover(); r != nil { diff --git a/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace_test.go b/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace_test.go index 3cc88fd715f..ba77695ff9b 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace_test.go +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace_test.go @@ -34,7 +34,7 @@ import ( "go.opentelemetry.io/otel/propagation" b3prop "go.opentelemetry.io/contrib/propagators/b3" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" oteltrace "go.opentelemetry.io/otel/trace" ) @@ -85,7 +85,7 @@ func TestChildSpanFromCustomTracer(t *testing.T) { } func TestTrace200(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) router := gin.New() @@ -94,7 +94,7 @@ func TestTrace200(t *testing.T) { span := oteltrace.SpanFromContext(c.Request.Context()) mspan, ok := span.(*oteltest.Span) require.True(t, ok) - assert.Equal(t, label.StringValue("foobar"), mspan.Attributes()["http.server_name"]) + assert.Equal(t, attribute.StringValue("foobar"), mspan.Attributes()["http.server_name"]) id := c.Param("id") _, _ = c.Writer.Write([]byte(id)) }) @@ -113,15 +113,15 @@ func TestTrace200(t *testing.T) { span := spans[0] assert.Equal(t, "/user/:id", span.Name()) assert.Equal(t, oteltrace.SpanKindServer, span.SpanKind()) - assert.Equal(t, label.StringValue("foobar"), span.Attributes()["http.server_name"]) - assert.Equal(t, label.IntValue(http.StatusOK), span.Attributes()["http.status_code"]) - assert.Equal(t, label.StringValue("GET"), span.Attributes()["http.method"]) - assert.Equal(t, label.StringValue("/user/123"), span.Attributes()["http.target"]) - assert.Equal(t, label.StringValue("/user/:id"), span.Attributes()["http.route"]) + assert.Equal(t, attribute.StringValue("foobar"), span.Attributes()["http.server_name"]) + assert.Equal(t, attribute.IntValue(http.StatusOK), span.Attributes()["http.status_code"]) + assert.Equal(t, attribute.StringValue("GET"), span.Attributes()["http.method"]) + assert.Equal(t, attribute.StringValue("/user/123"), span.Attributes()["http.target"]) + assert.Equal(t, attribute.StringValue("/user/:id"), span.Attributes()["http.route"]) } func TestError(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // setup @@ -144,15 +144,15 @@ func TestError(t *testing.T) { require.Len(t, spans, 1) span := spans[0] assert.Equal(t, "/server_err", span.Name()) - assert.Equal(t, label.StringValue("foobar"), span.Attributes()["http.server_name"]) - assert.Equal(t, label.IntValue(http.StatusInternalServerError), span.Attributes()["http.status_code"]) - assert.Equal(t, label.StringValue("Error #01: oh no\n"), span.Attributes()["gin.errors"]) + assert.Equal(t, attribute.StringValue("foobar"), span.Attributes()["http.server_name"]) + assert.Equal(t, attribute.IntValue(http.StatusInternalServerError), span.Attributes()["http.status_code"]) + assert.Equal(t, attribute.StringValue("Error #01: oh no\n"), span.Attributes()["gin.errors"]) // server errors set the status assert.Equal(t, codes.Error, span.StatusCode()) } func TestHTML(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // setup @@ -187,7 +187,7 @@ func TestHTML(t *testing.T) { } } require.NotNil(t, tspan) - assert.Equal(t, label.StringValue("hello"), tspan.Attributes()["go.template"]) + assert.Equal(t, attribute.StringValue("hello"), tspan.Attributes()["go.template"]) } func TestGetSpanNotInstrumented(t *testing.T) { @@ -207,7 +207,7 @@ func TestGetSpanNotInstrumented(t *testing.T) { } func TestPropagationWithGlobalPropagators(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) otel.SetTextMapPropagator(b3prop.B3{}) @@ -215,7 +215,7 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - otel.GetTextMapPropagator().Inject(ctx, r.Header) + otel.GetTextMapPropagator().Inject(ctx, propagation.HeaderCarrier(r.Header)) router := gin.New() router.Use(Middleware("foobar", WithTracerProvider(provider))) @@ -232,7 +232,7 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { } func TestPropagationWithCustomPropagators(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) b3 := b3prop.B3{} @@ -240,7 +240,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - b3.Inject(ctx, r.Header) + b3.Inject(ctx, propagation.HeaderCarrier(r.Header)) router := gin.New() router.Use(Middleware("foobar", WithTracerProvider(provider), WithPropagators(b3))) diff --git a/instrumentation/github.com/gin-gonic/gin/otelgin/go.mod b/instrumentation/github.com/gin-gonic/gin/otelgin/go.mod index e3dcf56a221..8643a8aa79a 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/go.mod +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/go.mod @@ -10,9 +10,9 @@ replace ( require ( github.com/gin-gonic/gin v1.6.3 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/contrib v0.17.0 - go.opentelemetry.io/contrib/propagators 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/contrib/propagators 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/github.com/gin-gonic/gin/otelgin/go.sum b/instrumentation/github.com/gin-gonic/gin/otelgin/go.sum index e34b687d282..b70a3d65ada 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/go.sum +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/go.sum @@ -42,14 +42,14 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -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/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/cass.go b/instrumentation/github.com/gocql/gocql/otelgocql/cass.go index bd10e36c7b6..bc9a7cdacbb 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/cass.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/cass.go @@ -15,39 +15,39 @@ package otelgocql import ( - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/semconv" ) const ( // cassVersionKey is the key for the attribute/label describing // the cql version. - cassVersionKey = label.Key("db.cassandra.version") + cassVersionKey = attribute.Key("db.cassandra.version") // cassHostIDKey is the key for the attribute/label describing the id // of the host being queried. - cassHostIDKey = label.Key("db.cassandra.host.id") + cassHostIDKey = attribute.Key("db.cassandra.host.id") // cassHostStateKey is the key for the attribute/label describing // the state of the casssandra server hosting the node being queried. - cassHostStateKey = label.Key("db.cassandra.host.state") + cassHostStateKey = attribute.Key("db.cassandra.host.state") // cassBatchQueriesKey is the key for the attribute describing // the number of queries contained within the batch statement. - cassBatchQueriesKey = label.Key("db.cassandra.batch.queries") + cassBatchQueriesKey = attribute.Key("db.cassandra.batch.queries") // cassErrMsgKey is the key for the attribute/label describing // the error message from an error encountered when executing a query, batch, // or connection attempt to the cassandra server. - cassErrMsgKey = label.Key("db.cassandra.error.message") + cassErrMsgKey = attribute.Key("db.cassandra.error.message") // cassRowsReturnedKey is the key for the span attribute describing the number of rows // returned on a query to the database. - cassRowsReturnedKey = label.Key("db.cassandra.rows.returned") + cassRowsReturnedKey = attribute.Key("db.cassandra.rows.returned") // cassQueryAttemptsKey is the key for the span attribute describing the number of attempts // made for the query in question. - cassQueryAttemptsKey = label.Key("db.cassandra.attempts") + cassQueryAttemptsKey = attribute.Key("db.cassandra.attempts") // Static span names cassBatchQueryName = "Batch Query" @@ -61,40 +61,40 @@ const ( // cassDBSystem returns the name of the DB system, // cassandra, as a KeyValue pair (db.system). -func cassDBSystem() label.KeyValue { +func cassDBSystem() attribute.KeyValue { return semconv.DBSystemCassandra } // cassPeerName returns the hostname of the cassandra // server as a semconv KeyValue pair (net.peer.name). -func cassPeerName(name string) label.KeyValue { +func cassPeerName(name string) attribute.KeyValue { return semconv.NetPeerNameKey.String(name) } // cassPeerPort returns the port number of the cassandra // server as a semconv KeyValue pair (net.peer.port). -func cassPeerPort(port int) label.KeyValue { +func cassPeerPort(port int) attribute.KeyValue { return semconv.NetPeerPortKey.Int(port) } // cassPeerIP returns the IP address of the cassandra // server as a semconv KeyValue pair (net.peer.ip). -func cassPeerIP(ip string) label.KeyValue { +func cassPeerIP(ip string) attribute.KeyValue { return semconv.NetPeerIPKey.String(ip) } // cassVersion returns the cql version as a KeyValue pair. -func cassVersion(version string) label.KeyValue { +func cassVersion(version string) attribute.KeyValue { return cassVersionKey.String(version) } // cassHostID returns the id of the cassandra host as a KeyValue pair. -func cassHostID(id string) label.KeyValue { +func cassHostID(id string) attribute.KeyValue { return cassHostIDKey.String(id) } // cassHostState returns the state of the cassandra host as a KeyValue pair. -func cassHostState(state string) label.KeyValue { +func cassHostState(state string) attribute.KeyValue { return cassHostStateKey.String(state) } @@ -102,7 +102,7 @@ func cassHostState(state string) label.KeyValue { // cassStatement returns the statement made to the cassandra database as a // semconv KeyValue pair (db.statement). -func cassStatement(stmt string) label.KeyValue { +func cassStatement(stmt string) attribute.KeyValue { return semconv.DBStatementKey.String(stmt) } @@ -110,7 +110,7 @@ func cassStatement(stmt string) label.KeyValue { // as a semconv KeyValue pair (db.operation). This is used in lieu of a // db.statement, which is not feasible to include in a span for a batch query // because there can be n different query statements in a batch query. -func cassBatchQueryOperation() label.KeyValue { +func cassBatchQueryOperation() attribute.KeyValue { cassBatchQueryOperation := "db.cassandra.batch.query" return semconv.DBOperationKey.String(cassBatchQueryOperation) } @@ -118,37 +118,37 @@ func cassBatchQueryOperation() label.KeyValue { // cassConnectOperation returns the connect operation // as a semconv KeyValue pair (db.operation). This is used in lieu of a // db.statement since connection creation does not have a CQL statement. -func cassConnectOperation() label.KeyValue { +func cassConnectOperation() attribute.KeyValue { cassConnectOperation := "db.cassandra.connect" return semconv.DBOperationKey.String(cassConnectOperation) } // cassKeyspace returns the keyspace of the session as // a semconv KeyValue pair (db.cassandra.keyspace). -func cassKeyspace(keyspace string) label.KeyValue { +func cassKeyspace(keyspace string) attribute.KeyValue { return semconv.DBCassandraKeyspaceKey.String(keyspace) } // cassBatchQueries returns the number of queries in a batch query // as a KeyValue pair. -func cassBatchQueries(num int) label.KeyValue { +func cassBatchQueries(num int) attribute.KeyValue { return cassBatchQueriesKey.Int(num) } // cassErrMsg returns the KeyValue pair of an error message // encountered when executing a query, batch query, or error. -func cassErrMsg(msg string) label.KeyValue { +func cassErrMsg(msg string) attribute.KeyValue { return cassErrMsgKey.String(msg) } // cassRowsReturned returns the KeyValue pair of the number of rows // returned from a query. -func cassRowsReturned(rows int) label.KeyValue { +func cassRowsReturned(rows int) attribute.KeyValue { return cassRowsReturnedKey.Int(rows) } // cassQueryAttempts returns the KeyValue pair of the number of attempts // made for a query. -func cassQueryAttempts(num int) label.KeyValue { +func cassQueryAttempts(num int) attribute.KeyValue { return cassQueryAttemptsKey.Int(num) } diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod index fa19db61833..4a2f3fc2bed 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod +++ b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod @@ -9,8 +9,8 @@ replace ( require ( github.com/gocql/gocql v0.0.0-20200624222514-34081eda590e - go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql v0.17.0 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/exporters/metric/prometheus v0.17.0 - go.opentelemetry.io/otel/exporters/trace/zipkin v0.17.0 + go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql v0.18.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/exporters/metric/prometheus v0.18.0 + go.opentelemetry.io/otel/exporters/trace/zipkin v0.18.0 ) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum index 4ae886d283f..be23f854a35 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum +++ b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum @@ -297,24 +297,24 @@ go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mI go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -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/metric/prometheus v0.17.0 h1:36x/2SxZqIx0f/T5+nEwKHMPd3pKTJvP7JvdWD2E1hw= -go.opentelemetry.io/otel/exporters/metric/prometheus v0.17.0/go.mod h1:FpM7K2k0TgHMzrsRM5UFCxJzOJqu1Vitcv8bUc7xZXg= -go.opentelemetry.io/otel/exporters/trace/zipkin v0.17.0 h1:MZCDtOZyy0yYkYn7WvSb4sZhB+4S5wJPJbLJmI2Pqzk= -go.opentelemetry.io/otel/exporters/trace/zipkin v0.17.0/go.mod h1:jVYVMgPqD5Dw41qTcfx5aZCFkkteGRn5dr287vi8UBg= -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/metric/prometheus v0.18.0 h1:bSRjFukkFjoLMKikODjMZcD0Nn9x1tJ3Jfqzvj3Holk= +go.opentelemetry.io/otel/exporters/metric/prometheus v0.18.0/go.mod h1:MNe0UxqOWNGIJaIy5j5QOcCB11tyCDAy0D9cnbuKthc= +go.opentelemetry.io/otel/exporters/trace/zipkin v0.18.0 h1:Rkfcp/XuvTK3VHJbgBq9nPe+wzgWvbCag3jJz5rSqJQ= +go.opentelemetry.io/otel/exporters/trace/zipkin v0.18.0/go.mod h1:h+VTl0/9gV86ctHBUlwaZ4MuIEbUFMXVp1AIk+UvQMI= +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= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/go.mod index 43b276b3194..ce8d6bf7ded 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/go.mod +++ b/instrumentation/github.com/gocql/gocql/otelgocql/go.mod @@ -8,9 +8,9 @@ require ( github.com/gocql/gocql v0.0.0-20200624222514-34081eda590e github.com/golang/snappy v0.0.1 // indirect 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/metric 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/metric v0.18.0 + go.opentelemetry.io/otel/oteltest v0.18.0 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/go.sum index 28a38c328b0..875cf120a88 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/go.sum +++ b/instrumentation/github.com/gocql/gocql/otelgocql/go.sum @@ -26,14 +26,14 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 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/github.com/gocql/gocql/otelgocql/gocql_test.go b/instrumentation/github.com/gocql/gocql/otelgocql/gocql_test.go index 1685f6c7747..8abc57a0443 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/gocql_test.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/gocql_test.go @@ -28,7 +28,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/internal/util" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/semconv" @@ -51,7 +51,7 @@ func (m *mockConnectObserver) ObserveConnect(observedConnect gocql.ObservedConne type testRecord struct { name string meterName string - labels []label.KeyValue + attributes []attribute.KeyValue number number.Number numberKind number.Kind } @@ -59,7 +59,7 @@ type testRecord struct { func TestQuery(t *testing.T) { defer afterEach() cluster := getCluster() - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) meterImpl, meterProvider := oteltest.NewMeterProvider() @@ -114,7 +114,7 @@ func TestQuery(t *testing.T) { { name: "db.cassandra.queries", meterName: instrumentationName, - labels: []label.KeyValue{ + attributes: []attribute.KeyValue{ cassDBSystem(), cassPeerIP("127.0.0.1"), cassPeerPort(9042), @@ -129,7 +129,7 @@ func TestQuery(t *testing.T) { { name: "db.cassandra.rows", meterName: instrumentationName, - labels: []label.KeyValue{ + attributes: []attribute.KeyValue{ cassDBSystem(), cassPeerIP("127.0.0.1"), cassPeerPort(9042), @@ -143,7 +143,7 @@ func TestQuery(t *testing.T) { { name: "db.cassandra.latency", meterName: instrumentationName, - labels: []label.KeyValue{ + attributes: []attribute.KeyValue{ cassDBSystem(), cassPeerIP("127.0.0.1"), cassPeerPort(9042), @@ -177,7 +177,7 @@ func TestQuery(t *testing.T) { func TestBatch(t *testing.T) { defer afterEach() cluster := getCluster() - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) meterImpl, meterProvider := oteltest.NewMeterProvider() @@ -227,7 +227,7 @@ func TestBatch(t *testing.T) { { name: "db.cassandra.batch.queries", meterName: instrumentationName, - labels: []label.KeyValue{ + attributes: []attribute.KeyValue{ cassDBSystem(), cassPeerIP("127.0.0.1"), cassPeerPort(9042), @@ -241,7 +241,7 @@ func TestBatch(t *testing.T) { { name: "db.cassandra.latency", meterName: instrumentationName, - labels: []label.KeyValue{ + attributes: []attribute.KeyValue{ cassDBSystem(), cassPeerIP("127.0.0.1"), cassPeerPort(9042), @@ -271,7 +271,7 @@ func TestBatch(t *testing.T) { func TestConnection(t *testing.T) { defer afterEach() cluster := getCluster() - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) meterImpl, meterProvider := oteltest.NewMeterProvider() connectObserver := &mockConnectObserver{0} @@ -305,7 +305,7 @@ func TestConnection(t *testing.T) { { name: "db.cassandra.connections", meterName: instrumentationName, - labels: []label.KeyValue{ + attributes: []attribute.KeyValue{ cassDBSystem(), cassPeerIP("127.0.0.1"), cassPeerPort(9042), @@ -347,7 +347,7 @@ func assertConnectionLevelAttributes(t *testing.T, span *oteltest.Span) { semconv.DBSystemCassandra.Value.AsString(), ) assert.Equal(t, "127.0.0.1", span.Attributes()[semconv.NetPeerIPKey].AsString()) - assert.Equal(t, int32(9042), span.Attributes()[semconv.NetPeerPortKey].AsInt32()) + assert.Equal(t, int64(9042), span.Attributes()[semconv.NetPeerPortKey].AsInt64()) assert.Contains(t, span.Attributes(), cassVersionKey) assert.Contains(t, span.Attributes(), cassHostIDKey) assert.Equal(t, "up", strings.ToLower(span.Attributes()[cassHostStateKey].AsString())) @@ -375,7 +375,7 @@ func obtainTestRecords(mbs []oteltest.Batch) []testRecord { testRecord{ name: m.Instrument.Descriptor().Name(), meterName: m.Instrument.Descriptor().InstrumentationName(), - labels: mb.Labels, + attributes: mb.Labels, number: m.Number, numberKind: m.Instrument.Descriptor().NumberKind(), }, @@ -390,15 +390,15 @@ func obtainTestRecords(mbs []oteltest.Batch) []testRecord { func recordEqual(t *testing.T, expected testRecord, actual testRecord) { assert.Equal(t, expected.name, actual.name) assert.Equal(t, expected.meterName, actual.meterName) - require.Len(t, actual.labels, len(expected.labels)) - actualSet := label.NewSet(actual.labels...) - for _, label := range expected.labels { - actualValue, ok := actualSet.Value(label.Key) + require.Len(t, actual.attributes, len(expected.attributes)) + actualSet := attribute.NewSet(actual.attributes...) + for _, attribute := range expected.attributes { + actualValue, ok := actualSet.Value(attribute.Key) assert.True(t, ok) assert.NotNil(t, actualValue) // Can't test equality of host id - if label.Key != cassHostIDKey && label.Key != cassVersionKey { - assert.Equal(t, label.Value, actualValue) + if attribute.Key != cassHostIDKey && attribute.Key != cassVersionKey { + assert.Equal(t, attribute.Value, actualValue) } else { assert.NotEmpty(t, actualValue) } diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/observer.go b/instrumentation/github.com/gocql/gocql/otelgocql/observer.go index 449152ad252..583184dc2ad 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/observer.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/observer.go @@ -22,7 +22,7 @@ import ( "github.com/gocql/gocql" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" ) @@ -217,8 +217,8 @@ func (o *OTelConnectObserver) ObserveConnect(observedConnect gocql.ObservedConne // span or instrument. By default, this function includes connection-level attributes, // (as per the semantic conventions) which have been made standard for all spans and metrics // generated by this instrumentation integration. -func includeKeyValues(host *gocql.HostInfo, values ...label.KeyValue) []label.KeyValue { - connectionLevelAttributes := []label.KeyValue{ +func includeKeyValues(host *gocql.HostInfo, values ...attribute.KeyValue) []attribute.KeyValue { + connectionLevelAttributes := []attribute.KeyValue{ cassDBSystem(), hostOrIP(host.HostnameAndPort()), cassPeerPort(host.Port()), @@ -234,7 +234,7 @@ func includeKeyValues(host *gocql.HostInfo, values ...label.KeyValue) []label.Ke // is returned as a resolved IP address (as is the case for localhost), // then the KeyValue will have the key net.peer.ip. // If the hostname is the proper DNS name, then the key will be net.peer.name. -func hostOrIP(hostnameAndPort string) label.KeyValue { +func hostOrIP(hostnameAndPort string) attribute.KeyValue { hostname, _, err := net.SplitHostPort(hostnameAndPort) if err != nil { log.Printf("failed to parse hostname from port, %v", err) diff --git a/instrumentation/github.com/gorilla/mux/otelmux/example/go.mod b/instrumentation/github.com/gorilla/mux/otelmux/example/go.mod index 55265416026..66afea00546 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/example/go.mod +++ b/instrumentation/github.com/gorilla/mux/otelmux/example/go.mod @@ -10,9 +10,9 @@ replace ( require ( github.com/gorilla/mux v1.8.0 - go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux 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/otel/trace v0.17.0 + go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux 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 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/github.com/gorilla/mux/otelmux/example/go.sum b/instrumentation/github.com/gorilla/mux/otelmux/example/go.sum index b6a8c8381a4..57f39405e03 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/example/go.sum +++ b/instrumentation/github.com/gorilla/mux/otelmux/example/go.sum @@ -13,22 +13,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/github.com/gorilla/mux/otelmux/example/server.go b/instrumentation/github.com/gorilla/mux/otelmux/example/server.go index ab8beaa6a17..0194b216972 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/example/server.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/example/server.go @@ -24,8 +24,8 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" oteltrace "go.opentelemetry.io/otel/trace" @@ -68,7 +68,7 @@ func initTracer() { } func getUser(ctx context.Context, id string) string { - _, span := tracer.Start(ctx, "getUser", oteltrace.WithAttributes(label.String("id", id))) + _, span := tracer.Start(ctx, "getUser", oteltrace.WithAttributes(attribute.String("id", id))) defer span.End() if id == "123" { return "otelmux tester" diff --git a/instrumentation/github.com/gorilla/mux/otelmux/go.mod b/instrumentation/github.com/gorilla/mux/otelmux/go.mod index 4b65ca58e33..d98fe70a082 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/go.mod +++ b/instrumentation/github.com/gorilla/mux/otelmux/go.mod @@ -11,9 +11,9 @@ require ( github.com/felixge/httpsnoop v1.0.1 github.com/gorilla/mux v1.8.0 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/contrib v0.17.0 - go.opentelemetry.io/contrib/propagators 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/contrib/propagators 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/github.com/gorilla/mux/otelmux/go.sum b/instrumentation/github.com/gorilla/mux/otelmux/go.sum index 5f3d62c6583..6a4f97b84e4 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/go.sum +++ b/instrumentation/github.com/gorilla/mux/otelmux/go.sum @@ -12,14 +12,14 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/github.com/gorilla/mux/otelmux/mux.go b/instrumentation/github.com/gorilla/mux/otelmux/mux.go index 2fac063b128..3d297a9fffa 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/mux.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/mux.go @@ -116,7 +116,7 @@ func putRRW(rrw *recordingResponseWriter) { // ServeHTTP implements the http.Handler interface. It does the actual // tracing of the request. func (tw traceware) ServeHTTP(w http.ResponseWriter, r *http.Request) { - ctx := tw.propagators.Extract(r.Context(), r.Header) + ctx := tw.propagators.Extract(r.Context(), propagation.HeaderCarrier(r.Header)) spanName := "" route := mux.CurrentRoute(r) if route != nil { diff --git a/instrumentation/github.com/gorilla/mux/otelmux/mux_test.go b/instrumentation/github.com/gorilla/mux/otelmux/mux_test.go index 5437716eacb..f626a19bf79 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/mux_test.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/mux_test.go @@ -29,7 +29,7 @@ import ( b3prop "go.opentelemetry.io/contrib/propagators/b3" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/propagation" oteltrace "go.opentelemetry.io/otel/trace" @@ -80,7 +80,7 @@ func TestChildSpanFromCustomTracer(t *testing.T) { } func TestChildSpanNames(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) router := mux.NewRouter() @@ -100,11 +100,11 @@ func TestChildSpanNames(t *testing.T) { span := spans[0] assert.Equal(t, "/user/{id:[0-9]+}", span.Name()) assert.Equal(t, oteltrace.SpanKindServer, span.SpanKind()) - assert.Equal(t, label.StringValue("foobar"), span.Attributes()["http.server_name"]) - assert.Equal(t, label.IntValue(http.StatusOK), span.Attributes()["http.status_code"]) - assert.Equal(t, label.StringValue("GET"), span.Attributes()["http.method"]) - assert.Equal(t, label.StringValue("/user/123"), span.Attributes()["http.target"]) - assert.Equal(t, label.StringValue("/user/{id:[0-9]+}"), span.Attributes()["http.route"]) + assert.Equal(t, attribute.StringValue("foobar"), span.Attributes()["http.server_name"]) + assert.Equal(t, attribute.IntValue(http.StatusOK), span.Attributes()["http.status_code"]) + assert.Equal(t, attribute.StringValue("GET"), span.Attributes()["http.method"]) + assert.Equal(t, attribute.StringValue("/user/123"), span.Attributes()["http.target"]) + assert.Equal(t, attribute.StringValue("/user/{id:[0-9]+}"), span.Attributes()["http.route"]) r = httptest.NewRequest("GET", "/book/foo", nil) w = httptest.NewRecorder() @@ -114,11 +114,11 @@ func TestChildSpanNames(t *testing.T) { span = spans[1] assert.Equal(t, "/book/{title}", span.Name()) assert.Equal(t, oteltrace.SpanKindServer, span.SpanKind()) - assert.Equal(t, label.StringValue("foobar"), span.Attributes()["http.server_name"]) - assert.Equal(t, label.IntValue(http.StatusOK), span.Attributes()["http.status_code"]) - assert.Equal(t, label.StringValue("GET"), span.Attributes()["http.method"]) - assert.Equal(t, label.StringValue("/book/foo"), span.Attributes()["http.target"]) - assert.Equal(t, label.StringValue("/book/{title}"), span.Attributes()["http.route"]) + assert.Equal(t, attribute.StringValue("foobar"), span.Attributes()["http.server_name"]) + assert.Equal(t, attribute.IntValue(http.StatusOK), span.Attributes()["http.status_code"]) + assert.Equal(t, attribute.StringValue("GET"), span.Attributes()["http.method"]) + assert.Equal(t, attribute.StringValue("/book/foo"), span.Attributes()["http.target"]) + assert.Equal(t, attribute.StringValue("/book/{title}"), span.Attributes()["http.route"]) } func TestGetSpanNotInstrumented(t *testing.T) { @@ -137,7 +137,7 @@ func TestGetSpanNotInstrumented(t *testing.T) { } func TestPropagationWithGlobalPropagators(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) otel.SetTextMapPropagator(propagation.TraceContext{}) @@ -145,7 +145,7 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - otel.GetTextMapPropagator().Inject(ctx, r.Header) + otel.GetTextMapPropagator().Inject(ctx, propagation.HeaderCarrier(r.Header)) router := mux.NewRouter() router.Use(Middleware("foobar", WithTracerProvider(provider))) @@ -163,7 +163,7 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { } func TestPropagationWithCustomPropagators(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) b3 := b3prop.B3{} @@ -172,7 +172,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - b3.Inject(ctx, r.Header) + b3.Inject(ctx, propagation.HeaderCarrier(r.Header)) router := mux.NewRouter() router.Use(Middleware("foobar", WithTracerProvider(provider), WithPropagators(b3))) diff --git a/instrumentation/github.com/labstack/echo/otelecho/echo.go b/instrumentation/github.com/labstack/echo/otelecho/echo.go index 05904db420c..2819d420c2e 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/echo.go +++ b/instrumentation/github.com/labstack/echo/otelecho/echo.go @@ -22,7 +22,8 @@ import ( otelcontrib "go.opentelemetry.io/contrib" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" oteltrace "go.opentelemetry.io/otel/trace" ) @@ -57,7 +58,7 @@ func Middleware(service string, opts ...Option) echo.MiddlewareFunc { request = request.WithContext(savedCtx) c.SetRequest(request) }() - ctx := cfg.Propagators.Extract(savedCtx, request.Header) + ctx := cfg.Propagators.Extract(savedCtx, propagation.HeaderCarrier(request.Header)) opts := []oteltrace.SpanOption{ oteltrace.WithAttributes(semconv.NetAttributesFromHTTPRequest("tcp", request)...), oteltrace.WithAttributes(semconv.EndUserAttributesFromHTTPRequest(request)...), @@ -78,7 +79,7 @@ func Middleware(service string, opts ...Option) echo.MiddlewareFunc { // serve the request to the next middleware err := next(c) if err != nil { - span.SetAttributes(label.String("echo.error", err.Error())) + span.SetAttributes(attribute.String("echo.error", err.Error())) // invokes the registered HTTP error handler c.Error(err) } diff --git a/instrumentation/github.com/labstack/echo/otelecho/echo_test.go b/instrumentation/github.com/labstack/echo/otelecho/echo_test.go index 03739b915b3..0dbee772428 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/echo_test.go +++ b/instrumentation/github.com/labstack/echo/otelecho/echo_test.go @@ -34,7 +34,7 @@ import ( "go.opentelemetry.io/otel/propagation" b3prop "go.opentelemetry.io/contrib/propagators/b3" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" oteltrace "go.opentelemetry.io/otel/trace" ) @@ -83,7 +83,7 @@ func TestChildSpanFromCustomTracer(t *testing.T) { } func TestTrace200(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) router := echo.New() @@ -92,7 +92,7 @@ func TestTrace200(t *testing.T) { span := oteltrace.SpanFromContext(c.Request().Context()) mspan, ok := span.(*oteltest.Span) require.True(t, ok) - assert.Equal(t, label.StringValue("foobar"), mspan.Attributes()["http.server_name"]) + assert.Equal(t, attribute.StringValue("foobar"), mspan.Attributes()["http.server_name"]) id := c.Param("id") return c.String(200, id) }) @@ -111,15 +111,15 @@ func TestTrace200(t *testing.T) { span := spans[0] assert.Equal(t, "/user/:id", span.Name()) assert.Equal(t, oteltrace.SpanKindServer, span.SpanKind()) - assert.Equal(t, label.StringValue("foobar"), span.Attributes()["http.server_name"]) - assert.Equal(t, label.IntValue(http.StatusOK), span.Attributes()["http.status_code"]) - assert.Equal(t, label.StringValue("GET"), span.Attributes()["http.method"]) - assert.Equal(t, label.StringValue("/user/123"), span.Attributes()["http.target"]) - assert.Equal(t, label.StringValue("/user/:id"), span.Attributes()["http.route"]) + assert.Equal(t, attribute.StringValue("foobar"), span.Attributes()["http.server_name"]) + assert.Equal(t, attribute.IntValue(http.StatusOK), span.Attributes()["http.status_code"]) + assert.Equal(t, attribute.StringValue("GET"), span.Attributes()["http.method"]) + assert.Equal(t, attribute.StringValue("/user/123"), span.Attributes()["http.target"]) + assert.Equal(t, attribute.StringValue("/user/:id"), span.Attributes()["http.route"]) } func TestError(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // setup @@ -142,9 +142,9 @@ func TestError(t *testing.T) { require.Len(t, spans, 1) span := spans[0] assert.Equal(t, "/server_err", span.Name()) - assert.Equal(t, label.StringValue("foobar"), span.Attributes()["http.server_name"]) - assert.Equal(t, label.IntValue(http.StatusInternalServerError), span.Attributes()["http.status_code"]) - assert.Equal(t, label.StringValue("oh no"), span.Attributes()["echo.error"]) + assert.Equal(t, attribute.StringValue("foobar"), span.Attributes()["http.server_name"]) + assert.Equal(t, attribute.IntValue(http.StatusInternalServerError), span.Attributes()["http.status_code"]) + assert.Equal(t, attribute.StringValue("oh no"), span.Attributes()["echo.error"]) // server errors set the status assert.Equal(t, codes.Error, span.StatusCode()) } @@ -183,7 +183,7 @@ func TestGetSpanNotInstrumented(t *testing.T) { } func TestPropagationWithGlobalPropagators(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) otel.SetTextMapPropagator(propagation.TraceContext{}) @@ -191,7 +191,7 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - otel.GetTextMapPropagator().Inject(ctx, r.Header) + otel.GetTextMapPropagator().Inject(ctx, propagation.HeaderCarrier(r.Header)) router := echo.New() router.Use(Middleware("foobar", WithTracerProvider(provider))) @@ -209,7 +209,7 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { } func TestPropagationWithCustomPropagators(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) b3 := b3prop.B3{} @@ -218,7 +218,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - b3.Inject(ctx, r.Header) + b3.Inject(ctx, propagation.HeaderCarrier(r.Header)) router := echo.New() router.Use(Middleware("foobar", WithTracerProvider(provider), WithPropagators(b3))) diff --git a/instrumentation/github.com/labstack/echo/otelecho/example/go.mod b/instrumentation/github.com/labstack/echo/otelecho/example/go.mod index 13e66f6143a..db60508bd64 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/example/go.mod +++ b/instrumentation/github.com/labstack/echo/otelecho/example/go.mod @@ -10,9 +10,9 @@ replace ( require ( github.com/labstack/echo/v4 v4.2.0 - go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho 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/otel/trace v0.17.0 + go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho 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 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/github.com/labstack/echo/otelecho/example/go.sum b/instrumentation/github.com/labstack/echo/otelecho/example/go.sum index 2527403f66a..b7ef84d781c 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/example/go.sum +++ b/instrumentation/github.com/labstack/echo/otelecho/example/go.sum @@ -27,22 +27,22 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -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/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= diff --git a/instrumentation/github.com/labstack/echo/otelecho/example/server.go b/instrumentation/github.com/labstack/echo/otelecho/example/server.go index 876df9ac849..71c60fe5c26 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/example/server.go +++ b/instrumentation/github.com/labstack/echo/otelecho/example/server.go @@ -23,8 +23,8 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" oteltrace "go.opentelemetry.io/otel/trace" @@ -71,7 +71,7 @@ func initTracer() { } func getUser(ctx context.Context, id string) string { - _, span := tracer.Start(ctx, "getUser", oteltrace.WithAttributes(label.String("id", id))) + _, span := tracer.Start(ctx, "getUser", oteltrace.WithAttributes(attribute.String("id", id))) defer span.End() if id == "123" { return "otelecho tester" diff --git a/instrumentation/github.com/labstack/echo/otelecho/go.mod b/instrumentation/github.com/labstack/echo/otelecho/go.mod index d92016761b7..d78cfd84ebf 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/go.mod +++ b/instrumentation/github.com/labstack/echo/otelecho/go.mod @@ -10,9 +10,9 @@ replace ( require ( github.com/labstack/echo/v4 v4.2.0 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/contrib v0.17.0 - go.opentelemetry.io/contrib/propagators 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/contrib/propagators 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/github.com/labstack/echo/otelecho/go.sum b/instrumentation/github.com/labstack/echo/otelecho/go.sum index d8f40f55546..280430001c9 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/go.sum +++ b/instrumentation/github.com/labstack/echo/otelecho/go.sum @@ -27,14 +27,14 @@ github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyC github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -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/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/db.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/db.go index 4def5afb13c..56d180082b4 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/db.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/db.go @@ -14,43 +14,43 @@ package otelmongo -import "go.opentelemetry.io/otel/label" +import "go.opentelemetry.io/otel/attribute" const ( - DBApplicationKey = label.Key("db.application") - DBNameKey = label.Key("db.name") - DBSystemKey = label.Key("db.system") - DBInstanceKey = label.Key("db.instance") - DBUserKey = label.Key("db.user") - DBStatementKey = label.Key("db.statement") + DBApplicationKey = attribute.Key("db.application") + DBNameKey = attribute.Key("db.name") + DBSystemKey = attribute.Key("db.system") + DBInstanceKey = attribute.Key("db.instance") + DBUserKey = attribute.Key("db.user") + DBStatementKey = attribute.Key("db.statement") ) // DBApplication indicates the application using the database. -func DBApplication(dbApplication string) label.KeyValue { +func DBApplication(dbApplication string) attribute.KeyValue { return DBApplicationKey.String(dbApplication) } // DBName indicates the database name. -func DBName(dbName string) label.KeyValue { +func DBName(dbName string) attribute.KeyValue { return DBNameKey.String(dbName) } // DBSystem indicates the system of Database. -func DBSystem(dbType string) label.KeyValue { +func DBSystem(dbType string) attribute.KeyValue { return DBSystemKey.String(dbType) } // DBInstance indicates the instance name of Database. -func DBInstance(dbInstance string) label.KeyValue { +func DBInstance(dbInstance string) attribute.KeyValue { return DBInstanceKey.String(dbInstance) } // DBUser indicates the user name of Database, e.g. "readonly_user" or "reporting_user". -func DBUser(dbUser string) label.KeyValue { +func DBUser(dbUser string) attribute.KeyValue { return DBUserKey.String(dbUser) } // DBStatement records a database statement for the given database type. -func DBStatement(dbStatement string) label.KeyValue { +func DBStatement(dbStatement string) attribute.KeyValue { return DBStatementKey.String(dbStatement) } diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.mod b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.mod index caa29e1f28c..b11c2c09d24 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.mod +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.mod @@ -8,9 +8,9 @@ require ( github.com/stretchr/testify v1.7.0 github.com/xdg/stringprep v1.0.0 // indirect go.mongodb.org/mongo-driver v1.4.6 - 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 golang.org/x/crypto v0.0.0-20191105034135-c7e5f84aec59 // indirect ) diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.sum b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.sum index 56169321ebd..901f51cb655 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.sum +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.sum @@ -91,14 +91,14 @@ github.com/xdg/stringprep v1.0.0 h1:d9X0esnoa3dFsV0FG35rAT0RIhYFlPq7MiP+DW89La0= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= go.mongodb.org/mongo-driver v1.4.6 h1:rh7GdYmDrb8AQSkF8yteAus8qYOgOASWDOv1BWqBXkU= go.mongodb.org/mongo-driver v1.4.6/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= -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/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go index 89e00cede07..4b1bccb7a5f 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go @@ -20,7 +20,7 @@ import ( "strings" "sync" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" "go.mongodb.org/mongo-driver/bson" @@ -42,7 +42,7 @@ type monitor struct { func (m *monitor) Started(ctx context.Context, evt *event.CommandStartedEvent) { hostname, port := peerInfo(evt) b, _ := bson.MarshalExtJSON(evt.Command, false, false) - attrs := []label.KeyValue{ + attrs := []attribute.KeyValue{ ServiceName(m.serviceName), DBOperation(evt.CommandName), DBInstance(evt.DatabaseName), diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo_test.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo_test.go index 1fa6392b131..1afb3342db0 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo_test.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo_test.go @@ -35,7 +35,7 @@ func TestMain(m *testing.M) { } func Test(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) hostname, port := "localhost", "27017" diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/peer.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/peer.go index c0d1ed02199..962e081216a 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/peer.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/peer.go @@ -14,21 +14,21 @@ package otelmongo -import "go.opentelemetry.io/otel/label" +import "go.opentelemetry.io/otel/attribute" const ( // PeerHostname records the host name of the peer. - PeerHostnameKey = label.Key("peer.hostname") + PeerHostnameKey = attribute.Key("peer.hostname") // PeerPort records the port number of the peer. - PeerPortKey = label.Key("peer.port") + PeerPortKey = attribute.Key("peer.port") ) // PeerHostname records the host name of the peer. -func PeerHostname(peerHostname string) label.KeyValue { +func PeerHostname(peerHostname string) attribute.KeyValue { return PeerHostnameKey.String(peerHostname) } // PeerPort records the port number of the peer. -func PeerPort(peerport string) label.KeyValue { +func PeerPort(peerport string) attribute.KeyValue { return PeerPortKey.String(peerport) } diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/tags.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/tags.go index eda74ab8179..d50685f29c5 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/tags.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/tags.go @@ -14,43 +14,43 @@ package otelmongo -import "go.opentelemetry.io/otel/label" +import "go.opentelemetry.io/otel/attribute" const ( - TargetHostKey = label.Key("out.host") - TargetPortKey = label.Key("out.port") - ServiceNameKey = label.Key("service.name") - DBOperationKey = label.Key("db.operation") - ErrorKey = label.Key("error") - ErrorMsgKey = label.Key("error.msg") + TargetHostKey = attribute.Key("out.host") + TargetPortKey = attribute.Key("out.port") + ServiceNameKey = attribute.Key("service.name") + DBOperationKey = attribute.Key("db.operation") + ErrorKey = attribute.Key("error") + ErrorMsgKey = attribute.Key("error.msg") ) // TargetHost sets the target host address. -func TargetHost(targetHost string) label.KeyValue { +func TargetHost(targetHost string) attribute.KeyValue { return TargetHostKey.String(targetHost) } // TargetPort sets the target host port. -func TargetPort(targetPort string) label.KeyValue { +func TargetPort(targetPort string) attribute.KeyValue { return TargetPortKey.String(targetPort) } // ServiceName defines the Service name for this Span. -func ServiceName(serviceName string) label.KeyValue { +func ServiceName(serviceName string) attribute.KeyValue { return ServiceNameKey.String(serviceName) } // DBOperation defines the name of the operation. -func DBOperation(operation string) label.KeyValue { +func DBOperation(operation string) attribute.KeyValue { return DBOperationKey.String(operation) } // Error specifies whether an error occurred. -func Error(err bool) label.KeyValue { +func Error(err bool) attribute.KeyValue { return ErrorKey.Bool(err) } // ErrorMsg specifies the error message. -func ErrorMsg(errorMsg string) label.KeyValue { +func ErrorMsg(errorMsg string) attribute.KeyValue { return ErrorMsgKey.String(errorMsg) } diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod index c5fe30eae91..67090bf482b 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod +++ b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/golang/protobuf v1.4.3 - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc 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/google.golang.org/grpc/otelgrpc 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 golang.org/x/net v0.0.0-20200707034311-ab3426394381 google.golang.org/grpc v1.36.0 ) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum index daeb93f19a1..554f0bf1f30 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum +++ b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum @@ -46,22 +46,22 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 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= go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/go.mod b/instrumentation/google.golang.org/grpc/otelgrpc/go.mod index 075ccfee86e..e942fb8202e 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/go.mod +++ b/instrumentation/google.golang.org/grpc/otelgrpc/go.mod @@ -7,10 +7,10 @@ replace go.opentelemetry.io/contrib => ../../../../ require ( github.com/golang/protobuf v1.4.3 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 go.uber.org/goleak v1.1.10 google.golang.org/grpc v1.36.0 ) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/go.sum b/instrumentation/google.golang.org/grpc/otelgrpc/go.sum index 2d1f20d7d7f..48cff34792c 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/go.sum +++ b/instrumentation/google.golang.org/grpc/otelgrpc/go.sum @@ -45,14 +45,14 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 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= go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/grpc_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/grpc_test.go index 077ad053900..51a794f42f9 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/grpc_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/grpc_test.go @@ -28,7 +28,7 @@ import ( "google.golang.org/grpc/test/bufconn" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/semconv" ) @@ -72,16 +72,16 @@ func doCalls(cOpt []grpc.DialOption, sOpt []grpc.ServerOption) error { } func TestInterceptors(t *testing.T) { - clientUnarySR := new(oteltest.StandardSpanRecorder) + clientUnarySR := new(oteltest.SpanRecorder) clientUnaryTP := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(clientUnarySR)) - clientStreamSR := new(oteltest.StandardSpanRecorder) + clientStreamSR := new(oteltest.SpanRecorder) clientStreamTP := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(clientStreamSR)) - serverUnarySR := new(oteltest.StandardSpanRecorder) + serverUnarySR := new(oteltest.SpanRecorder) serverUnaryTP := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(serverUnarySR)) - serverStreamSR := new(oteltest.StandardSpanRecorder) + serverStreamSR := new(oteltest.SpanRecorder) serverStreamTP := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(serverStreamSR)) assert.NoError(t, doCalls( @@ -121,26 +121,26 @@ func checkUnaryClientSpans(t *testing.T, spans []*oteltest.Span) { assert.Equal(t, []oteltest.Event{ { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(0), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(0), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(0), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(0), }, }, }, noTimestamp(emptySpan.Events())) - assert.Equal(t, map[label.Key]label.Value{ - semconv.RPCMethodKey: label.StringValue("EmptyCall"), - semconv.RPCServiceKey: label.StringValue("grpc.testing.TestService"), + assert.Equal(t, map[attribute.Key]attribute.Value{ + semconv.RPCMethodKey: attribute.StringValue("EmptyCall"), + semconv.RPCServiceKey: attribute.StringValue("grpc.testing.TestService"), semconv.RPCSystemGRPC.Key: semconv.RPCSystemGRPC.Value, - otelgrpc.GRPCStatusCodeKey: label.Uint32Value(uint32(codes.OK)), + otelgrpc.GRPCStatusCodeKey: attribute.Int64Value(int64(codes.OK)), }, emptySpan.Attributes()) largeSpan := spans[1] @@ -149,28 +149,28 @@ func checkUnaryClientSpans(t *testing.T, spans []*oteltest.Span) { assert.Equal(t, []oteltest.Event{ { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), // largeReqSize from "google.golang.org/grpc/interop" + 12 (overhead). - semconv.RPCMessageUncompressedSizeKey: label.IntValue(271840), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(271840), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), // largeRespSize from "google.golang.org/grpc/interop" + 8 (overhead). - semconv.RPCMessageUncompressedSizeKey: label.IntValue(314167), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(314167), }, }, }, noTimestamp(largeSpan.Events())) - assert.Equal(t, map[label.Key]label.Value{ - semconv.RPCMethodKey: label.StringValue("UnaryCall"), - semconv.RPCServiceKey: label.StringValue("grpc.testing.TestService"), + assert.Equal(t, map[attribute.Key]attribute.Value{ + semconv.RPCMethodKey: attribute.StringValue("UnaryCall"), + semconv.RPCServiceKey: attribute.StringValue("grpc.testing.TestService"), semconv.RPCSystemGRPC.Key: semconv.RPCSystemGRPC.Value, - otelgrpc.GRPCStatusCodeKey: label.Uint32Value(uint32(codes.OK)), + otelgrpc.GRPCStatusCodeKey: attribute.Int64Value(int64(codes.OK)), }, largeSpan.Attributes()) } @@ -184,43 +184,43 @@ func checkStreamClientSpans(t *testing.T, spans []*oteltest.Span) { assert.Equal(t, []oteltest.Event{ { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(27190), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(27190), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(2), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(12), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(2), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(12), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(3), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(1834), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(3), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(1834), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(4), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(45912), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(4), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(45912), }, }, // client does not record an event for the server response. }, noTimestamp(streamInput.Events())) - assert.Equal(t, map[label.Key]label.Value{ - semconv.RPCMethodKey: label.StringValue("StreamingInputCall"), - semconv.RPCServiceKey: label.StringValue("grpc.testing.TestService"), + assert.Equal(t, map[attribute.Key]attribute.Value{ + semconv.RPCMethodKey: attribute.StringValue("StreamingInputCall"), + semconv.RPCServiceKey: attribute.StringValue("grpc.testing.TestService"), semconv.RPCSystemGRPC.Key: semconv.RPCSystemGRPC.Value, - otelgrpc.GRPCStatusCodeKey: label.Uint32Value(uint32(codes.OK)), + otelgrpc.GRPCStatusCodeKey: attribute.Int64Value(int64(codes.OK)), }, streamInput.Attributes()) streamOutput := spans[1] @@ -230,50 +230,50 @@ func checkStreamClientSpans(t *testing.T, spans []*oteltest.Span) { assert.Equal(t, []oteltest.Event{ { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(21), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(21), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(31423), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(31423), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(2), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(13), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(2), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(13), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(3), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(2659), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(3), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(2659), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(4), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(58987), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(4), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(58987), }, }, }, noTimestamp(streamOutput.Events())) - assert.Equal(t, map[label.Key]label.Value{ - semconv.RPCMethodKey: label.StringValue("StreamingOutputCall"), - semconv.RPCServiceKey: label.StringValue("grpc.testing.TestService"), + assert.Equal(t, map[attribute.Key]attribute.Value{ + semconv.RPCMethodKey: attribute.StringValue("StreamingOutputCall"), + semconv.RPCServiceKey: attribute.StringValue("grpc.testing.TestService"), semconv.RPCSystemGRPC.Key: semconv.RPCSystemGRPC.Value, - otelgrpc.GRPCStatusCodeKey: label.Uint32Value(uint32(codes.OK)), + otelgrpc.GRPCStatusCodeKey: attribute.Int64Value(int64(codes.OK)), }, streamOutput.Attributes()) pingPong := spans[2] @@ -282,74 +282,74 @@ func checkStreamClientSpans(t *testing.T, spans []*oteltest.Span) { assert.Equal(t, []oteltest.Event{ { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(27196), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(27196), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(31423), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(31423), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(2), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(16), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(2), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(16), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(2), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(13), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(2), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(13), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(3), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(1839), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(3), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(1839), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(3), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(2659), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(3), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(2659), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(4), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(45918), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(4), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(45918), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(4), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(58987), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(4), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(58987), }, }, }, noTimestamp(pingPong.Events())) - assert.Equal(t, map[label.Key]label.Value{ - semconv.RPCMethodKey: label.StringValue("FullDuplexCall"), - semconv.RPCServiceKey: label.StringValue("grpc.testing.TestService"), + assert.Equal(t, map[attribute.Key]attribute.Value{ + semconv.RPCMethodKey: attribute.StringValue("FullDuplexCall"), + semconv.RPCServiceKey: attribute.StringValue("grpc.testing.TestService"), semconv.RPCSystemGRPC.Key: semconv.RPCSystemGRPC.Value, - otelgrpc.GRPCStatusCodeKey: label.Uint32Value(uint32(codes.OK)), + otelgrpc.GRPCStatusCodeKey: attribute.Int64Value(int64(codes.OK)), }, pingPong.Attributes()) } @@ -363,50 +363,50 @@ func checkStreamServerSpans(t *testing.T, spans []*oteltest.Span) { assert.Equal(t, []oteltest.Event{ { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(27190), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(27190), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(2), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(12), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(2), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(12), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(3), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(1834), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(3), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(1834), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(4), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(45912), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(4), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(45912), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(4), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(4), }, }, }, noTimestamp(streamInput.Events())) - assert.Equal(t, map[label.Key]label.Value{ - semconv.RPCMethodKey: label.StringValue("StreamingInputCall"), - semconv.RPCServiceKey: label.StringValue("grpc.testing.TestService"), + assert.Equal(t, map[attribute.Key]attribute.Value{ + semconv.RPCMethodKey: attribute.StringValue("StreamingInputCall"), + semconv.RPCServiceKey: attribute.StringValue("grpc.testing.TestService"), semconv.RPCSystemGRPC.Key: semconv.RPCSystemGRPC.Value, - otelgrpc.GRPCStatusCodeKey: label.Uint32Value(uint32(codes.OK)), + otelgrpc.GRPCStatusCodeKey: attribute.Int64Value(int64(codes.OK)), }, streamInput.Attributes()) streamOutput := spans[1] @@ -416,50 +416,50 @@ func checkStreamServerSpans(t *testing.T, spans []*oteltest.Span) { assert.Equal(t, []oteltest.Event{ { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(21), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(21), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(31423), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(31423), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(2), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(13), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(2), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(13), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(3), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(2659), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(3), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(2659), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(4), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(58987), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(4), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(58987), }, }, }, noTimestamp(streamOutput.Events())) - assert.Equal(t, map[label.Key]label.Value{ - semconv.RPCMethodKey: label.StringValue("StreamingOutputCall"), - semconv.RPCServiceKey: label.StringValue("grpc.testing.TestService"), + assert.Equal(t, map[attribute.Key]attribute.Value{ + semconv.RPCMethodKey: attribute.StringValue("StreamingOutputCall"), + semconv.RPCServiceKey: attribute.StringValue("grpc.testing.TestService"), semconv.RPCSystemGRPC.Key: semconv.RPCSystemGRPC.Value, - otelgrpc.GRPCStatusCodeKey: label.Uint32Value(uint32(codes.OK)), + otelgrpc.GRPCStatusCodeKey: attribute.Int64Value(int64(codes.OK)), }, streamOutput.Attributes()) pingPong := spans[2] @@ -468,74 +468,74 @@ func checkStreamServerSpans(t *testing.T, spans []*oteltest.Span) { assert.Equal(t, []oteltest.Event{ { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(27196), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(27196), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(31423), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(31423), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(2), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(16), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(2), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(16), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(2), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(13), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(2), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(13), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(3), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(1839), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(3), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(1839), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(3), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(2659), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(3), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(2659), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(4), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(45918), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(4), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(45918), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(4), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(58987), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(4), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(58987), }, }, }, noTimestamp(pingPong.Events())) - assert.Equal(t, map[label.Key]label.Value{ - semconv.RPCMethodKey: label.StringValue("FullDuplexCall"), - semconv.RPCServiceKey: label.StringValue("grpc.testing.TestService"), + assert.Equal(t, map[attribute.Key]attribute.Value{ + semconv.RPCMethodKey: attribute.StringValue("FullDuplexCall"), + semconv.RPCServiceKey: attribute.StringValue("grpc.testing.TestService"), semconv.RPCSystemGRPC.Key: semconv.RPCSystemGRPC.Value, - otelgrpc.GRPCStatusCodeKey: label.Uint32Value(uint32(codes.OK)), + otelgrpc.GRPCStatusCodeKey: attribute.Int64Value(int64(codes.OK)), }, pingPong.Attributes()) } @@ -548,26 +548,26 @@ func checkUnaryServerSpans(t *testing.T, spans []*oteltest.Span) { assert.Equal(t, []oteltest.Event{ { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(0), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(0), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(0), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(0), }, }, }, noTimestamp(emptySpan.Events())) - assert.Equal(t, map[label.Key]label.Value{ - semconv.RPCMethodKey: label.StringValue("EmptyCall"), - semconv.RPCServiceKey: label.StringValue("grpc.testing.TestService"), + assert.Equal(t, map[attribute.Key]attribute.Value{ + semconv.RPCMethodKey: attribute.StringValue("EmptyCall"), + semconv.RPCServiceKey: attribute.StringValue("grpc.testing.TestService"), semconv.RPCSystemGRPC.Key: semconv.RPCSystemGRPC.Value, - otelgrpc.GRPCStatusCodeKey: label.Uint32Value(uint32(codes.OK)), + otelgrpc.GRPCStatusCodeKey: attribute.Int64Value(int64(codes.OK)), }, emptySpan.Attributes()) largeSpan := spans[1] @@ -576,28 +576,28 @@ func checkUnaryServerSpans(t *testing.T, spans []*oteltest.Span) { assert.Equal(t, []oteltest.Event{ { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), // largeReqSize from "google.golang.org/grpc/interop" + 12 (overhead). - semconv.RPCMessageUncompressedSizeKey: label.IntValue(271840), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(271840), }, }, { Name: "message", - Attributes: map[label.Key]label.Value{ - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageTypeKey: label.StringValue("SENT"), + Attributes: map[attribute.Key]attribute.Value{ + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), // largeRespSize from "google.golang.org/grpc/interop" + 8 (overhead). - semconv.RPCMessageUncompressedSizeKey: label.IntValue(314167), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(314167), }, }, }, noTimestamp(largeSpan.Events())) - assert.Equal(t, map[label.Key]label.Value{ - semconv.RPCMethodKey: label.StringValue("UnaryCall"), - semconv.RPCServiceKey: label.StringValue("grpc.testing.TestService"), + assert.Equal(t, map[attribute.Key]attribute.Value{ + semconv.RPCMethodKey: attribute.StringValue("UnaryCall"), + semconv.RPCServiceKey: attribute.StringValue("grpc.testing.TestService"), semconv.RPCSystemGRPC.Key: semconv.RPCSystemGRPC.Value, - otelgrpc.GRPCStatusCodeKey: label.Uint32Value(uint32(codes.OK)), + otelgrpc.GRPCStatusCodeKey: attribute.Int64Value(int64(codes.OK)), }, largeSpan.Attributes()) } diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go b/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go index 0cf3d9e00b2..db6ea60e6f4 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go @@ -20,8 +20,8 @@ import ( "google.golang.org/grpc/metadata" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/baggage" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -30,7 +30,7 @@ const ( // instrumentationName is the name of this instrumentation package. instrumentationName = "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" // GRPCStatusCodeKey is convention for numeric status code of a gRPC request. - GRPCStatusCodeKey = label.Key("rpc.grpc.status_code") + GRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") ) // config is a group of options for this instrumentation. @@ -84,6 +84,9 @@ type metadataSupplier struct { metadata *metadata.MD } +// assert that metadataSupplier implements the TextMapCarrier interface +var _ propagation.TextMapCarrier = &metadataSupplier{} + func (s *metadataSupplier) Get(key string) string { values := s.metadata.Get(key) if len(values) == 0 { @@ -96,6 +99,14 @@ func (s *metadataSupplier) Set(key string, value string) { s.metadata.Set(key, value) } +func (s *metadataSupplier) Keys() []string { + out := make([]string, 0, len(*s.metadata)) + for key := range *s.metadata { + out = append(out, key) + } + return out +} + // Inject injects correlation context and span context into the gRPC // metadata object. This function is meant to be used on outgoing // requests. @@ -109,13 +120,13 @@ func Inject(ctx context.Context, metadata *metadata.MD, opts ...Option) { // Extract returns the correlation context and span context that // another service encoded in the gRPC metadata object with Inject. // This function is meant to be used on incoming requests. -func Extract(ctx context.Context, metadata *metadata.MD, opts ...Option) ([]label.KeyValue, trace.SpanContext) { +func Extract(ctx context.Context, metadata *metadata.MD, opts ...Option) ([]attribute.KeyValue, trace.SpanContext) { c := newConfig(opts) ctx = c.Propagators.Extract(ctx, &metadataSupplier{ metadata: metadata, }) - labelSet := baggage.Set(ctx) + attributeSet := baggage.Set(ctx) - return (&labelSet).ToSlice(), trace.RemoteSpanContextFromContext(ctx) + return (&attributeSet).ToSlice(), trace.RemoteSpanContextFromContext(ctx) } diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go index c0efd7fa689..4465d1d5d05 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go @@ -30,16 +30,16 @@ import ( "google.golang.org/grpc/peer" "google.golang.org/grpc/status" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/semconv" "go.opentelemetry.io/otel/trace" otelcontrib "go.opentelemetry.io/contrib" ) -type messageType label.KeyValue +type messageType attribute.KeyValue // Event adds an event of the messageType to the span associated with the // passed context with id and size (if message is a proto message). @@ -47,13 +47,13 @@ func (m messageType) Event(ctx context.Context, id int, message interface{}) { span := trace.SpanFromContext(ctx) if p, ok := message.(proto.Message); ok { span.AddEvent("message", trace.WithAttributes( - label.KeyValue(m), + attribute.KeyValue(m), semconv.RPCMessageIDKey.Int(id), semconv.RPCMessageUncompressedSizeKey.Int(proto.Size(p)), )) } else { span.AddEvent("message", trace.WithAttributes( - label.KeyValue(m), + attribute.KeyValue(m), semconv.RPCMessageIDKey.Int(id), )) } @@ -438,8 +438,8 @@ func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor { // spanInfo returns a span name and all appropriate attributes from the gRPC // method and peer address. -func spanInfo(fullMethod, peerAddress string) (string, []label.KeyValue) { - attrs := []label.KeyValue{semconv.RPCSystemGRPC} +func spanInfo(fullMethod, peerAddress string) (string, []attribute.KeyValue) { + attrs := []attribute.KeyValue{semconv.RPCSystemGRPC} name, mAttrs := parseFullMethod(fullMethod) attrs = append(attrs, mAttrs...) attrs = append(attrs, peerAttr(peerAddress)...) @@ -447,17 +447,17 @@ func spanInfo(fullMethod, peerAddress string) (string, []label.KeyValue) { } // peerAttr returns attributes about the peer address. -func peerAttr(addr string) []label.KeyValue { +func peerAttr(addr string) []attribute.KeyValue { host, port, err := net.SplitHostPort(addr) if err != nil { - return []label.KeyValue(nil) + return []attribute.KeyValue(nil) } if host == "" { host = "127.0.0.1" } - return []label.KeyValue{ + return []attribute.KeyValue{ semconv.NetPeerIPKey.String(host), semconv.NetPeerPortKey.String(port), } @@ -473,17 +473,17 @@ func peerFromCtx(ctx context.Context) string { } // parseFullMethod returns a span name following the OpenTelemetry semantic -// conventions as well as all applicable span label.KeyValue attributes based +// conventions as well as all applicable span attribute.KeyValue attributes based // on a gRPC's FullMethod. -func parseFullMethod(fullMethod string) (string, []label.KeyValue) { +func parseFullMethod(fullMethod string) (string, []attribute.KeyValue) { name := strings.TrimLeft(fullMethod, "/") parts := strings.SplitN(name, "/", 2) if len(parts) != 2 { // Invalid format, does not follow `/package.service/method`. - return name, []label.KeyValue(nil) + return name, []attribute.KeyValue(nil) } - var attrs []label.KeyValue + var attrs []attribute.KeyValue if service := parts[0]; service != "" { attrs = append(attrs, semconv.RPCServiceKey.String(service)) } @@ -494,6 +494,6 @@ func parseFullMethod(fullMethod string) (string, []label.KeyValue) { } // statusCodeAttr returns status code attribute based on given gRPC code -func statusCodeAttr(c grpc_codes.Code) label.KeyValue { - return GRPCStatusCodeKey.Uint32(uint32(c)) +func statusCodeAttr(c grpc_codes.Code) attribute.KeyValue { + return GRPCStatusCodeKey.Int64(int64(c)) } diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor_test.go index bd6fcb37722..7064a906c04 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor_test.go @@ -17,12 +17,11 @@ import ( "context" "errors" "strings" - "sync" "testing" "time" + "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" @@ -36,28 +35,17 @@ import ( "google.golang.org/grpc/status" ) -type SpanRecorder struct { - mu sync.RWMutex - spans map[string]*oteltest.Span +func NewSpanRecorder() *oteltest.SpanRecorder { + return &oteltest.SpanRecorder{} } -func NewSpanRecorder() *SpanRecorder { - return &SpanRecorder{spans: make(map[string]*oteltest.Span)} -} - -func (sr *SpanRecorder) OnStart(span *oteltest.Span) {} - -func (sr *SpanRecorder) OnEnd(span *oteltest.Span) { - sr.mu.Lock() - defer sr.mu.Unlock() - sr.spans[span.Name()] = span -} - -func (sr *SpanRecorder) Get(name string) (*oteltest.Span, bool) { - sr.mu.RLock() - defer sr.mu.RUnlock() - s, ok := sr.spans[name] - return s, ok +func getSpanFromRecorder(sr *oteltest.SpanRecorder, name string) (*oteltest.Span, bool) { + for _, s := range sr.Completed() { + if s.Name() == name { + return s, true + } + } + return nil, false } type mockUICInvoker struct { @@ -106,79 +94,79 @@ func TestUnaryClientInterceptor(t *testing.T) { method string name string expectedSpanCode codes.Code - expectedAttr map[label.Key]label.Value - eventsAttr []map[label.Key]label.Value + expectedAttr map[attribute.Key]attribute.Value + eventsAttr []map[attribute.Key]attribute.Value expectErr bool }{ { method: "/gitpro.ttaallkk.top.serviceName/bar", name: "gitpro.ttaallkk.top.serviceName/bar", - expectedAttr: map[label.Key]label.Value{ - semconv.RPCSystemKey: label.StringValue("grpc"), - semconv.RPCServiceKey: label.StringValue("gitpro.ttaallkk.top.serviceName"), - semconv.RPCMethodKey: label.StringValue("bar"), - GRPCStatusCodeKey: label.Uint32Value(0), - semconv.NetPeerIPKey: label.StringValue("fake"), - semconv.NetPeerPortKey: label.StringValue("connection"), + expectedAttr: map[attribute.Key]attribute.Value{ + semconv.RPCSystemKey: attribute.StringValue("grpc"), + semconv.RPCServiceKey: attribute.StringValue("gitpro.ttaallkk.top.serviceName"), + semconv.RPCMethodKey: attribute.StringValue("bar"), + GRPCStatusCodeKey: attribute.Int64Value(0), + semconv.NetPeerIPKey: attribute.StringValue("fake"), + semconv.NetPeerPortKey: attribute.StringValue("connection"), }, - eventsAttr: []map[label.Key]label.Value{ + eventsAttr: []map[attribute.Key]attribute.Value{ { - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(req))), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(reply))), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, }, { method: "/serviceName/bar", name: "serviceName/bar", - expectedAttr: map[label.Key]label.Value{ - semconv.RPCSystemKey: label.StringValue("grpc"), - semconv.RPCServiceKey: label.StringValue("serviceName"), - semconv.RPCMethodKey: label.StringValue("bar"), - GRPCStatusCodeKey: label.Uint32Value(0), - semconv.NetPeerIPKey: label.StringValue("fake"), - semconv.NetPeerPortKey: label.StringValue("connection"), + expectedAttr: map[attribute.Key]attribute.Value{ + semconv.RPCSystemKey: attribute.StringValue("grpc"), + semconv.RPCServiceKey: attribute.StringValue("serviceName"), + semconv.RPCMethodKey: attribute.StringValue("bar"), + GRPCStatusCodeKey: attribute.Int64Value(0), + semconv.NetPeerIPKey: attribute.StringValue("fake"), + semconv.NetPeerPortKey: attribute.StringValue("connection"), }, - eventsAttr: []map[label.Key]label.Value{ + eventsAttr: []map[attribute.Key]attribute.Value{ { - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(req))), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(reply))), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, }, { method: "serviceName/bar", name: "serviceName/bar", - expectedAttr: map[label.Key]label.Value{ - semconv.RPCSystemKey: label.StringValue("grpc"), - semconv.RPCServiceKey: label.StringValue("serviceName"), - semconv.RPCMethodKey: label.StringValue("bar"), - GRPCStatusCodeKey: label.Uint32Value(uint32(grpc_codes.OK)), - semconv.NetPeerIPKey: label.StringValue("fake"), - semconv.NetPeerPortKey: label.StringValue("connection"), + expectedAttr: map[attribute.Key]attribute.Value{ + semconv.RPCSystemKey: attribute.StringValue("grpc"), + semconv.RPCServiceKey: attribute.StringValue("serviceName"), + semconv.RPCMethodKey: attribute.StringValue("bar"), + GRPCStatusCodeKey: attribute.Int64Value(int64(grpc_codes.OK)), + semconv.NetPeerIPKey: attribute.StringValue("fake"), + semconv.NetPeerPortKey: attribute.StringValue("connection"), }, - eventsAttr: []map[label.Key]label.Value{ + eventsAttr: []map[attribute.Key]attribute.Value{ { - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(req))), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(reply))), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, }, @@ -186,24 +174,24 @@ func TestUnaryClientInterceptor(t *testing.T) { method: "serviceName/bar_error", name: "serviceName/bar_error", expectedSpanCode: codes.Error, - expectedAttr: map[label.Key]label.Value{ - semconv.RPCSystemKey: label.StringValue("grpc"), - semconv.RPCServiceKey: label.StringValue("serviceName"), - semconv.RPCMethodKey: label.StringValue("bar_error"), - GRPCStatusCodeKey: label.Uint32Value(uint32(grpc_codes.Internal)), - semconv.NetPeerIPKey: label.StringValue("fake"), - semconv.NetPeerPortKey: label.StringValue("connection"), + expectedAttr: map[attribute.Key]attribute.Value{ + semconv.RPCSystemKey: attribute.StringValue("grpc"), + semconv.RPCServiceKey: attribute.StringValue("serviceName"), + semconv.RPCMethodKey: attribute.StringValue("bar_error"), + GRPCStatusCodeKey: attribute.Int64Value(int64(grpc_codes.Internal)), + semconv.NetPeerIPKey: attribute.StringValue("fake"), + semconv.NetPeerPortKey: attribute.StringValue("connection"), }, - eventsAttr: []map[label.Key]label.Value{ + eventsAttr: []map[attribute.Key]attribute.Value{ { - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(req))), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(reply))), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, expectErr: true, @@ -211,46 +199,46 @@ func TestUnaryClientInterceptor(t *testing.T) { { method: "invalidName", name: "invalidName", - expectedAttr: map[label.Key]label.Value{ - semconv.RPCSystemKey: label.StringValue("grpc"), - GRPCStatusCodeKey: label.Uint32Value(0), - semconv.NetPeerIPKey: label.StringValue("fake"), - semconv.NetPeerPortKey: label.StringValue("connection"), + expectedAttr: map[attribute.Key]attribute.Value{ + semconv.RPCSystemKey: attribute.StringValue("grpc"), + GRPCStatusCodeKey: attribute.Int64Value(0), + semconv.NetPeerIPKey: attribute.StringValue("fake"), + semconv.NetPeerPortKey: attribute.StringValue("connection"), }, - eventsAttr: []map[label.Key]label.Value{ + eventsAttr: []map[attribute.Key]attribute.Value{ { - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(req))), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(reply))), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, }, { method: "/gitpro.ttaallkk.top.foo.serviceName_123/method", name: "gitpro.ttaallkk.top.foo.serviceName_123/method", - expectedAttr: map[label.Key]label.Value{ - semconv.RPCSystemKey: label.StringValue("grpc"), - GRPCStatusCodeKey: label.Uint32Value(0), - semconv.RPCServiceKey: label.StringValue("gitpro.ttaallkk.top.foo.serviceName_123"), - semconv.RPCMethodKey: label.StringValue("method"), - semconv.NetPeerIPKey: label.StringValue("fake"), - semconv.NetPeerPortKey: label.StringValue("connection"), + expectedAttr: map[attribute.Key]attribute.Value{ + semconv.RPCSystemKey: attribute.StringValue("grpc"), + GRPCStatusCodeKey: attribute.Int64Value(0), + semconv.RPCServiceKey: attribute.StringValue("gitpro.ttaallkk.top.foo.serviceName_123"), + semconv.RPCMethodKey: attribute.StringValue("method"), + semconv.NetPeerIPKey: attribute.StringValue("fake"), + semconv.NetPeerPortKey: attribute.StringValue("connection"), }, - eventsAttr: []map[label.Key]label.Value{ + eventsAttr: []map[attribute.Key]attribute.Value{ { - semconv.RPCMessageTypeKey: label.StringValue("SENT"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(req))), + semconv.RPCMessageTypeKey: attribute.StringValue("SENT"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(req))), }, { - semconv.RPCMessageTypeKey: label.StringValue("RECEIVED"), - semconv.RPCMessageIDKey: label.IntValue(1), - semconv.RPCMessageUncompressedSizeKey: label.IntValue(proto.Size(proto.Message(reply))), + semconv.RPCMessageTypeKey: attribute.StringValue("RECEIVED"), + semconv.RPCMessageIDKey: attribute.IntValue(1), + semconv.RPCMessageUncompressedSizeKey: attribute.IntValue(proto.Size(proto.Message(reply))), }, }, }, @@ -263,7 +251,7 @@ func TestUnaryClientInterceptor(t *testing.T) { } else { assert.NoError(t, err) } - span, ok := sr.Get(check.name) + span, ok := getSpanFromRecorder(sr, check.name) if !assert.True(t, ok, "missing span %q", check.name) { continue } @@ -273,8 +261,8 @@ func TestUnaryClientInterceptor(t *testing.T) { } } -func eventAttrMap(events []oteltest.Event) []map[label.Key]label.Value { - maps := make([]map[label.Key]label.Value, len(events)) +func eventAttrMap(events []oteltest.Event) []map[attribute.Key]attribute.Value { + maps := make([]map[attribute.Key]attribute.Value, len(events)) for i, event := range events { maps[i] = event.Attributes } @@ -324,7 +312,7 @@ func TestStreamClientInterceptor(t *testing.T) { }, ) require.NoError(t, err, "initialize grpc stream client") - _, ok := sr.Get(name) + _, ok := getSpanFromRecorder(sr, name) require.False(t, ok, "span should ended while stream is open") req := &mockProtoMessage{} @@ -344,7 +332,7 @@ func TestStreamClientInterceptor(t *testing.T) { // added retry because span end is called in separate go routine var span *oteltest.Span for retry := 0; retry < 5; retry++ { - span, ok = sr.Get(name) + span, ok = getSpanFromRecorder(sr, name) if ok { break } @@ -352,13 +340,13 @@ func TestStreamClientInterceptor(t *testing.T) { } require.True(t, ok, "missing span %s", name) - expectedAttr := map[label.Key]label.Value{ - semconv.RPCSystemKey: label.StringValue("grpc"), - GRPCStatusCodeKey: label.Uint32Value(uint32(grpc_codes.OK)), - semconv.RPCServiceKey: label.StringValue("gitpro.ttaallkk.top.serviceName"), - semconv.RPCMethodKey: label.StringValue("bar"), - semconv.NetPeerIPKey: label.StringValue("fake"), - semconv.NetPeerPortKey: label.StringValue("connection"), + expectedAttr := map[attribute.Key]attribute.Value{ + semconv.RPCSystemKey: attribute.StringValue("grpc"), + GRPCStatusCodeKey: attribute.Int64Value(int64(grpc_codes.OK)), + semconv.RPCServiceKey: attribute.StringValue("gitpro.ttaallkk.top.serviceName"), + semconv.RPCMethodKey: attribute.StringValue("bar"), + semconv.NetPeerIPKey: attribute.StringValue("fake"), + semconv.NetPeerPortKey: attribute.StringValue("connection"), } assert.Equal(t, expectedAttr, span.Attributes()) @@ -366,13 +354,13 @@ func TestStreamClientInterceptor(t *testing.T) { require.Len(t, events, 20) for i := 0; i < 20; i += 2 { msgID := i/2 + 1 - validate := func(eventName string, attrs map[label.Key]label.Value) { + validate := func(eventName string, attrs map[attribute.Key]attribute.Value) { for k, v := range attrs { if k == semconv.RPCMessageTypeKey && v.AsString() != eventName { t.Errorf("invalid event on index: %d expecting %s event, receive %s event", i, eventName, v.AsString()) } - if k == semconv.RPCMessageIDKey && v != label.IntValue(msgID) { - t.Errorf("invalid id for message event expected %d received %d", msgID, v.AsInt32()) + if k == semconv.RPCMessageIDKey && v != attribute.IntValue(msgID) { + t.Errorf("invalid id for message event expected %d received %d", msgID, v.AsInt64()) } } } @@ -420,16 +408,16 @@ func TestStreamClientInterceptorWithError(t *testing.T) { require.Error(t, err, "initialize grpc stream client") assert.IsType(t, mockClientStream{}, streamClient) - span, ok := sr.Get(name) + span, ok := getSpanFromRecorder(sr, name) require.True(t, ok, "missing span %s", name) - expectedAttr := map[label.Key]label.Value{ - semconv.RPCSystemKey: label.StringValue("grpc"), - GRPCStatusCodeKey: label.Uint32Value(uint32(grpc_codes.Unknown)), - semconv.RPCServiceKey: label.StringValue("gitpro.ttaallkk.top.serviceName"), - semconv.RPCMethodKey: label.StringValue("bar"), - semconv.NetPeerIPKey: label.StringValue("fake"), - semconv.NetPeerPortKey: label.StringValue("connection"), + expectedAttr := map[attribute.Key]attribute.Value{ + semconv.RPCSystemKey: attribute.StringValue("grpc"), + GRPCStatusCodeKey: attribute.Int64Value(int64(grpc_codes.Unknown)), + semconv.RPCServiceKey: attribute.StringValue("gitpro.ttaallkk.top.serviceName"), + semconv.RPCMethodKey: attribute.StringValue("bar"), + semconv.NetPeerIPKey: attribute.StringValue("fake"), + semconv.NetPeerPortKey: attribute.StringValue("connection"), } assert.Equal(t, expectedAttr, span.Attributes()) assert.Equal(t, codes.Error, span.StatusCode()) @@ -447,7 +435,7 @@ func TestServerInterceptorError(t *testing.T) { require.Error(t, err) assert.Equal(t, err, deniedErr) - span, ok := sr.Get("") + span, ok := getSpanFromRecorder(sr, "") if !ok { t.Fatalf("failed to export error span") } @@ -455,12 +443,12 @@ func TestServerInterceptorError(t *testing.T) { assert.Contains(t, deniedErr.Error(), span.StatusMessage()) codeAttr, ok := span.Attributes()[GRPCStatusCodeKey] assert.True(t, ok, "attributes contain gRPC status code") - assert.Equal(t, label.Uint32Value(uint32(grpc_codes.PermissionDenied)), codeAttr) + assert.Equal(t, attribute.Int64Value(int64(grpc_codes.PermissionDenied)), codeAttr) assert.Len(t, span.Events(), 2) - assert.Equal(t, map[label.Key]label.Value{ - label.Key("message.type"): label.StringValue("SENT"), - label.Key("message.id"): label.IntValue(1), - label.Key("message.uncompressed_size"): label.IntValue(26), + assert.Equal(t, map[attribute.Key]attribute.Value{ + attribute.Key("message.type"): attribute.StringValue("SENT"), + attribute.Key("message.id"): attribute.IntValue(1), + attribute.Key("message.uncompressed_size"): attribute.IntValue(26), }, span.Events()[1].Attributes) } @@ -468,51 +456,51 @@ func TestParseFullMethod(t *testing.T) { tests := []struct { fullMethod string name string - attr []label.KeyValue + attr []attribute.KeyValue }{ { fullMethod: "/grpc.test.EchoService/Echo", name: "grpc.test.EchoService/Echo", - attr: []label.KeyValue{ + attr: []attribute.KeyValue{ semconv.RPCServiceKey.String("grpc.test.EchoService"), semconv.RPCMethodKey.String("Echo"), }, }, { fullMethod: "/com.example.ExampleRmiService/exampleMethod", name: "com.example.ExampleRmiService/exampleMethod", - attr: []label.KeyValue{ + attr: []attribute.KeyValue{ semconv.RPCServiceKey.String("com.example.ExampleRmiService"), semconv.RPCMethodKey.String("exampleMethod"), }, }, { fullMethod: "/MyCalcService.Calculator/Add", name: "MyCalcService.Calculator/Add", - attr: []label.KeyValue{ + attr: []attribute.KeyValue{ semconv.RPCServiceKey.String("MyCalcService.Calculator"), semconv.RPCMethodKey.String("Add"), }, }, { fullMethod: "/MyServiceReference.ICalculator/Add", name: "MyServiceReference.ICalculator/Add", - attr: []label.KeyValue{ + attr: []attribute.KeyValue{ semconv.RPCServiceKey.String("MyServiceReference.ICalculator"), semconv.RPCMethodKey.String("Add"), }, }, { fullMethod: "/MyServiceWithNoPackage/theMethod", name: "MyServiceWithNoPackage/theMethod", - attr: []label.KeyValue{ + attr: []attribute.KeyValue{ semconv.RPCServiceKey.String("MyServiceWithNoPackage"), semconv.RPCMethodKey.String("theMethod"), }, }, { fullMethod: "/pkg.srv", name: "pkg.srv", - attr: []label.KeyValue(nil), + attr: []attribute.KeyValue(nil), }, { fullMethod: "/pkg.srv/", name: "pkg.srv/", - attr: []label.KeyValue{ + attr: []attribute.KeyValue{ semconv.RPCServiceKey.String("pkg.srv"), }, }, diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.mod b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.mod index 209fc0e9121..2e9da20279d 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.mod +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron 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/otel/trace v0.17.0 + go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron 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 + go.opentelemetry.io/otel/trace v0.18.0 gopkg.in/macaron.v1 v1.4.0 ) diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.sum b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.sum index 19af1bc734f..ce6d571f5db 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.sum +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.sum @@ -27,22 +27,22 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e h1:GSGeB9EAKY2spCABz6xOX5DbxZEXolK+nBSvmsQwRjM= github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM= -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/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/server.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/server.go index 53d73ca4308..13cd3db057d 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/server.go +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/server.go @@ -23,8 +23,8 @@ import ( "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" oteltrace "go.opentelemetry.io/otel/trace" @@ -64,7 +64,7 @@ func initTracer() { } func getUser(ctx context.Context, id string) string { - _, span := tracer.Start(ctx, "getUser", oteltrace.WithAttributes(label.String("id", id))) + _, span := tracer.Start(ctx, "getUser", oteltrace.WithAttributes(attribute.String("id", id))) defer span.End() if id == "123" { return "otelmacaron tester" diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.mod b/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.mod index 3d2f761b3f6..b43fd23a703 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.mod +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/contrib v0.17.0 - go.opentelemetry.io/contrib/propagators 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/contrib/propagators 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 gopkg.in/macaron.v1 v1.4.0 ) diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.sum b/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.sum index 76cb4c9d84f..e2011a4a63a 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.sum +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.sum @@ -26,14 +26,14 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e h1:GSGeB9EAKY2spCABz6xOX5DbxZEXolK+nBSvmsQwRjM= github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM= -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/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron.go index a2a05c7e814..7b855a67be0 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron.go +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron.go @@ -20,6 +20,7 @@ import ( "gopkg.in/macaron.v1" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" oteltrace "go.opentelemetry.io/otel/trace" @@ -42,7 +43,7 @@ func Middleware(service string, opts ...Option) macaron.Handler { c.Req.Request = c.Req.Request.WithContext(savedCtx) }() - ctx := cfg.Propagators.Extract(savedCtx, c.Req.Header) + ctx := cfg.Propagators.Extract(savedCtx, propagation.HeaderCarrier(c.Req.Header)) opts := []oteltrace.SpanOption{ oteltrace.WithAttributes(semconv.NetAttributesFromHTTPRequest("tcp", c.Req.Request)...), oteltrace.WithAttributes(semconv.EndUserAttributesFromHTTPRequest(c.Req.Request)...), diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron_test.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron_test.go index eeda89c55ad..31207d661ee 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron_test.go +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron_test.go @@ -26,7 +26,7 @@ import ( b3prop "go.opentelemetry.io/contrib/propagators/b3" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/propagation" oteltrace "go.opentelemetry.io/otel/trace" @@ -55,7 +55,7 @@ func TestChildSpanFromGlobalTracer(t *testing.T) { } func TestChildSpanNames(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) m := macaron.Classic() @@ -84,23 +84,23 @@ func TestChildSpanNames(t *testing.T) { assert.Equal(t, "/user/123", span.Name()) // TODO: span name should show router template, eg /user/:id assert.Equal(t, oteltrace.SpanKindServer, span.SpanKind()) attrs := span.Attributes() - assert.Equal(t, label.StringValue("foobar"), attrs["http.server_name"]) - assert.Equal(t, label.IntValue(http.StatusOK), attrs["http.status_code"]) - assert.Equal(t, label.StringValue("GET"), attrs["http.method"]) - assert.Equal(t, label.StringValue("/user/123"), attrs["http.target"]) + assert.Equal(t, attribute.StringValue("foobar"), attrs["http.server_name"]) + assert.Equal(t, attribute.IntValue(http.StatusOK), attrs["http.status_code"]) + assert.Equal(t, attribute.StringValue("GET"), attrs["http.method"]) + assert.Equal(t, attribute.StringValue("/user/123"), attrs["http.target"]) // TODO: span name should show router template, eg /user/:id - //assert.Equal(t, label.StringValue("/user/:id"), span.Attributes["http.route"]) + //assert.Equal(t, attribute.StringValue("/user/:id"), span.Attributes["http.route"]) span = spans[1] assert.Equal(t, "/book/foo", span.Name()) // TODO: span name should show router template, eg /book/:title assert.Equal(t, oteltrace.SpanKindServer, span.SpanKind()) attrs = span.Attributes() - assert.Equal(t, label.StringValue("foobar"), attrs["http.server_name"]) - assert.Equal(t, label.IntValue(http.StatusOK), attrs["http.status_code"]) - assert.Equal(t, label.StringValue("GET"), attrs["http.method"]) - assert.Equal(t, label.StringValue("/book/foo"), attrs["http.target"]) + assert.Equal(t, attribute.StringValue("foobar"), attrs["http.server_name"]) + assert.Equal(t, attribute.IntValue(http.StatusOK), attrs["http.status_code"]) + assert.Equal(t, attribute.StringValue("GET"), attrs["http.method"]) + assert.Equal(t, attribute.StringValue("/book/foo"), attrs["http.target"]) // TODO: span name should show router template, eg /book/:title - //assert.Equal(t, label.StringValue("/book/:title"), span.Attributes["http.route"]) + //assert.Equal(t, attribute.StringValue("/book/:title"), span.Attributes["http.route"]) } func TestGetSpanNotInstrumented(t *testing.T) { @@ -126,7 +126,7 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { w := httptest.NewRecorder() ctx, pspan := tracer.Start(context.Background(), "test") - otel.GetTextMapPropagator().Inject(ctx, r.Header) + otel.GetTextMapPropagator().Inject(ctx, propagation.HeaderCarrier(r.Header)) m := macaron.Classic() m.Use(Middleware("foobar")) @@ -152,7 +152,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { w := httptest.NewRecorder() ctx, pspan := tracer.Start(context.Background(), "test") - b3.Inject(ctx, r.Header) + b3.Inject(ctx, propagation.HeaderCarrier(r.Header)) m := macaron.Classic() m.Use(Middleware("foobar", WithTracerProvider(tp), WithPropagators(b3))) diff --git a/instrumentation/host/doc.go b/instrumentation/host/doc.go index dde26c27052..7f7cf5a6f27 100644 --- a/instrumentation/host/doc.go +++ b/instrumentation/host/doc.go @@ -19,9 +19,9 @@ // alternative for processes that want to record the same information // without an agent. // -// The metric events produced are listed here with label dimensions. +// The metric events produced are listed here with attribute dimensions. // -// Name Label +// Name Attribute // ---------------------------------------------------------------------- // process.cpu.time state=user|system // system.cpu.time state=user|system|other|idle diff --git a/instrumentation/host/example/go.mod b/instrumentation/host/example/go.mod index 15366c28307..54caa0338eb 100644 --- a/instrumentation/host/example/go.mod +++ b/instrumentation/host/example/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - go.opentelemetry.io/contrib/instrumentation/host v0.17.0 - go.opentelemetry.io/otel/exporters/stdout v0.17.0 - go.opentelemetry.io/otel/sdk/metric v0.17.0 + go.opentelemetry.io/contrib/instrumentation/host v0.18.0 + go.opentelemetry.io/otel/exporters/stdout v0.18.0 + go.opentelemetry.io/otel/sdk/metric v0.18.0 ) diff --git a/instrumentation/host/example/go.sum b/instrumentation/host/example/go.sum index 9d924352832..d286b529184 100644 --- a/instrumentation/host/example/go.sum +++ b/instrumentation/host/example/go.sum @@ -15,22 +15,22 @@ github.com/shirou/gopsutil v2.20.9+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu 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/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= diff --git a/instrumentation/host/go.mod b/instrumentation/host/go.mod index 35274043f6f..cc4cc895d42 100644 --- a/instrumentation/host/go.mod +++ b/instrumentation/host/go.mod @@ -9,9 +9,9 @@ require ( github.com/go-ole/go-ole v1.2.4 // indirect github.com/shirou/gopsutil v2.20.9+incompatible 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/metric v0.17.0 - go.opentelemetry.io/otel/oteltest v0.17.0 + go.opentelemetry.io/contrib v0.18.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/metric v0.18.0 + go.opentelemetry.io/otel/oteltest v0.18.0 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a // indirect ) diff --git a/instrumentation/host/go.sum b/instrumentation/host/go.sum index db250215815..862f4dccf65 100644 --- a/instrumentation/host/go.sum +++ b/instrumentation/host/go.sum @@ -14,14 +14,14 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= diff --git a/instrumentation/host/host.go b/instrumentation/host/host.go index 73824889c75..81b61aa4da6 100644 --- a/instrumentation/host/host.go +++ b/instrumentation/host/host.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/contrib" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/unit" @@ -67,22 +67,22 @@ func (o metricProviderOption) ApplyHost(c *config) { } var ( - // Label sets for CPU time measurements. + // Attribute sets for CPU time measurements. - LabelCPUTimeUser = []label.KeyValue{label.String("state", "user")} - LabelCPUTimeSystem = []label.KeyValue{label.String("state", "system")} - LabelCPUTimeOther = []label.KeyValue{label.String("state", "other")} - LabelCPUTimeIdle = []label.KeyValue{label.String("state", "idle")} + AttributeCPUTimeUser = []attribute.KeyValue{attribute.String("state", "user")} + AttributeCPUTimeSystem = []attribute.KeyValue{attribute.String("state", "system")} + AttributeCPUTimeOther = []attribute.KeyValue{attribute.String("state", "other")} + AttributeCPUTimeIdle = []attribute.KeyValue{attribute.String("state", "idle")} - // Label sets used for Memory measurements. + // Attribute sets used for Memory measurements. - LabelMemoryAvailable = []label.KeyValue{label.String("state", "available")} - LabelMemoryUsed = []label.KeyValue{label.String("state", "used")} + AttributeMemoryAvailable = []attribute.KeyValue{attribute.String("state", "available")} + AttributeMemoryUsed = []attribute.KeyValue{attribute.String("state", "used")} - // Label sets used for Network measurements. + // Attribute sets used for Network measurements. - LabelNetworkTransmit = []label.KeyValue{label.String("direction", "transmit")} - LabelNetworkReceive = []label.KeyValue{label.String("direction", "receive")} + AttributeNetworkTransmit = []attribute.KeyValue{attribute.String("direction", "transmit")} + AttributeNetworkReceive = []attribute.KeyValue{attribute.String("direction", "receive")} ) // newConfig computes a config from a list of Options. @@ -178,13 +178,13 @@ func (h *host) register() error { } // Process CPU time - result.Observe(LabelCPUTimeUser, processCPUTime.Observation(processTimes.User)) - result.Observe(LabelCPUTimeSystem, processCPUTime.Observation(processTimes.System)) + result.Observe(AttributeCPUTimeUser, processCPUTime.Observation(processTimes.User)) + result.Observe(AttributeCPUTimeSystem, processCPUTime.Observation(processTimes.System)) // Host CPU time hostTime := hostTimeSlice[0] - result.Observe(LabelCPUTimeUser, hostCPUTime.Observation(hostTime.User)) - result.Observe(LabelCPUTimeSystem, hostCPUTime.Observation(hostTime.System)) + result.Observe(AttributeCPUTimeUser, hostCPUTime.Observation(hostTime.User)) + result.Observe(AttributeCPUTimeSystem, hostCPUTime.Observation(hostTime.System)) // TODO(#244): "other" is a placeholder for actually dealing // with these states. Do users actually want this @@ -201,18 +201,18 @@ func (h *host) register() error { hostTime.Guest + hostTime.GuestNice - result.Observe(LabelCPUTimeOther, hostCPUTime.Observation(other)) - result.Observe(LabelCPUTimeIdle, hostCPUTime.Observation(hostTime.Idle)) + result.Observe(AttributeCPUTimeOther, hostCPUTime.Observation(other)) + result.Observe(AttributeCPUTimeIdle, hostCPUTime.Observation(hostTime.Idle)) // Host memory usage - result.Observe(LabelMemoryUsed, hostMemoryUsage.Observation(int64(vmStats.Used))) - result.Observe(LabelMemoryAvailable, hostMemoryUsage.Observation(int64(vmStats.Available))) + result.Observe(AttributeMemoryUsed, hostMemoryUsage.Observation(int64(vmStats.Used))) + result.Observe(AttributeMemoryAvailable, hostMemoryUsage.Observation(int64(vmStats.Available))) // Host memory utilization - result.Observe(LabelMemoryUsed, + result.Observe(AttributeMemoryUsed, hostMemoryUtilization.Observation(float64(vmStats.Used)/float64(vmStats.Total)), ) - result.Observe(LabelMemoryAvailable, + result.Observe(AttributeMemoryAvailable, hostMemoryUtilization.Observation(float64(vmStats.Available)/float64(vmStats.Total)), ) @@ -221,8 +221,8 @@ func (h *host) register() error { // TODO: These can be broken down by network // interface, with similar questions to those posed // about per-CPU measurements above. - result.Observe(LabelNetworkTransmit, networkIOUsage.Observation(int64(ioStats[0].BytesSent))) - result.Observe(LabelNetworkReceive, networkIOUsage.Observation(int64(ioStats[0].BytesRecv))) + result.Observe(AttributeNetworkTransmit, networkIOUsage.Observation(int64(ioStats[0].BytesSent))) + result.Observe(AttributeNetworkReceive, networkIOUsage.Observation(int64(ioStats[0].BytesRecv))) }) // TODO: .time units are in seconds, but "unit" package does @@ -232,7 +232,7 @@ func (h *host) register() error { "process.cpu.time", metric.WithUnit("s"), metric.WithDescription( - "Accumulated CPU time spent by this process labeled by state (User, System, ...)", + "Accumulated CPU time spent by this process attributeed by state (User, System, ...)", ), ); err != nil { return err @@ -242,7 +242,7 @@ func (h *host) register() error { "system.cpu.time", metric.WithUnit("s"), metric.WithDescription( - "Accumulated CPU time spent by this host labeled by state (User, System, Other, Idle)", + "Accumulated CPU time spent by this host attributeed by state (User, System, Other, Idle)", ), ); err != nil { return err @@ -252,7 +252,7 @@ func (h *host) register() error { "system.memory.usage", metric.WithUnit(unit.Bytes), metric.WithDescription( - "Memory usage of this process labeled by memory state (Used, Available)", + "Memory usage of this process attributeed by memory state (Used, Available)", ), ); err != nil { return err @@ -262,7 +262,7 @@ func (h *host) register() error { "system.memory.utilization", metric.WithUnit(unit.Dimensionless), metric.WithDescription( - "Memory utilization of this process labeled by memory state (Used, Available)", + "Memory utilization of this process attributeed by memory state (Used, Available)", ), ); err != nil { return err @@ -272,7 +272,7 @@ func (h *host) register() error { "system.network.io", metric.WithUnit(unit.Bytes), metric.WithDescription( - "Bytes transferred labeled by direction (Transmit, Receive)", + "Bytes transferred attributeed by direction (Transmit, Receive)", ), ); err != nil { return err diff --git a/instrumentation/host/host_test.go b/instrumentation/host/host_test.go index 1aa423f8dbc..a3a2cf8fb7d 100644 --- a/instrumentation/host/host_test.go +++ b/instrumentation/host/host_test.go @@ -30,21 +30,21 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/instrumentation/host" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/oteltest" ) -func getMetric(impl *oteltest.MeterImpl, name string, lbl label.KeyValue) float64 { +func getMetric(impl *oteltest.MeterImpl, name string, lbl attribute.KeyValue) float64 { for _, b := range impl.MeasurementBatches { - foundLabel := false + foundAttribute := false for _, haveLabel := range b.Labels { if haveLabel != lbl { continue } - foundLabel = true + foundAttribute = true break } - if !foundLabel { + if !foundAttribute { continue } @@ -89,11 +89,11 @@ func TestHostCPU(t *testing.T) { impl.RunAsyncInstruments() - processUser := getMetric(impl, "process.cpu.time", host.LabelCPUTimeUser[0]) - processSystem := getMetric(impl, "process.cpu.time", host.LabelCPUTimeSystem[0]) + processUser := getMetric(impl, "process.cpu.time", host.AttributeCPUTimeUser[0]) + processSystem := getMetric(impl, "process.cpu.time", host.AttributeCPUTimeSystem[0]) - hostUser := getMetric(impl, "system.cpu.time", host.LabelCPUTimeUser[0]) - hostSystem := getMetric(impl, "system.cpu.time", host.LabelCPUTimeSystem[0]) + hostUser := getMetric(impl, "system.cpu.time", host.AttributeCPUTimeUser[0]) + hostSystem := getMetric(impl, "system.cpu.time", host.AttributeCPUTimeSystem[0]) processAfter, err := proc.TimesWithContext(ctx) require.NoError(t, err) @@ -146,19 +146,19 @@ func TestHostMemory(t *testing.T) { impl.RunAsyncInstruments() - hostUsed := getMetric(impl, "system.memory.usage", host.LabelMemoryUsed[0]) + hostUsed := getMetric(impl, "system.memory.usage", host.AttributeMemoryUsed[0]) assert.Greater(t, hostUsed, 0.0) assert.LessOrEqual(t, hostUsed, float64(vMem.Total)) - hostAvailable := getMetric(impl, "system.memory.usage", host.LabelMemoryAvailable[0]) + hostAvailable := getMetric(impl, "system.memory.usage", host.AttributeMemoryAvailable[0]) assert.GreaterOrEqual(t, hostAvailable, 0.0) assert.Less(t, hostAvailable, float64(vMem.Total)) - hostUsedUtil := getMetric(impl, "system.memory.utilization", host.LabelMemoryUsed[0]) + hostUsedUtil := getMetric(impl, "system.memory.utilization", host.AttributeMemoryUsed[0]) assert.Greater(t, hostUsedUtil, 0.0) assert.LessOrEqual(t, hostUsedUtil, 1.0) - hostAvailableUtil := getMetric(impl, "system.memory.utilization", host.LabelMemoryAvailable[0]) + hostAvailableUtil := getMetric(impl, "system.memory.utilization", host.AttributeMemoryAvailable[0]) assert.GreaterOrEqual(t, hostAvailableUtil, 0.0) assert.Less(t, hostAvailableUtil, 1.0) @@ -228,8 +228,8 @@ func TestHostNetwork(t *testing.T) { hostAfter, err := net.IOCountersWithContext(ctx, false) require.NoError(t, err) - hostTransmit := getMetric(impl, "system.network.io", host.LabelNetworkTransmit[0]) - hostReceive := getMetric(impl, "system.network.io", host.LabelNetworkReceive[0]) + hostTransmit := getMetric(impl, "system.network.io", host.AttributeNetworkTransmit[0]) + hostReceive := getMetric(impl, "system.network.io", host.AttributeNetworkReceive[0]) // Check that the network transmit/receive used is greater than before: require.LessOrEqual(t, uint64(howMuch), hostAfter[0].BytesSent-hostBefore[0].BytesSent) diff --git a/instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go b/instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go index 38b789db8cc..88c453a5b9f 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go @@ -24,17 +24,17 @@ import ( "go.opentelemetry.io/contrib" "go.opentelemetry.io/otel" + "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" ) var ( - HTTPStatus = label.Key("http.status") - HTTPHeaderMIME = label.Key("http.mime") - HTTPRemoteAddr = label.Key("http.remote") - HTTPLocalAddr = label.Key("http.local") + HTTPStatus = attribute.Key("http.status") + HTTPHeaderMIME = attribute.Key("http.mime") + HTTPRemoteAddr = attribute.Key("http.remote") + HTTPLocalAddr = attribute.Key("http.local") ) var ( @@ -93,7 +93,7 @@ func NewClientTrace(ctx context.Context) *httptrace.ClientTrace { } } -func (ct *clientTracer) start(hook, spanName string, attrs ...label.KeyValue) { +func (ct *clientTracer) start(hook, spanName string, attrs ...attribute.KeyValue) { ct.mtx.Lock() defer ct.mtx.Unlock() @@ -113,7 +113,7 @@ func (ct *clientTracer) start(hook, spanName string, attrs ...label.KeyValue) { } } -func (ct *clientTracer) end(hook string, err error, attrs ...label.KeyValue) { +func (ct *clientTracer) end(hook string, err error, attrs ...attribute.KeyValue) { ct.mtx.Lock() defer ct.mtx.Unlock() if ctx, ok := ct.activeHooks[hook]; ok { @@ -201,7 +201,7 @@ func (ct *clientTracer) wroteHeaderField(k string, v []string) { if ct.span("http.headers") == nil { ct.start("http.headers", "http.headers") } - ct.root.SetAttributes(label.String("http."+strings.ToLower(k), sliceToString(v))) + ct.root.SetAttributes(attribute.String("http."+strings.ToLower(k), sliceToString(v))) } func (ct *clientTracer) wroteHeaders() { diff --git a/instrumentation/net/http/httptrace/otelhttptrace/clienttrace_test.go b/instrumentation/net/http/httptrace/otelhttptrace/clienttrace_test.go index 0b34c6db6ef..685f51e3728 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/clienttrace_test.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/clienttrace_test.go @@ -17,7 +17,7 @@ import ( "context" "net/http" "net/http/httptest" - nhtrace "net/http/httptrace" + "net/http/httptrace" "testing" "github.com/stretchr/testify/assert" @@ -25,18 +25,32 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/oteltest" ) -type SpanRecorder map[string]*oteltest.Span +func getSpanFromRecorder(sr *oteltest.SpanRecorder, name string) (*oteltest.Span, bool) { + for _, s := range sr.Completed() { + if s.Name() == name { + return s, true + } + } + return nil, false +} -func (sr *SpanRecorder) OnStart(span *oteltest.Span) {} -func (sr *SpanRecorder) OnEnd(span *oteltest.Span) { (*sr)[span.Name()] = span } +func getSpansFromRecorder(sr *oteltest.SpanRecorder, name string) []*oteltest.Span { + ret := []*oteltest.Span{} + for _, s := range sr.Completed() { + if s.Name() == name { + ret = append(ret, s) + } + } + return ret +} func TestHTTPRequestWithClientTrace(t *testing.T) { - sr := SpanRecorder{} - tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(&sr)) + sr := &oteltest.SpanRecorder{} + tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) otel.SetTracerProvider(tp) tr := tp.Tracer("httptrace/client") @@ -69,21 +83,21 @@ func TestHTTPRequestWithClientTrace(t *testing.T) { testLen := []struct { name string - attributes map[label.Key]label.Value + attributes map[attribute.Key]attribute.Value parent string }{ { name: "http.connect", - attributes: map[label.Key]label.Value{ - label.Key("http.remote"): label.StringValue(address.String()), + attributes: map[attribute.Key]attribute.Value{ + attribute.Key("http.remote"): attribute.StringValue(address.String()), }, parent: "http.getconn", }, { name: "http.getconn", - attributes: map[label.Key]label.Value{ - label.Key("http.remote"): label.StringValue(address.String()), - label.Key("http.host"): label.StringValue(address.String()), + attributes: map[attribute.Key]attribute.Value{ + attribute.Key("http.remote"): attribute.StringValue(address.String()), + attribute.Key("http.host"): attribute.StringValue(address.String()), }, parent: "test", }, @@ -104,20 +118,22 @@ func TestHTTPRequestWithClientTrace(t *testing.T) { }, } for _, tl := range testLen { - if !assert.Contains(t, sr, tl.name) { + span, ok := getSpanFromRecorder(sr, tl.name) + if !assert.True(t, ok) { continue } - span := sr[tl.name] + if tl.parent != "" { - if assert.Contains(t, sr, tl.parent) { - assert.Equal(t, span.ParentSpanID(), sr[tl.parent].SpanContext().SpanID) + parent, ok := getSpanFromRecorder(sr, tl.parent) + if assert.True(t, ok) { + assert.Equal(t, span.ParentSpanID(), parent.SpanContext().SpanID) } } if len(tl.attributes) > 0 { attrs := span.Attributes() if tl.name == "http.getconn" { // http.local attribute uses a non-deterministic port. - local := label.Key("http.local") + local := attribute.Key("http.local") assert.Contains(t, attrs, local) delete(attrs, local) } @@ -126,27 +142,14 @@ func TestHTTPRequestWithClientTrace(t *testing.T) { } } -type MultiSpanRecorder map[string][]*oteltest.Span - -func (sr *MultiSpanRecorder) Reset() { (*sr) = MultiSpanRecorder{} } -func (sr *MultiSpanRecorder) OnStart(span *oteltest.Span) {} -func (sr *MultiSpanRecorder) OnEnd(span *oteltest.Span) { - (*sr)[span.Name()] = append((*sr)[span.Name()], span) -} - func TestConcurrentConnectionStart(t *testing.T) { - sr := MultiSpanRecorder{} - otel.SetTracerProvider( - oteltest.NewTracerProvider(oteltest.WithSpanRecorder(&sr)), - ) - ct := otelhttptrace.NewClientTrace(context.Background()) tts := []struct { name string - run func() + run func(*httptrace.ClientTrace) }{ { name: "Open1Close1Open2Close2", - run: func() { + run: func(ct *httptrace.ClientTrace) { ct.ConnectStart("tcp", "127.0.0.1:3000") ct.ConnectDone("tcp", "127.0.0.1:3000", nil) ct.ConnectStart("tcp", "[::1]:3000") @@ -155,7 +158,7 @@ func TestConcurrentConnectionStart(t *testing.T) { }, { name: "Open2Close2Open1Close1", - run: func() { + run: func(ct *httptrace.ClientTrace) { ct.ConnectStart("tcp", "[::1]:3000") ct.ConnectDone("tcp", "[::1]:3000", nil) ct.ConnectStart("tcp", "127.0.0.1:3000") @@ -164,7 +167,7 @@ func TestConcurrentConnectionStart(t *testing.T) { }, { name: "Open1Open2Close1Close2", - run: func() { + run: func(ct *httptrace.ClientTrace) { ct.ConnectStart("tcp", "127.0.0.1:3000") ct.ConnectStart("tcp", "[::1]:3000") ct.ConnectDone("tcp", "127.0.0.1:3000", nil) @@ -173,7 +176,7 @@ func TestConcurrentConnectionStart(t *testing.T) { }, { name: "Open1Open2Close2Close1", - run: func() { + run: func(ct *httptrace.ClientTrace) { ct.ConnectStart("tcp", "127.0.0.1:3000") ct.ConnectStart("tcp", "[::1]:3000") ct.ConnectDone("tcp", "[::1]:3000", nil) @@ -182,7 +185,7 @@ func TestConcurrentConnectionStart(t *testing.T) { }, { name: "Open2Open1Close1Close2", - run: func() { + run: func(ct *httptrace.ClientTrace) { ct.ConnectStart("tcp", "[::1]:3000") ct.ConnectStart("tcp", "127.0.0.1:3000") ct.ConnectDone("tcp", "127.0.0.1:3000", nil) @@ -191,7 +194,7 @@ func TestConcurrentConnectionStart(t *testing.T) { }, { name: "Open2Open1Close2Close1", - run: func() { + run: func(ct *httptrace.ClientTrace) { ct.ConnectStart("tcp", "[::1]:3000") ct.ConnectStart("tcp", "127.0.0.1:3000") ct.ConnectDone("tcp", "[::1]:3000", nil) @@ -200,21 +203,25 @@ func TestConcurrentConnectionStart(t *testing.T) { }, } - expectedRemotes := []label.KeyValue{ - label.String("http.remote", "127.0.0.1:3000"), - label.String("http.remote", "[::1]:3000"), + expectedRemotes := []attribute.KeyValue{ + attribute.String("http.remote", "127.0.0.1:3000"), + attribute.String("http.remote", "[::1]:3000"), } for _, tt := range tts { t.Run(tt.name, func(t *testing.T) { - sr.Reset() - tt.run() - spans := sr["http.connect"] + // sr.Reset() + sr := &oteltest.SpanRecorder{} + otel.SetTracerProvider( + oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)), + ) + tt.run(otelhttptrace.NewClientTrace(context.Background())) + spans := getSpansFromRecorder(sr, "http.connect") require.Len(t, spans, 2) - var gotRemotes []label.KeyValue + var gotRemotes []attribute.KeyValue for _, span := range spans { for k, v := range span.Attributes() { - gotRemotes = append(gotRemotes, label.Any(string(k), v.AsInterface())) + gotRemotes = append(gotRemotes, attribute.Any(string(k), v.AsInterface())) } } assert.ElementsMatch(t, expectedRemotes, gotRemotes) @@ -223,17 +230,16 @@ func TestConcurrentConnectionStart(t *testing.T) { } func TestEndBeforeStartCreatesSpan(t *testing.T) { - sr := MultiSpanRecorder{} + sr := &oteltest.SpanRecorder{} otel.SetTracerProvider( - oteltest.NewTracerProvider(oteltest.WithSpanRecorder(&sr)), + oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)), ) ct := otelhttptrace.NewClientTrace(context.Background()) - ct.DNSDone(nhtrace.DNSDoneInfo{}) - ct.DNSStart(nhtrace.DNSStartInfo{Host: "example.com"}) + ct.DNSDone(httptrace.DNSDoneInfo{}) + ct.DNSStart(httptrace.DNSStartInfo{Host: "example.com"}) name := "http.dns" - require.Contains(t, sr, name) - spans := sr[name] + spans := getSpansFromRecorder(sr, name) require.Len(t, spans, 1) } diff --git a/instrumentation/net/http/httptrace/otelhttptrace/example/client/client.go b/instrumentation/net/http/httptrace/otelhttptrace/example/client/client.go index 28a92c19d0d..2732532153c 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/client/client.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/example/client/client.go @@ -29,9 +29,9 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/semconv" @@ -65,7 +65,7 @@ func main() { client := http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)} ctx := baggage.ContextWithValues(context.Background(), - label.String("username", "donuts"), + attribute.String("username", "donuts"), ) var body []byte diff --git a/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod b/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod index 357fdd0c455..88e8d249437 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod +++ b/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.17.0 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp 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/otel/trace v0.17.0 + go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.18.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp 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 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum b/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum index be01d7a49c5..667a7ca539f 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum +++ b/instrumentation/net/http/httptrace/otelhttptrace/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/net/http/httptrace/otelhttptrace/example/server/server.go b/instrumentation/net/http/httptrace/otelhttptrace/example/server/server.go index 594d8322813..c0d19f5ff3f 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/server/server.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/example/server/server.go @@ -22,9 +22,9 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" @@ -55,7 +55,7 @@ func initTracer() { func main() { initTracer() - uk := label.Key("username") + uk := attribute.Key("username") helloHandler := func(w http.ResponseWriter, req *http.Request) { ctx := req.Context() diff --git a/instrumentation/net/http/httptrace/otelhttptrace/go.mod b/instrumentation/net/http/httptrace/otelhttptrace/go.mod index e9032b9ff81..bb2501a7a6c 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/go.mod +++ b/instrumentation/net/http/httptrace/otelhttptrace/go.mod @@ -7,8 +7,8 @@ replace go.opentelemetry.io/contrib => ../../../../.. require ( github.com/google/go-cmp v0.5.4 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/net/http/httptrace/otelhttptrace/go.sum b/instrumentation/net/http/httptrace/otelhttptrace/go.sum index 6066f9a3eb3..69fa9ee6884 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/go.sum +++ b/instrumentation/net/http/httptrace/otelhttptrace/go.sum @@ -8,14 +8,14 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/net/http/httptrace/otelhttptrace/httptrace.go b/instrumentation/net/http/httptrace/otelhttptrace/httptrace.go index 6fc3025a38e..ee450565cd5 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/httptrace.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/httptrace.go @@ -19,8 +19,8 @@ import ( "net/http" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/baggage" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" "go.opentelemetry.io/otel/trace" @@ -50,20 +50,20 @@ func WithPropagators(props propagation.TextMapPropagator) Option { } // Returns the Attributes, Context Entries, and SpanContext that were encoded by Inject. -func Extract(ctx context.Context, req *http.Request, opts ...Option) ([]label.KeyValue, []label.KeyValue, trace.SpanContext) { +func Extract(ctx context.Context, req *http.Request, opts ...Option) ([]attribute.KeyValue, []attribute.KeyValue, trace.SpanContext) { c := newConfig(opts) - ctx = c.propagators.Extract(ctx, req.Header) + ctx = c.propagators.Extract(ctx, propagation.HeaderCarrier(req.Header)) attrs := append( semconv.HTTPServerAttributesFromHTTPRequest("", "", req), semconv.NetAttributesFromHTTPRequest("tcp", req)..., ) - labels := baggage.Set(ctx) - return attrs, (&labels).ToSlice(), trace.RemoteSpanContextFromContext(ctx) + attributes := baggage.Set(ctx) + return attrs, (&attributes).ToSlice(), trace.RemoteSpanContextFromContext(ctx) } func Inject(ctx context.Context, req *http.Request, opts ...Option) { c := newConfig(opts) - c.propagators.Inject(ctx, req.Header) + c.propagators.Inject(ctx, propagation.HeaderCarrier(req.Header)) } diff --git a/instrumentation/net/http/httptrace/otelhttptrace/httptrace_test.go b/instrumentation/net/http/httptrace/otelhttptrace/httptrace_test.go index af9c584f16b..95426db8253 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/httptrace_test.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/httptrace_test.go @@ -24,8 +24,8 @@ import ( "github.com/google/go-cmp/cmp" "go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/baggage" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" @@ -34,8 +34,8 @@ import ( func TestRoundtrip(t *testing.T) { tr := oteltest.NewTracerProvider().Tracer("httptrace/client") - var expectedAttrs map[label.Key]string - expectedCorrs := map[label.Key]string{label.Key("foo"): "bar"} + var expectedAttrs map[attribute.Key]string + expectedCorrs := map[attribute.Key]string{attribute.Key("foo"): "bar"} props := otelhttptrace.WithPropagators(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) @@ -44,7 +44,7 @@ func TestRoundtrip(t *testing.T) { http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { attrs, corrs, span := otelhttptrace.Extract(r.Context(), r, props) - actualAttrs := make(map[label.Key]string) + actualAttrs := make(map[attribute.Key]string) for _, attr := range attrs { if attr.Key == semconv.NetPeerPortKey { // Peer port will be non-deterministic @@ -57,7 +57,7 @@ func TestRoundtrip(t *testing.T) { t.Fatalf("[TestRoundtrip] Attributes are different: %v", diff) } - actualCorrs := make(map[label.Key]string) + actualCorrs := make(map[attribute.Key]string) for _, corr := range corrs { actualCorrs[corr.Key] = corr.Value.Emit() } @@ -80,7 +80,7 @@ func TestRoundtrip(t *testing.T) { address := ts.Listener.Addr() hp := strings.Split(address.String(), ":") - expectedAttrs = map[label.Key]string{ + expectedAttrs = map[attribute.Key]string{ semconv.HTTPFlavorKey: "1.1", semconv.HTTPHostKey: address.String(), semconv.HTTPMethodKey: "GET", @@ -98,7 +98,7 @@ func TestRoundtrip(t *testing.T) { err := func(ctx context.Context) error { ctx, span := tr.Start(ctx, "test") defer span.End() - ctx = baggage.ContextWithValues(ctx, label.String("foo", "bar")) + ctx = baggage.ContextWithValues(ctx, attribute.String("foo", "bar")) req, _ := http.NewRequest("GET", ts.URL, strings.NewReader("foo")) otelhttptrace.Inject(ctx, req, props) @@ -118,14 +118,14 @@ func TestRoundtrip(t *testing.T) { func TestSpecifyPropagators(t *testing.T) { tr := oteltest.NewTracerProvider().Tracer("httptrace/client") - expectedCorrs := map[label.Key]string{label.Key("foo"): "bar"} + expectedCorrs := map[attribute.Key]string{attribute.Key("foo"): "bar"} // Mock http server ts := httptest.NewServer( http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, corrs, span := otelhttptrace.Extract(r.Context(), r, otelhttptrace.WithPropagators(propagation.Baggage{})) - actualCorrs := make(map[label.Key]string) + actualCorrs := make(map[attribute.Key]string) for _, corr := range corrs { actualCorrs[corr.Key] = corr.Value.Emit() } @@ -150,7 +150,7 @@ func TestSpecifyPropagators(t *testing.T) { err := func(ctx context.Context) error { ctx, span := tr.Start(ctx, "test") defer span.End() - ctx = baggage.ContextWithValues(ctx, label.String("foo", "bar")) + ctx = baggage.ContextWithValues(ctx, attribute.String("foo", "bar")) req, _ := http.NewRequest("GET", ts.URL, nil) otelhttptrace.Inject(ctx, req, otelhttptrace.WithPropagators(propagation.Baggage{})) diff --git a/instrumentation/net/http/otelhttp/client_test.go b/instrumentation/net/http/otelhttp/client_test.go index 2b9efe33b11..f350d967542 100644 --- a/instrumentation/net/http/otelhttp/client_test.go +++ b/instrumentation/net/http/otelhttp/client_test.go @@ -29,7 +29,7 @@ import ( ) func TestConvenienceWrappers(t *testing.T) { - sr := new(oteltest.StandardSpanRecorder) + sr := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) orig := DefaultClient DefaultClient = &http.Client{ diff --git a/instrumentation/net/http/otelhttp/common.go b/instrumentation/net/http/otelhttp/common.go index 4d4e24ad58d..a5b356289ce 100644 --- a/instrumentation/net/http/otelhttp/common.go +++ b/instrumentation/net/http/otelhttp/common.go @@ -17,15 +17,15 @@ package otelhttp import ( "net/http" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" ) // Attribute keys that can be added to a span. const ( - ReadBytesKey = label.Key("http.read_bytes") // if anything was read from the request body, the total number of bytes read - ReadErrorKey = label.Key("http.read_error") // If an error occurred while reading a request, the string of the error (io.EOF is not recorded) - WroteBytesKey = label.Key("http.wrote_bytes") // if anything was written to the response writer, the total number of bytes written - WriteErrorKey = label.Key("http.write_error") // if an error occurred while writing a reply, the string of the error (io.EOF is not recorded) + ReadBytesKey = attribute.Key("http.read_bytes") // if anything was read from the request body, the total number of bytes read + ReadErrorKey = attribute.Key("http.read_error") // If an error occurred while reading a request, the string of the error (io.EOF is not recorded) + WroteBytesKey = attribute.Key("http.wrote_bytes") // if anything was written to the response writer, the total number of bytes written + WriteErrorKey = attribute.Key("http.write_error") // if an error occurred while writing a reply, the string of the error (io.EOF is not recorded) ) // Server HTTP metrics diff --git a/instrumentation/net/http/otelhttp/config_test.go b/instrumentation/net/http/otelhttp/config_test.go index 74aad017b39..27d6b4f8072 100644 --- a/instrumentation/net/http/otelhttp/config_test.go +++ b/instrumentation/net/http/otelhttp/config_test.go @@ -29,7 +29,7 @@ import ( func TestBasicFilter(t *testing.T) { rr := httptest.NewRecorder() - spanRecorder := new(oteltest.StandardSpanRecorder) + spanRecorder := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider( oteltest.WithSpanRecorder(spanRecorder), ) @@ -101,7 +101,7 @@ func TestSpanNameFormatter(t *testing.T) { t.Run(tc.name, func(t *testing.T) { rr := httptest.NewRecorder() - spanRecorder := new(oteltest.StandardSpanRecorder) + spanRecorder := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider( oteltest.WithSpanRecorder(spanRecorder), ) diff --git a/instrumentation/net/http/otelhttp/example/client/client.go b/instrumentation/net/http/otelhttp/example/client/client.go index c46c9de67f6..1123fe96fad 100644 --- a/instrumentation/net/http/otelhttp/example/client/client.go +++ b/instrumentation/net/http/otelhttp/example/client/client.go @@ -27,9 +27,9 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/semconv" @@ -63,7 +63,7 @@ func main() { client := http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)} ctx := baggage.ContextWithValues(context.Background(), - label.String("username", "donuts"), + attribute.String("username", "donuts"), ) var body []byte diff --git a/instrumentation/net/http/otelhttp/example/go.mod b/instrumentation/net/http/otelhttp/example/go.mod index 38df390fbac..a0afb75cda4 100644 --- a/instrumentation/net/http/otelhttp/example/go.mod +++ b/instrumentation/net/http/otelhttp/example/go.mod @@ -8,9 +8,9 @@ replace ( ) require ( - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp 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/otel/trace v0.17.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp 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 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/net/http/otelhttp/example/go.sum b/instrumentation/net/http/otelhttp/example/go.sum index be01d7a49c5..667a7ca539f 100644 --- a/instrumentation/net/http/otelhttp/example/go.sum +++ b/instrumentation/net/http/otelhttp/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/net/http/otelhttp/example/server/server.go b/instrumentation/net/http/otelhttp/example/server/server.go index 594d8322813..c0d19f5ff3f 100644 --- a/instrumentation/net/http/otelhttp/example/server/server.go +++ b/instrumentation/net/http/otelhttp/example/server/server.go @@ -22,9 +22,9 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" @@ -55,7 +55,7 @@ func initTracer() { func main() { initTracer() - uk := label.Key("username") + uk := attribute.Key("username") helloHandler := func(w http.ResponseWriter, req *http.Request) { ctx := req.Context() diff --git a/instrumentation/net/http/otelhttp/go.mod b/instrumentation/net/http/otelhttp/go.mod index 16b460a7028..53bd54f2cc8 100644 --- a/instrumentation/net/http/otelhttp/go.mod +++ b/instrumentation/net/http/otelhttp/go.mod @@ -7,9 +7,9 @@ replace go.opentelemetry.io/contrib => ../../../.. require ( github.com/felixge/httpsnoop v1.0.1 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/metric 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/metric v0.18.0 + go.opentelemetry.io/otel/oteltest v0.18.0 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/instrumentation/net/http/otelhttp/go.sum b/instrumentation/net/http/otelhttp/go.sum index a396f26a762..06355c84088 100644 --- a/instrumentation/net/http/otelhttp/go.sum +++ b/instrumentation/net/http/otelhttp/go.sum @@ -10,14 +10,14 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/net/http/otelhttp/handler.go b/instrumentation/net/http/otelhttp/handler.go index f3871a8e071..c912548b066 100644 --- a/instrumentation/net/http/otelhttp/handler.go +++ b/instrumentation/net/http/otelhttp/handler.go @@ -22,7 +22,7 @@ import ( "github.com/felixge/httpsnoop" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" @@ -34,7 +34,7 @@ var _ http.Handler = &Handler{} // Handler is http middleware that corresponds to the http.Handler interface and // is designed to wrap a http.Mux (or equivalent), while individual routes on // the mux are wrapped with WithRouteTag. A Handler will add various attributes -// to the span using the label.Keys defined in this package. +// to the span using the attribute.Keys defined in this package. type Handler struct { operation string handler http.Handler @@ -127,7 +127,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { trace.WithAttributes(semconv.HTTPServerAttributesFromHTTPRequest(h.operation, "", r)...), }, h.spanStartOptions...) // start with the configured options - ctx := h.propagators.Extract(r.Context(), r.Header) + ctx := h.propagators.Extract(r.Context(), propagation.HeaderCarrier(r.Header)) ctx, span := h.tracer.Start(ctx, h.spanNameFormatter(h.operation, r), opts...) defer span.End() @@ -181,37 +181,37 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { setAfterServeAttributes(span, bw.read, rww.written, rww.statusCode, bw.err, rww.err) // Add metrics - labels := append(labeler.Get(), semconv.HTTPServerMetricAttributesFromHTTPRequest(h.operation, r)...) - h.counters[RequestContentLength].Add(ctx, bw.read, labels...) - h.counters[ResponseContentLength].Add(ctx, rww.written, labels...) + attributes := append(labeler.Get(), semconv.HTTPServerMetricAttributesFromHTTPRequest(h.operation, r)...) + h.counters[RequestContentLength].Add(ctx, bw.read, attributes...) + h.counters[ResponseContentLength].Add(ctx, rww.written, attributes...) elapsedTime := time.Since(requestStartTime).Microseconds() - h.valueRecorders[ServerLatency].Record(ctx, elapsedTime, labels...) + h.valueRecorders[ServerLatency].Record(ctx, elapsedTime, attributes...) } func setAfterServeAttributes(span trace.Span, read, wrote int64, statusCode int, rerr, werr error) { - labels := []label.KeyValue{} + attributes := []attribute.KeyValue{} // TODO: Consider adding an event after each read and write, possibly as an // option (defaulting to off), so as to not create needlessly verbose spans. if read > 0 { - labels = append(labels, ReadBytesKey.Int64(read)) + attributes = append(attributes, ReadBytesKey.Int64(read)) } if rerr != nil && rerr != io.EOF { - labels = append(labels, ReadErrorKey.String(rerr.Error())) + attributes = append(attributes, ReadErrorKey.String(rerr.Error())) } if wrote > 0 { - labels = append(labels, WroteBytesKey.Int64(wrote)) + attributes = append(attributes, WroteBytesKey.Int64(wrote)) } if statusCode > 0 { - labels = append(labels, semconv.HTTPAttributesFromHTTPStatusCode(statusCode)...) + attributes = append(attributes, semconv.HTTPAttributesFromHTTPStatusCode(statusCode)...) span.SetStatus(semconv.SpanStatusFromHTTPStatusCode(statusCode)) } if werr != nil && werr != io.EOF { - labels = append(labels, WriteErrorKey.String(werr.Error())) + attributes = append(attributes, WriteErrorKey.String(werr.Error())) } - span.SetAttributes(labels...) + span.SetAttributes(attributes...) } // WithRouteTag annotates a span with the provided route name using the diff --git a/instrumentation/net/http/otelhttp/handler_example_test.go b/instrumentation/net/http/otelhttp/handler_example_test.go index 257745bdfdf..84b096ac1f7 100644 --- a/instrumentation/net/http/otelhttp/handler_example_test.go +++ b/instrumentation/net/http/otelhttp/handler_example_test.go @@ -22,7 +22,7 @@ import ( "net/http" "strings" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" @@ -50,7 +50,7 @@ func ExampleNewHandler() { case "": err = fmt.Errorf("expected /hello/:name in %q", s) default: - trace.SpanFromContext(ctx).SetAttributes(label.String("name", pp[1])) + trace.SpanFromContext(ctx).SetAttributes(attribute.String("name", pp[1])) } return pp[1], err } @@ -74,7 +74,7 @@ func ExampleNewHandler() { }(ctx); err != nil { log.Println("error figuring out name: ", err) http.Error(w, err.Error(), http.StatusInternalServerError) - labeler.Add(label.Bool("error", true)) + labeler.Add(attribute.Bool("error", true)) return } @@ -82,14 +82,14 @@ func ExampleNewHandler() { if err != nil { log.Println("error reading body: ", err) w.WriteHeader(http.StatusBadRequest) - labeler.Add(label.Bool("error", true)) + labeler.Add(attribute.Bool("error", true)) return } n, err := io.WriteString(w, "Hello, "+name+"!\nYou sent me this:\n"+string(d)) if err != nil { log.Printf("error writing reply after %d bytes: %s", n, err) - labeler.Add(label.Bool("error", true)) + labeler.Add(attribute.Bool("error", true)) } }), ), diff --git a/instrumentation/net/http/otelhttp/handler_test.go b/instrumentation/net/http/otelhttp/handler_test.go index f1c3bae80d4..0ac508a8b03 100644 --- a/instrumentation/net/http/otelhttp/handler_test.go +++ b/instrumentation/net/http/otelhttp/handler_test.go @@ -24,24 +24,24 @@ 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/propagation" "go.opentelemetry.io/otel/semconv" "go.opentelemetry.io/otel/trace" ) -func assertMetricLabels(t *testing.T, expectedLabels []label.KeyValue, measurementBatches []oteltest.Batch) { +func assertMetricAttributes(t *testing.T, expectedAttributes []attribute.KeyValue, measurementBatches []oteltest.Batch) { for _, batch := range measurementBatches { - assert.ElementsMatch(t, expectedLabels, batch.Labels) + assert.ElementsMatch(t, expectedAttributes, batch.Labels) } } func TestHandlerBasics(t *testing.T) { rr := httptest.NewRecorder() - spanRecorder := new(oteltest.StandardSpanRecorder) + spanRecorder := new(oteltest.SpanRecorder) provider := oteltest.NewTracerProvider( oteltest.WithSpanRecorder(spanRecorder), ) @@ -52,7 +52,7 @@ func TestHandlerBasics(t *testing.T) { h := NewHandler( http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { l, _ := LabelerFromContext(r.Context()) - l.Add(label.String("test", "label")) + l.Add(attribute.String("test", "attribute")) if _, err := io.WriteString(w, "hello world"); err != nil { t.Fatal(err) @@ -73,15 +73,15 @@ func TestHandlerBasics(t *testing.T) { t.Fatalf("got 0 recorded measurements, expected 1 or more") } - labelsToVerify := []label.KeyValue{ + attributesToVerify := []attribute.KeyValue{ semconv.HTTPServerNameKey.String(operation), semconv.HTTPSchemeHTTP, semconv.HTTPHostKey.String(r.Host), semconv.HTTPFlavorKey.String(fmt.Sprintf("1.%d", r.ProtoMinor)), - label.String("test", "label"), + attribute.String("test", "attribute"), } - assertMetricLabels(t, labelsToVerify, meterimpl.MeasurementBatches) + assertMetricAttributes(t, attributesToVerify, meterimpl.MeasurementBatches) if got, expected := rr.Result().StatusCode, http.StatusOK; got != expected { t.Fatalf("got %d, expected %d", got, expected) diff --git a/instrumentation/net/http/otelhttp/labeler.go b/instrumentation/net/http/otelhttp/labeler.go index d5a5901804d..a1d102e769e 100644 --- a/instrumentation/net/http/otelhttp/labeler.go +++ b/instrumentation/net/http/otelhttp/labeler.go @@ -18,29 +18,29 @@ import ( "context" "sync" - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" ) -// Labeler is used to allow instrumented HTTP handlers to add custom labels to +// Labeler is used to allow instrumented HTTP handlers to add custom attributes to // the metrics recorded by the net/http instrumentation. type Labeler struct { - mu sync.Mutex - labels []label.KeyValue + mu sync.Mutex + attributes []attribute.KeyValue } -// Add labels to a Labeler. -func (l *Labeler) Add(ls ...label.KeyValue) { +// Add attributes to a Labeler. +func (l *Labeler) Add(ls ...attribute.KeyValue) { l.mu.Lock() defer l.mu.Unlock() - l.labels = append(l.labels, ls...) + l.attributes = append(l.attributes, ls...) } -// Labels returns a copy of the labels added to the Labeler. -func (l *Labeler) Get() []label.KeyValue { +// Labels returns a copy of the attributes added to the Labeler. +func (l *Labeler) Get() []attribute.KeyValue { l.mu.Lock() defer l.mu.Unlock() - ret := make([]label.KeyValue, len(l.labels)) - copy(ret, l.labels) + ret := make([]attribute.KeyValue, len(l.attributes)) + copy(ret, l.attributes) return ret } @@ -55,7 +55,7 @@ func injectLabeler(ctx context.Context, l *Labeler) context.Context { // LabelerFromContext retrieves a Labeler instance from the provided context if // one is available. If no Labeler was found in the provided context a new, empty // Labeler is returned and the second return value is false. In this case it is -// safe to use the Labeler but any labels added to it will not be used. +// safe to use the Labeler but any attributes added to it will not be used. func LabelerFromContext(ctx context.Context) (*Labeler, bool) { l, ok := ctx.Value(lablelerContextKey).(*Labeler) if !ok { diff --git a/instrumentation/net/http/otelhttp/transport.go b/instrumentation/net/http/otelhttp/transport.go index c0e292bfa47..38cf6f33630 100644 --- a/instrumentation/net/http/otelhttp/transport.go +++ b/instrumentation/net/http/otelhttp/transport.go @@ -85,7 +85,7 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { r = r.WithContext(ctx) span.SetAttributes(semconv.HTTPClientAttributesFromHTTPRequest(r)...) - t.propagators.Inject(ctx, r.Header) + t.propagators.Inject(ctx, propagation.HeaderCarrier(r.Header)) res, err := t.rt.RoundTrip(r) if err != nil { diff --git a/instrumentation/net/http/otelhttp/transport_test.go b/instrumentation/net/http/otelhttp/transport_test.go index 2e5240101c5..08f52ffb3ae 100644 --- a/instrumentation/net/http/otelhttp/transport_test.go +++ b/instrumentation/net/http/otelhttp/transport_test.go @@ -33,7 +33,7 @@ func TestTransportBasics(t *testing.T) { content := []byte("Hello, world!") ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - ctx := prop.Extract(r.Context(), r.Header) + ctx := prop.Extract(r.Context(), propagation.HeaderCarrier(r.Header)) span := trace.RemoteSpanContextFromContext(ctx) tgtID, err := trace.SpanIDFromHex(fmt.Sprintf("%016x", uint(2))) if err != nil { diff --git a/instrumentation/net/http/otelhttp/wrap.go b/instrumentation/net/http/otelhttp/wrap.go index 7672191facc..ec787c820a0 100644 --- a/instrumentation/net/http/otelhttp/wrap.go +++ b/instrumentation/net/http/otelhttp/wrap.go @@ -91,6 +91,6 @@ func (w *respWriterWrapper) WriteHeader(statusCode int) { } w.wroteHeader = true w.statusCode = statusCode - w.props.Inject(w.ctx, w.Header()) + w.props.Inject(w.ctx, propagation.HeaderCarrier(w.Header())) w.ResponseWriter.WriteHeader(statusCode) } diff --git a/instrumentation/runtime/example/go.mod b/instrumentation/runtime/example/go.mod index 2941b0b8dcb..d83bf17a080 100644 --- a/instrumentation/runtime/example/go.mod +++ b/instrumentation/runtime/example/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - go.opentelemetry.io/contrib/instrumentation/runtime v0.17.0 - go.opentelemetry.io/otel/exporters/stdout v0.17.0 - go.opentelemetry.io/otel/sdk/metric v0.17.0 + go.opentelemetry.io/contrib/instrumentation/runtime v0.18.0 + go.opentelemetry.io/otel/exporters/stdout v0.18.0 + go.opentelemetry.io/otel/sdk/metric v0.18.0 ) diff --git a/instrumentation/runtime/example/go.sum b/instrumentation/runtime/example/go.sum index 831117de5d4..677671ced38 100644 --- a/instrumentation/runtime/example/go.sum +++ b/instrumentation/runtime/example/go.sum @@ -9,22 +9,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/runtime/go.mod b/instrumentation/runtime/go.mod index 087cce4329f..59941822f76 100644 --- a/instrumentation/runtime/go.mod +++ b/instrumentation/runtime/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/metric v0.17.0 - go.opentelemetry.io/otel/oteltest v0.17.0 + go.opentelemetry.io/contrib v0.18.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/metric v0.18.0 + go.opentelemetry.io/otel/oteltest v0.18.0 ) diff --git a/instrumentation/runtime/go.sum b/instrumentation/runtime/go.sum index 6066f9a3eb3..69fa9ee6884 100644 --- a/instrumentation/runtime/go.sum +++ b/instrumentation/runtime/go.sum @@ -8,14 +8,14 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/propagators/aws/go.mod b/propagators/aws/go.mod index c64f95d4972..fc61069ccab 100644 --- a/propagators/aws/go.mod +++ b/propagators/aws/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/sdk v0.17.0 - go.opentelemetry.io/otel/trace v0.17.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/sdk v0.18.0 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/propagators/aws/go.sum b/propagators/aws/go.sum index a5941df7846..4f0c5be5223 100644 --- a/propagators/aws/go.sum +++ b/propagators/aws/go.sum @@ -8,16 +8,16 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/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/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/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/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/propagators/b3/b3_benchmark_test.go b/propagators/b3/b3_benchmark_test.go index 1c79bf3279a..defeca48627 100644 --- a/propagators/b3/b3_benchmark_test.go +++ b/propagators/b3/b3_benchmark_test.go @@ -20,6 +20,7 @@ import ( "testing" "go.opentelemetry.io/contrib/propagators/b3" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -50,7 +51,7 @@ func BenchmarkExtractB3(b *testing.B) { b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { - _ = propagator.Extract(ctx, req.Header) + _ = propagator.Extract(ctx, propagation.HeaderCarrier(req.Header)) } }) } @@ -84,7 +85,7 @@ func BenchmarkInjectB3(b *testing.B) { b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { - propagator.Inject(ctx, req.Header) + propagator.Inject(ctx, propagation.HeaderCarrier(req.Header)) } }) } diff --git a/propagators/b3/b3_integration_test.go b/propagators/b3/b3_integration_test.go index 37df22243c1..a69df47b663 100644 --- a/propagators/b3/b3_integration_test.go +++ b/propagators/b3/b3_integration_test.go @@ -23,6 +23,7 @@ import ( "go.opentelemetry.io/contrib/propagators/b3" "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -57,7 +58,7 @@ func TestExtractB3(t *testing.T) { } ctx := context.Background() - ctx = propagator.Extract(ctx, req.Header) + ctx = propagator.Extract(ctx, propagation.HeaderCarrier(req.Header)) gotSc := trace.RemoteSpanContextFromContext(ctx) if diff := cmp.Diff(gotSc, tt.wantSc, cmp.AllowUnexported(trace.TraceState{})); diff != "" { t.Errorf("%s: %s: -got +want %s", tg.name, tt.name, diff) @@ -103,7 +104,7 @@ func TestInjectB3(t *testing.T) { sc: tt.sc, }, ) - propagator.Inject(ctx, req.Header) + propagator.Inject(ctx, propagation.HeaderCarrier(req.Header)) for h, v := range tt.wantHeaders { got, want := req.Header.Get(h), v diff --git a/propagators/go.mod b/propagators/go.mod index bc37fa1886b..a591e1cb331 100644 --- a/propagators/go.mod +++ b/propagators/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/contrib => ./.. require ( github.com/google/go-cmp v0.5.4 github.com/stretchr/testify v1.7.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/otel v0.18.0 + go.opentelemetry.io/otel/oteltest v0.18.0 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/propagators/go.sum b/propagators/go.sum index 6066f9a3eb3..69fa9ee6884 100644 --- a/propagators/go.sum +++ b/propagators/go.sum @@ -8,14 +8,14 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= 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/propagators/jaeger/jaeger_integration_test.go b/propagators/jaeger/jaeger_integration_test.go index 49931463b5d..c350099045e 100644 --- a/propagators/jaeger/jaeger_integration_test.go +++ b/propagators/jaeger/jaeger_integration_test.go @@ -23,6 +23,7 @@ import ( "go.opentelemetry.io/contrib/propagators/jaeger" "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -57,7 +58,7 @@ func TestExtractJaeger(t *testing.T) { } ctx := context.Background() - ctx = propagator.Extract(ctx, req.Header) + ctx = propagator.Extract(ctx, propagation.HeaderCarrier(req.Header)) resSc := trace.RemoteSpanContextFromContext(ctx) if diff := cmp.Diff(resSc, tc.expected, cmp.AllowUnexported(trace.TraceState{})); diff != "" { t.Errorf("%s: %s: -got +want %s", tg.name, tc.name, diff) @@ -103,7 +104,7 @@ func TestInjectJaeger(t *testing.T) { sc: tc.sc, }, ) - propagator.Inject(ctx, req.Header) + propagator.Inject(ctx, propagation.HeaderCarrier(req.Header)) for h, v := range tc.wantHeaders { result, want := req.Header.Get(h), v diff --git a/propagators/opencensus/binary_test.go b/propagators/opencensus/binary_test.go index a606949223a..0d799ecd1eb 100644 --- a/propagators/opencensus/binary_test.go +++ b/propagators/opencensus/binary_test.go @@ -23,6 +23,7 @@ import ( "github.com/google/go-cmp/cmp" "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -96,7 +97,7 @@ func TestInject(t *testing.T) { ctx = trace.ContextWithRemoteSpanContext(ctx, tt.sc) ctx, _ = mockTracer.Start(ctx, "inject") } - prop.Inject(ctx, req.Header) + prop.Inject(ctx, propagation.HeaderCarrier(req.Header)) gotHeader := req.Header.Get("grpc-trace-bin") if gotHeader != tt.wantHeader { @@ -145,7 +146,7 @@ func TestExtract(t *testing.T) { req.Header.Set("grpc-trace-bin", tt.header) ctx := context.Background() - ctx = prop.Extract(ctx, req.Header) + ctx = prop.Extract(ctx, propagation.HeaderCarrier(req.Header)) gotSc := trace.RemoteSpanContextFromContext(ctx) if diff := cmp.Diff(gotSc, tt.wantSc, cmp.AllowUnexported(trace.TraceState{})); diff != "" { t.Errorf("%s: -got +want %s", tt.desc, diff) diff --git a/propagators/opencensus/examples/go.mod b/propagators/opencensus/examples/go.mod index b015e270ca7..784d0d4e000 100644 --- a/propagators/opencensus/examples/go.mod +++ b/propagators/opencensus/examples/go.mod @@ -4,11 +4,11 @@ go 1.14 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.17.0 - go.opentelemetry.io/contrib/propagation/opencensus 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/google.golang.org/grpc/otelgrpc v0.18.0 + go.opentelemetry.io/contrib/propagation/opencensus 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 google.golang.org/grpc v1.36.0 ) diff --git a/propagators/opencensus/examples/go.sum b/propagators/opencensus/examples/go.sum index 266f6266261..f3ef470fece 100644 --- a/propagators/opencensus/examples/go.sum +++ b/propagators/opencensus/examples/go.sum @@ -54,24 +54,24 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f h1:IUmbcoP9XyEXW+R9AbrZgDvaYVfTbISN92Y5RIV+Mx4= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -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/bridge/opencensus v0.17.0 h1:hoiUYt/VC5I4P7TPbed7NniMfUNabyS9KXJtsczgkcw= -go.opentelemetry.io/otel/bridge/opencensus v0.17.0/go.mod h1:hcqgdsiy4BdVLcqX9L+JZvFYv2qQE4DaBQ/zxwD0F6A= -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/bridge/opencensus v0.18.0 h1:erIzEDtNfQ96rPGEgNeHsugTCtbtK4OlXCZ1CO35i1E= +go.opentelemetry.io/otel/bridge/opencensus v0.18.0/go.mod h1:vRz4w6xxjBCueb2SFNTxVJh1yy0rbaIxC/hCJy6UVqM= +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= go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/propagators/opencensus/go.mod b/propagators/opencensus/go.mod index aefa80965bd..5f3649bb121 100644 --- a/propagators/opencensus/go.mod +++ b/propagators/opencensus/go.mod @@ -5,8 +5,8 @@ go 1.14 require ( github.com/google/go-cmp v0.5.4 go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v0.17.0 - go.opentelemetry.io/otel/bridge/opencensus v0.17.0 - go.opentelemetry.io/otel/oteltest v0.17.0 - go.opentelemetry.io/otel/trace v0.17.0 + go.opentelemetry.io/otel v0.18.0 + go.opentelemetry.io/otel/bridge/opencensus v0.18.0 + go.opentelemetry.io/otel/oteltest v0.18.0 + go.opentelemetry.io/otel/trace v0.18.0 ) diff --git a/propagators/opencensus/go.sum b/propagators/opencensus/go.sum index 036ec2da3ad..32019b295c9 100644 --- a/propagators/opencensus/go.sum +++ b/propagators/opencensus/go.sum @@ -20,16 +20,16 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f h1:IUmbcoP9XyEXW+R9AbrZgDvaYVfTbISN92Y5RIV+Mx4= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -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/bridge/opencensus v0.17.0 h1:hoiUYt/VC5I4P7TPbed7NniMfUNabyS9KXJtsczgkcw= -go.opentelemetry.io/otel/bridge/opencensus v0.17.0/go.mod h1:hcqgdsiy4BdVLcqX9L+JZvFYv2qQE4DaBQ/zxwD0F6A= -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/bridge/opencensus v0.18.0 h1:erIzEDtNfQ96rPGEgNeHsugTCtbtK4OlXCZ1CO35i1E= +go.opentelemetry.io/otel/bridge/opencensus v0.18.0/go.mod h1:vRz4w6xxjBCueb2SFNTxVJh1yy0rbaIxC/hCJy6UVqM= +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/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= diff --git a/propagators/ot/ot_data_test.go b/propagators/ot/ot_data_test.go index 316136e4bb0..32b4b4af8b9 100644 --- a/propagators/ot/ot_data_test.go +++ b/propagators/ot/ot_data_test.go @@ -15,7 +15,7 @@ package ot_test import ( - "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" ) @@ -38,11 +38,11 @@ var ( traceID16 = trace.TraceID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0xce, 0x92, 0x9d, 0x0e, 0x0e, 0x47, 0x36} traceID32 = trace.TraceID{0xa1, 0xce, 0x92, 0x9d, 0x0e, 0x0e, 0x47, 0x36, 0xa3, 0xce, 0x92, 0x9d, 0x0e, 0x0e, 0x47, 0x36} spanID = trace.SpanID{0x00, 0xf0, 0x67, 0xaa, 0x0b, 0xa9, 0x02, 0xb7} - emptyBaggage = &label.Set{} + emptyBaggage = &attribute.Set{} // TODO: once baggage extraction is supported, re-enable this - // baggageSet = label.NewSet( - // label.String(baggageKey, baggageValue), - // label.String(baggageKey2, baggageValue2), + // baggageSet = attribute.NewSet( + // attribute.String(baggageKey, baggageValue), + // attribute.String(baggageKey2, baggageValue2), // ) ) @@ -50,7 +50,7 @@ type extractTest struct { name string headers map[string]string expected trace.SpanContext - baggage *label.Set + baggage *attribute.Set } var extractHeaders = []extractTest{ @@ -185,7 +185,7 @@ type injectTest struct { name string sc trace.SpanContext wantHeaders map[string]string - baggage []label.KeyValue + baggage []attribute.KeyValue } var injectHeaders = []injectTest{ @@ -208,9 +208,9 @@ var injectHeaders = []injectTest{ TraceID: traceID32, SpanID: spanID, }, - baggage: []label.KeyValue{ - label.String(baggageKey, baggageValue), - label.String(baggageKey2, baggageValue2), + baggage: []attribute.KeyValue{ + attribute.String(baggageKey, baggageValue), + attribute.String(baggageKey2, baggageValue2), }, wantHeaders: map[string]string{ traceIDHeader: traceID16Str, diff --git a/propagators/ot/ot_integration_test.go b/propagators/ot/ot_integration_test.go index 46c7954170a..b2a5320f556 100644 --- a/propagators/ot/ot_integration_test.go +++ b/propagators/ot/ot_integration_test.go @@ -24,6 +24,7 @@ import ( "go.opentelemetry.io/contrib/propagators/ot" "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -58,7 +59,7 @@ func TestExtractOT(t *testing.T) { } ctx := context.Background() - ctx = propagator.Extract(ctx, req.Header) + ctx = propagator.Extract(ctx, propagation.HeaderCarrier(req.Header)) resSc := trace.RemoteSpanContextFromContext(ctx) if diff := cmp.Diff(resSc, tc.expected, cmp.AllowUnexported(trace.TraceState{})); diff != "" { t.Errorf("%s: %s: -got +want %s", tg.name, tc.name, diff) @@ -66,12 +67,12 @@ func TestExtractOT(t *testing.T) { m := baggage.Set(ctx) mi := tc.baggage.Iter() for mi.Next() { - label := mi.Label() - val, ok := m.Value(label.Key) + attribute := mi.Attribute() + val, ok := m.Value(attribute.Key) if !ok { - t.Errorf("%s: %s: expected key '%s'", tg.name, tc.name, label.Key) + t.Errorf("%s: %s: expected key '%s'", tg.name, tc.name, attribute.Key) } - if diff := cmp.Diff(label.Value.AsString(), val.AsString()); diff != "" { + if diff := cmp.Diff(attribute.Value.AsString(), val.AsString()); diff != "" { t.Errorf("%s: %s: -got +want %s", tg.name, tc.name, diff) } } @@ -120,7 +121,7 @@ func TestInjectOT(t *testing.T) { sc: tc.sc, }, ) - propagator.Inject(ctx, req.Header) + propagator.Inject(ctx, propagation.HeaderCarrier(req.Header)) for h, v := range tc.wantHeaders { result, want := req.Header.Get(h), v diff --git a/propagators/ot/ot_propagator.go b/propagators/ot/ot_propagator.go index 0cc9aed30dd..7e1e3a67db9 100644 --- a/propagators/ot/ot_propagator.go +++ b/propagators/ot/ot_propagator.go @@ -75,8 +75,8 @@ func (o OT) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { mi := m.Iter() for mi.Next() { - label := mi.Label() - carrier.Set(fmt.Sprintf("ot-baggage-%s", label.Key), label.Value.Emit()) + attribute := mi.Attribute() + carrier.Set(fmt.Sprintf("ot-baggage-%s", attribute.Key), attribute.Value.Emit()) } }