diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ccd589a26e..a6d2dc7a5c4 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.14.0] - 2020-11-20 + ### Added - `otelhttp.{Get,Head,Post,PostForm}` convenience wrappers for their `http` counterparts. (#390) +- The AWS detector now adds the cloud zone, host image ID, host type, and host name to the returned `Resource`. (#410) ### Changed @@ -22,6 +25,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## Fixed - `/detectors/aws` no longer fails if instance metadata is not available (e.g. not running in AWS) (#401) +- The AWS detector now returns a partial resource and an appropriate error if it encounters an error part way through determining a `Resource` identity. (#410) +- The `host` instrumentation unit test has been updated to not depend on the system it runs on. (#426) ## [0.13.0] - 2020-10-09 @@ -224,7 +229,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.13.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go-contrib/compare/v0.14.0...HEAD +[0.14.0]: https://github.com/open-telemetry/opentelemetry-go-contrib/releases/tag/v0.14.0 [0.13.0]: https://github.com/open-telemetry/opentelemetry-go-contrib/releases/tag/v0.13.0 [0.12.0]: https://github.com/open-telemetry/opentelemetry-go-contrib/releases/tag/v0.12.0 [0.11.0]: https://github.com/open-telemetry/opentelemetry-go-contrib/releases/tag/v0.11.0 diff --git a/contrib.go b/contrib.go index 0f288ae7904..eb7e5f45fc1 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.13.0" + return "0.14.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 f7642997857..204dd820ce0 100644 --- a/detectors/aws/aws.go +++ b/detectors/aws/aws.go @@ -77,7 +77,7 @@ func (aws *AWS) Detect(ctx context.Context) (*resource.Resource, error) { err = fmt.Errorf("%w: %s", resource.ErrPartialResource, m.errs) } - return resource.New(labels...), err + return resource.NewWithAttributes(labels...), err } func (aws *AWS) client() (client, error) { diff --git a/detectors/aws/aws_test.go b/detectors/aws/aws_test.go index 39b4a31acba..4c7d5a0ab98 100644 --- a/detectors/aws/aws_test.go +++ b/detectors/aws/aws_test.go @@ -90,7 +90,7 @@ func TestAWS_Detect(t *testing.T) { Fields: fields{ Client: &clientMock{available: true, idDoc: usWestInst, metadata: map[string]meta{}}, }, - Want: want{Resource: resource.New(usWestIDLabels...)}, + Want: want{Resource: resource.NewWithAttributes(usWestIDLabels...)}, }, "Hostname Response Error": { Fields: fields{ @@ -105,7 +105,7 @@ func TestAWS_Detect(t *testing.T) { Want: want{ Error: `partial resource: ["hostname": 500 EC2MetadataError]`, Partial: true, - Resource: resource.New(usWestIDLabels...), + Resource: resource.NewWithAttributes(usWestIDLabels...), }, }, "Hostname General Error": { @@ -121,7 +121,7 @@ func TestAWS_Detect(t *testing.T) { Want: want{ Error: `partial resource: ["hostname": unknown error]`, Partial: true, - Resource: resource.New(usWestIDLabels...), + Resource: resource.NewWithAttributes(usWestIDLabels...), }, }, "All Available": { @@ -134,7 +134,7 @@ func TestAWS_Detect(t *testing.T) { }, }, }, - Want: want{Resource: resource.New( + Want: want{Resource: resource.NewWithAttributes( semconv.CloudProviderAWS, semconv.CloudRegionKey.String("us-west-2"), semconv.CloudZoneKey.String("us-west-2b"), diff --git a/detectors/aws/go.mod b/detectors/aws/go.mod index b7d7fbce062..2bbbabf5a97 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.35.28 github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/detectors/aws/go.sum b/detectors/aws/go.sum index 9e66dc4678e..34fe7ddb3cd 100644 --- a/detectors/aws/go.sum +++ b/detectors/aws/go.sum @@ -5,8 +5,8 @@ github.com/benbjohnson/clock v1.0.3 h1:vkLuvpK4fmtSCuo60+yC63p7y0BmQ8gm5ZXGuBCJy github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -18,10 +18,10 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= diff --git a/detectors/gcp/gce.go b/detectors/gcp/gce.go index ba7adde7021..f5a699736bf 100644 --- a/detectors/gcp/gce.go +++ b/detectors/gcp/gce.go @@ -91,7 +91,7 @@ func (gce *GCE) Detect(ctx context.Context) (*resource.Resource, error) { aggregatedErr = fmt.Errorf("detecting GCE resources: %s", errInfo) } - return resource.New(labels...), aggregatedErr + return resource.NewWithAttributes(labels...), 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 fa562e609f5..012f97b0af2 100644 --- a/detectors/gcp/gke.go +++ b/detectors/gcp/gke.go @@ -61,7 +61,7 @@ func (gke *GKE) Detect(ctx context.Context) (*resource.Resource, error) { labels = append(labels, semconv.K8SClusterNameKey.String(clusterName)) } - k8sLabelRes := resource.New(labels...) + k8sLabelRes := resource.NewWithAttributes(labels...) var aggregatedErr error if len(errInfo) > 0 { aggregatedErr = fmt.Errorf("detecting GKE resources: %s", errInfo) diff --git a/detectors/gcp/go.mod b/detectors/gcp/go.mod index d0511746ee6..b935714849e 100644 --- a/detectors/gcp/go.mod +++ b/detectors/gcp/go.mod @@ -4,6 +4,6 @@ go 1.14 require ( cloud.google.com/go v0.72.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/detectors/gcp/go.sum b/detectors/gcp/go.sum index 215fa2ad3c0..f83a56b3068 100644 --- a/detectors/gcp/go.sum +++ b/detectors/gcp/go.sum @@ -94,6 +94,8 @@ github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -141,10 +143,10 @@ 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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 b4fff4f4264..2dcb8e2adf8 100644 --- a/exporters/metric/cortex/cortex.go +++ b/exporters/metric/cortex/cortex.go @@ -27,9 +27,10 @@ import ( "github.com/golang/snappy" "github.com/prometheus/prometheus/prompb" - "go.opentelemetry.io/otel/api/global" - apimetric "go.opentelemetry.io/otel/api/metric" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/label" + apimetric "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/sdk/export/metric" export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/export/metric/aggregation" @@ -45,7 +46,7 @@ type Exporter struct { // ExportKindFor returns CumulativeExporter so the Processor correctly aggregates data func (e *Exporter) ExportKindFor(*apimetric.Descriptor, aggregation.Kind) metric.ExportKind { - return metric.CumulativeExporter + return metric.CumulativeExportKind } // Export forwards metrics to Cortex from the SDK @@ -111,7 +112,7 @@ func InstallNewPipeline(config Config, options ...push.Option) (*push.Controller if err != nil { return nil, err } - global.SetMeterProvider(pusher.MeterProvider()) + otel.SetMeterProvider(pusher.MeterProvider()) return pusher, nil } @@ -183,7 +184,7 @@ func (e *Exporter) ConvertToTimeSeries(checkpointSet export.CheckpointSet) ([]*p } // createTimeSeries is a helper function to create a timeseries from a value and labels -func createTimeSeries(record metric.Record, value apimetric.Number, valueNumberKind apimetric.NumberKind, extraLabels ...label.KeyValue) *prompb.TimeSeries { +func createTimeSeries(record metric.Record, value number.Number, valueNumberKind number.Kind, extraLabels ...label.KeyValue) *prompb.TimeSeries { sample := prompb.Sample{ Value: value.CoerceToFloat64(valueNumberKind), Timestamp: int64(time.Nanosecond) * record.EndTime().UnixNano() / int64(time.Millisecond), @@ -256,7 +257,7 @@ func convertFromMinMaxSumCount(record metric.Record, minMaxSumCount aggregation. return nil, err } name = sanitize(record.Descriptor().Name() + "_count") - countTimeSeries := createTimeSeries(record, apimetric.NewInt64Number(count), apimetric.Int64NumberKind, label.String("__name__", name)) + countTimeSeries := createTimeSeries(record, number.NewInt64Number(count), number.Int64Kind, label.String("__name__", name)) // Return all timeSeries tSeries := []*prompb.TimeSeries{ @@ -305,7 +306,7 @@ func convertFromDistribution(record metric.Record, distribution aggregation.Dist return nil, err } name = sanitize(record.Descriptor().Name() + "_count") - countTimeSeries := createTimeSeries(record, apimetric.NewInt64Number(count), apimetric.Int64NumberKind, label.String("__name__", name)) + countTimeSeries := createTimeSeries(record, number.NewInt64Number(count), number.Int64Kind, label.String("__name__", name)) timeSeries = append(timeSeries, countTimeSeries) // For each configured quantile, get the value and create a timeseries @@ -359,7 +360,7 @@ func convertFromHistogram(record metric.Record, histogram aggregation.Histogram) boundaryStr := strconv.FormatFloat(boundary, 'f', -1, 64) // Create timeSeries and append - boundaryTimeSeries := createTimeSeries(record, apimetric.NewFloat64Number(totalCount), apimetric.Float64NumberKind, label.String("__name__", metricName), label.String("le", boundaryStr)) + boundaryTimeSeries := createTimeSeries(record, number.NewFloat64Number(totalCount), number.Float64Kind, label.String("__name__", metricName), label.String("le", boundaryStr)) timeSeries = append(timeSeries, boundaryTimeSeries) } @@ -369,9 +370,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, apimetric.NewFloat64Number(totalCount), apimetric.Float64NumberKind, label.String("__name__", metricName), label.String("le", "+inf")) + upperBoundTimeSeries := createTimeSeries(record, number.NewFloat64Number(totalCount), number.Float64Kind, label.String("__name__", metricName), label.String("le", "+inf")) - countTimeSeries := createTimeSeries(record, apimetric.NewFloat64Number(totalCount), apimetric.Float64NumberKind, label.String("__name__", metricName+"_count")) + countTimeSeries := createTimeSeries(record, number.NewFloat64Number(totalCount), number.Float64Kind, label.String("__name__", metricName+"_count")) timeSeries = append(timeSeries, upperBoundTimeSeries) timeSeries = append(timeSeries, countTimeSeries) diff --git a/exporters/metric/cortex/cortex_test.go b/exporters/metric/cortex/cortex_test.go index a72537ba41c..374989e153b 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/api/global" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/sdk/export/metric" export "go.opentelemetry.io/otel/sdk/export/metric" @@ -66,13 +66,13 @@ var validConfig = Config{ Quantiles: []float64{0, 0.25, 0.5, 0.75, 1}, } -var testResource = resource.New(label.String("R", "V")) +var testResource = resource.NewWithAttributes(label.String("R", "V")) var mockTime int64 = int64(time.Nanosecond) * time.Time{}.UnixNano() / int64(time.Millisecond) func TestExportKindFor(t *testing.T) { exporter := Exporter{} got := exporter.ExportKindFor(nil, aggregation.Kind(rune(0))) - want := metric.CumulativeExporter + want := metric.CumulativeExportKind if got != want { t.Errorf("ExportKindFor() = %q, want %q", got, want) @@ -195,7 +195,7 @@ func TestInstallNewPipeline(t *testing.T) { if err != nil { t.Fatalf("Failed to create install pipeline with error %v", err) } - if global.MeterProvider() != pusher.MeterProvider() { + if otel.GetMeterProvider() != pusher.MeterProvider() { t.Fatalf("Failed to register push Controller provider globally") } } diff --git a/exporters/metric/cortex/example/go.mod b/exporters/metric/cortex/example/go.mod index 3d50c0db584..1458dd2221f 100644 --- a/exporters/metric/cortex/example/go.mod +++ b/exporters/metric/cortex/example/go.mod @@ -8,9 +8,9 @@ replace ( ) require ( - go.opentelemetry.io/contrib/exporters/metric/cortex v0.13.0 - go.opentelemetry.io/contrib/exporters/metric/cortex/utils v0.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/exporters/metric/cortex v0.14.0 + go.opentelemetry.io/contrib/exporters/metric/cortex/utils v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.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 d3ad7999abb..6e0949472cb 100644 --- a/exporters/metric/cortex/example/go.sum +++ b/exporters/metric/cortex/example/go.sum @@ -76,8 +76,6 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= @@ -211,10 +209,10 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q 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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 7dcc6d629b5..231fd136bc6 100644 --- a/exporters/metric/cortex/example/main.go +++ b/exporters/metric/cortex/example/main.go @@ -21,8 +21,8 @@ import ( "time" "go.opentelemetry.io/contrib/exporters/metric/cortex" - "go.opentelemetry.io/otel/api/metric" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/metric/controller/push" "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, push.WithPeriod(5*time.Second), push.WithResource(resource.New(label.String("R", "V")))) + pusher, err := cortex.InstallNewPipeline(*config, push.WithPeriod(5*time.Second), push.WithResource(resource.NewWithAttributes(label.String("R", "V")))) if err != nil { fmt.Printf("Error: %v", err) } diff --git a/exporters/metric/cortex/go.mod b/exporters/metric/cortex/go.mod index 70d6c9b2434..2e81d2e5dfd 100644 --- a/exporters/metric/cortex/go.mod +++ b/exporters/metric/cortex/go.mod @@ -9,6 +9,6 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.14.6 // indirect github.com/prometheus/prometheus v2.5.0+incompatible github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/exporters/metric/cortex/go.sum b/exporters/metric/cortex/go.sum index 6e42a93ca23..265f2209c95 100644 --- a/exporters/metric/cortex/go.sum +++ b/exporters/metric/cortex/go.sum @@ -27,8 +27,6 @@ github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaW github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw= github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= @@ -47,10 +45,10 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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/exporters/metric/cortex/testutil_test.go b/exporters/metric/cortex/testutil_test.go index 93bb1207bc6..b63a0d9aeb2 100644 --- a/exporters/metric/cortex/testutil_test.go +++ b/exporters/metric/cortex/testutil_test.go @@ -20,7 +20,8 @@ import ( "github.com/prometheus/prometheus/prompb" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/api/metric" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/number" export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/export/metric/metrictest" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" @@ -35,12 +36,12 @@ import ( func getSumCheckpoint(t *testing.T, values ...int64) export.CheckpointSet { // Create checkpoint set with resource and descriptor checkpointSet := metrictest.NewCheckpointSet(testResource) - desc := metric.NewDescriptor("metric_name", metric.CounterKind, metric.Int64NumberKind) + desc := metric.NewDescriptor("metric_name", metric.CounterInstrumentKind, number.Int64Kind) // Create aggregation, add value, and update checkpointset agg, ckpt := metrictest.Unslice2(sum.New(2)) for _, value := range values { - aggregatortest.CheckedUpdate(t, agg, metric.NewInt64Number(value), &desc) + aggregatortest.CheckedUpdate(t, agg, number.NewInt64Number(value), &desc) } require.NoError(t, agg.SynchronizedMove(ckpt, &desc)) checkpointSet.Add(&desc, ckpt) @@ -52,12 +53,12 @@ func getSumCheckpoint(t *testing.T, values ...int64) export.CheckpointSet { func getLastValueCheckpoint(t *testing.T, values ...int64) export.CheckpointSet { // Create checkpoint set with resource and descriptor checkpointSet := metrictest.NewCheckpointSet(testResource) - desc := metric.NewDescriptor("metric_name", metric.ValueObserverKind, metric.Int64NumberKind) + desc := metric.NewDescriptor("metric_name", metric.ValueObserverInstrumentKind, number.Int64Kind) // Create aggregation, add value, and update checkpointset agg, ckpt := metrictest.Unslice2(lastvalue.New(2)) for _, value := range values { - aggregatortest.CheckedUpdate(t, agg, metric.NewInt64Number(value), &desc) + aggregatortest.CheckedUpdate(t, agg, number.NewInt64Number(value), &desc) } require.NoError(t, agg.SynchronizedMove(ckpt, &desc)) checkpointSet.Add(&desc, ckpt) @@ -69,12 +70,12 @@ func getLastValueCheckpoint(t *testing.T, values ...int64) export.CheckpointSet func getMMSCCheckpoint(t *testing.T, values ...float64) export.CheckpointSet { // Create checkpoint set with resource and descriptor checkpointSet := metrictest.NewCheckpointSet(testResource) - desc := metric.NewDescriptor("metric_name", metric.ValueRecorderKind, metric.Float64NumberKind) + desc := metric.NewDescriptor("metric_name", metric.ValueRecorderInstrumentKind, number.Float64Kind) // Create aggregation, add value, and update checkpointset agg, ckpt := metrictest.Unslice2(minmaxsumcount.New(2, &desc)) for _, value := range values { - aggregatortest.CheckedUpdate(t, agg, metric.NewFloat64Number(value), &desc) + aggregatortest.CheckedUpdate(t, agg, number.NewFloat64Number(value), &desc) } require.NoError(t, agg.SynchronizedMove(ckpt, &desc)) checkpointSet.Add(&desc, ckpt) @@ -86,12 +87,12 @@ func getMMSCCheckpoint(t *testing.T, values ...float64) export.CheckpointSet { func getDistributionCheckpoint(t *testing.T) export.CheckpointSet { // Create checkpoint set with resource and descriptor checkpointSet := metrictest.NewCheckpointSet(testResource) - desc := metric.NewDescriptor("metric_name", metric.ValueRecorderKind, metric.Float64NumberKind) + desc := metric.NewDescriptor("metric_name", metric.ValueRecorderInstrumentKind, number.Float64Kind) // Create aggregation, add value, and update checkpointset agg, ckpt := metrictest.Unslice2(array.New(2)) for i := 0; i < 1000; i++ { - aggregatortest.CheckedUpdate(t, agg, metric.NewFloat64Number(float64(i)+0.5), &desc) + aggregatortest.CheckedUpdate(t, agg, number.NewFloat64Number(float64(i)+0.5), &desc) } require.NoError(t, agg.SynchronizedMove(ckpt, &desc)) checkpointSet.Add(&desc, ckpt) @@ -103,13 +104,13 @@ func getDistributionCheckpoint(t *testing.T) export.CheckpointSet { func getHistogramCheckpoint(t *testing.T) export.CheckpointSet { // Create checkpoint set with resource and descriptor checkpointSet := metrictest.NewCheckpointSet(testResource) - desc := metric.NewDescriptor("metric_name", metric.ValueRecorderKind, metric.Float64NumberKind) + desc := metric.NewDescriptor("metric_name", metric.ValueRecorderInstrumentKind, number.Float64Kind) // Create aggregation, add value, and update checkpointset boundaries := []float64{100, 500, 900} agg, ckpt := metrictest.Unslice2(histogram.New(2, &desc, boundaries)) for i := 0; i < 1000; i++ { - aggregatortest.CheckedUpdate(t, agg, metric.NewFloat64Number(float64(i)+0.5), &desc) + aggregatortest.CheckedUpdate(t, agg, number.NewFloat64Number(float64(i)+0.5), &desc) } require.NoError(t, agg.SynchronizedMove(ckpt, &desc)) checkpointSet.Add(&desc, ckpt) diff --git a/exporters/metric/cortex/utils/go.mod b/exporters/metric/cortex/utils/go.mod index 91fb28a9476..5e0c86dd12f 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.4.1 github.com/spf13/viper v1.7.1 github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib/exporters/metric/cortex v0.13.0 + go.opentelemetry.io/contrib/exporters/metric/cortex v0.14.0 ) diff --git a/exporters/metric/cortex/utils/go.sum b/exporters/metric/cortex/utils/go.sum index 9ac857d1ae2..ea21ee51e83 100644 --- a/exporters/metric/cortex/utils/go.sum +++ b/exporters/metric/cortex/utils/go.sum @@ -76,8 +76,6 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= @@ -211,10 +209,10 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q 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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 efb67043feb..83273472226 100644 --- a/exporters/metric/datadog/datadog.go +++ b/exporters/metric/datadog/datadog.go @@ -21,8 +21,9 @@ import ( "github.com/DataDog/datadog-go/statsd" - "go.opentelemetry.io/otel/api/metric" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/number" export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/export/metric/aggregation" ) @@ -89,7 +90,7 @@ func defaultFormatter(namespace, name string) string { // ExportKindFor returns export.DeltaExporter for statsd-derived exporters func (e *Exporter) ExportKindFor(*metric.Descriptor, aggregation.Kind) export.ExportKind { - return export.DeltaExporter + return export.DeltaExportKind } func (e *Exporter) Export(ctx context.Context, cs export.CheckpointSet) error { @@ -122,7 +123,7 @@ func (e *Exporter) Export(ctx context.Context, cs export.CheckpointSet) error { case aggregation.MinMaxSumCount: type record struct { name string - f func() (metric.Number, error) + f func() (number.Number, error) } recs := []record{ { @@ -136,10 +137,10 @@ func (e *Exporter) Export(ctx context.Context, cs export.CheckpointSet) error { } if dist, ok := agg.(aggregation.Distribution); ok { recs = append(recs, - record{name: name + ".median", f: func() (metric.Number, error) { + record{name: name + ".median", f: func() (number.Number, error) { return dist.Quantile(0.5) }}, - record{name: name + ".p95", f: func() (metric.Number, error) { + record{name: name + ".p95", f: func() (number.Number, error) { return dist.Quantile(0.95) }}, ) @@ -194,12 +195,12 @@ func sanitizeString(str string) string { return reg.ReplaceAllString(str, "_") } -func metricValue(kind metric.NumberKind, number metric.Number) float64 { +func metricValue(kind number.Kind, num number.Number) float64 { switch kind { - case metric.Float64NumberKind: - return number.AsFloat64() - case metric.Int64NumberKind: - return float64(number.AsInt64()) + case number.Float64Kind: + return num.AsFloat64() + case number.Int64Kind: + return float64(num.AsInt64()) } - return float64(number) + return float64(num) } diff --git a/exporters/metric/datadog/example_test.go b/exporters/metric/datadog/example_test.go index 6fc6a22ab9d..6e5037a0409 100644 --- a/exporters/metric/datadog/example_test.go +++ b/exporters/metric/datadog/example_test.go @@ -26,9 +26,9 @@ import ( "github.com/DataDog/sketches-go/ddsketch" "go.opentelemetry.io/contrib/exporters/metric/datadog" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/metric" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/metric/controller/push" "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/selector/simple" @@ -61,8 +61,8 @@ func ExampleExporter() { pusher := push.New(processor, exp, push.WithPeriod(time.Second*10)) defer pusher.Stop() pusher.Start() - global.SetMeterProvider(pusher.MeterProvider()) - meter := global.Meter("marwandist") + otel.SetMeterProvider(pusher.MeterProvider()) + meter := otel.Meter("marwandist") m := metric.Must(meter).NewInt64ValueRecorder("myrecorder") meter.RecordBatch(context.Background(), []label.KeyValue{label.Int("l", 1)}, m.Measurement(1), m.Measurement(50), m.Measurement(100)) diff --git a/exporters/metric/datadog/go.mod b/exporters/metric/datadog/go.mod index ea19ea81724..0104f9f3a06 100644 --- a/exporters/metric/datadog/go.mod +++ b/exporters/metric/datadog/go.mod @@ -5,6 +5,6 @@ go 1.14 require ( github.com/DataDog/datadog-go v3.7.2+incompatible github.com/DataDog/sketches-go v0.0.1 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/exporters/metric/datadog/go.sum b/exporters/metric/datadog/go.sum index 13b0cfb00c3..e9031fe1cb7 100644 --- a/exporters/metric/datadog/go.sum +++ b/exporters/metric/datadog/go.sum @@ -6,8 +6,8 @@ github.com/benbjohnson/clock v1.0.3 h1:vkLuvpK4fmtSCuo60+yC63p7y0BmQ8gm5ZXGuBCJy github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -16,10 +16,10 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 bbb6e154285..fb688559863 100644 --- a/exporters/metric/dogstatsd/dogstatsd.go +++ b/exporters/metric/dogstatsd/dogstatsd.go @@ -19,7 +19,7 @@ import ( "time" "go.opentelemetry.io/contrib/exporters/metric/dogstatsd/internal/statsd" - "go.opentelemetry.io/otel/api/global" + "go.opentelemetry.io/otel" export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/metric/controller/push" "go.opentelemetry.io/otel/sdk/metric/processor/basic" @@ -74,7 +74,7 @@ func InstallNewPipeline(config Config) (*push.Controller, error) { if err != nil { return controller, err } - global.SetMeterProvider(controller.MeterProvider()) + otel.SetMeterProvider(controller.MeterProvider()) return controller, err } diff --git a/exporters/metric/dogstatsd/dogstatsd_test.go b/exporters/metric/dogstatsd/dogstatsd_test.go index b16912a930f..a99dfc458ee 100644 --- a/exporters/metric/dogstatsd/dogstatsd_test.go +++ b/exporters/metric/dogstatsd/dogstatsd_test.go @@ -22,8 +22,9 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/exporters/metric/dogstatsd" - "go.opentelemetry.io/otel/api/metric" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/sdk/export/metric/metrictest" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" "go.opentelemetry.io/otel/sdk/resource" @@ -74,13 +75,13 @@ func TestDogstatsLabels(t *testing.T) { } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - res := resource.New(tc.resources...) + res := resource.NewWithAttributes(tc.resources...) ctx := context.Background() checkpointSet := metrictest.NewCheckpointSet(res) - desc := metric.NewDescriptor("test.name", metric.CounterKind, metric.Int64NumberKind) + desc := metric.NewDescriptor("test.name", metric.CounterInstrumentKind, number.Int64Kind) cagg, cckpt := metrictest.Unslice2(sum.New(2)) - require.NoError(t, cagg.Update(ctx, metric.NewInt64Number(123), &desc)) + require.NoError(t, cagg.Update(ctx, number.NewInt64Number(123), &desc)) require.NoError(t, cagg.SynchronizedMove(cckpt, &desc)) checkpointSet.Add(&desc, cckpt, tc.labels...) diff --git a/exporters/metric/dogstatsd/example_test.go b/exporters/metric/dogstatsd/example_test.go index 113fd7e551f..327eb1a4614 100644 --- a/exporters/metric/dogstatsd/example_test.go +++ b/exporters/metric/dogstatsd/example_test.go @@ -25,8 +25,8 @@ import ( "time" "go.opentelemetry.io/contrib/exporters/metric/dogstatsd" - "go.opentelemetry.io/otel/api/metric" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/metric/controller/push" "go.opentelemetry.io/otel/sdk/resource" ) @@ -67,7 +67,7 @@ func ExampleNew() { // In real code, use the URL field: // // URL: fmt.Sprint("unix://", path), - }, push.WithPeriod(time.Minute), push.WithResource(resource.New(label.String("host", "name")))) + }, push.WithPeriod(time.Minute), push.WithResource(resource.NewWithAttributes(label.String("host", "name")))) if err != nil { log.Fatal("Could not initialize dogstatsd exporter:", err) } diff --git a/exporters/metric/dogstatsd/go.mod b/exporters/metric/dogstatsd/go.mod index 4249c74f8a4..eb4dfbe429d 100644 --- a/exporters/metric/dogstatsd/go.mod +++ b/exporters/metric/dogstatsd/go.mod @@ -4,6 +4,6 @@ go 1.14 require ( github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/exporters/metric/dogstatsd/go.sum b/exporters/metric/dogstatsd/go.sum index c9bf6170204..0f0658b0db3 100644 --- a/exporters/metric/dogstatsd/go.sum +++ b/exporters/metric/dogstatsd/go.sum @@ -4,8 +4,8 @@ github.com/benbjohnson/clock v1.0.3 h1:vkLuvpK4fmtSCuo60+yC63p7y0BmQ8gm5ZXGuBCJy github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -14,10 +14,10 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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.go b/exporters/metric/dogstatsd/internal/statsd/conn.go index f0c0ff9f970..85d04d8d8d6 100644 --- a/exporters/metric/dogstatsd/internal/statsd/conn.go +++ b/exporters/metric/dogstatsd/internal/statsd/conn.go @@ -27,7 +27,8 @@ import ( "net/url" "strconv" - "go.opentelemetry.io/otel/api/metric" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/number" export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/resource" @@ -164,7 +165,7 @@ func dial(endpoint string) (net.Conn, error) { // ExportKindFor returns export.DeltaExporter for statsd-derived exporters func (e *Exporter) ExportKindFor(*metric.Descriptor, aggregation.Kind) export.ExportKind { - return export.DeltaExporter + return export.DeltaExportKind } // Export is common code for any statsd-based metric.Exporter implementation. @@ -293,7 +294,7 @@ func (e *Exporter) formatMetric(rec export.Record, pos int, buf *bytes.Buffer) e // formatSingleStat encodes a single item of statsd data followed by a // newline. -func (e *Exporter) formatSingleStat(rec export.Record, res *resource.Resource, val metric.Number, fmtStr string, buf *bytes.Buffer) { +func (e *Exporter) formatSingleStat(rec export.Record, res *resource.Resource, val number.Number, fmtStr string, buf *bytes.Buffer) { if e.config.Prefix != "" { _, _ = buf.WriteString(e.config.Prefix) } @@ -306,13 +307,13 @@ func (e *Exporter) formatSingleStat(rec export.Record, res *resource.Resource, v _, _ = buf.WriteRune('\n') } -func writeNumber(buf *bytes.Buffer, num metric.Number, kind metric.NumberKind) { +func writeNumber(buf *bytes.Buffer, num number.Number, kind number.Kind) { var tmp [128]byte var conv []byte switch kind { - case metric.Int64NumberKind: + case number.Int64Kind: conv = strconv.AppendInt(tmp[:0], num.AsInt64(), 10) - case metric.Float64NumberKind: + case number.Float64Kind: conv = strconv.AppendFloat(tmp[:0], num.AsFloat64(), 'g', -1, 64) } _, _ = buf.Write(conv) diff --git a/exporters/metric/dogstatsd/internal/statsd/conn_test.go b/exporters/metric/dogstatsd/internal/statsd/conn_test.go index 333a2773946..be9b7b77a7b 100644 --- a/exporters/metric/dogstatsd/internal/statsd/conn_test.go +++ b/exporters/metric/dogstatsd/internal/statsd/conn_test.go @@ -25,8 +25,9 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/exporters/metric/dogstatsd/internal/statsd" - "go.opentelemetry.io/otel/api/metric" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/number" export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/export/metric/metrictest" aggtest "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" @@ -37,7 +38,7 @@ import ( "go.opentelemetry.io/otel/unit" ) -var testResource = resource.New(label.String("host", "value")) +var testResource = resource.NewWithAttributes(label.String("host", "value")) // withTagsAdapter tests a dogstatsd-style statsd exporter. type withTagsAdapter struct { @@ -115,9 +116,9 @@ timer.B.D:%s|ms adapter := ao.adapter expected := ao.expected t.Run(fmt.Sprintf("%T", adapter), func(t *testing.T) { - for _, nkind := range []metric.NumberKind{ - metric.Float64NumberKind, - metric.Int64NumberKind, + for _, nkind := range []number.Kind{ + number.Float64Kind, + number.Int64Kind, } { t.Run(nkind.String(), func(t *testing.T) { ctx := context.Background() @@ -133,20 +134,20 @@ timer.B.D:%s|ms checkpointSet := metrictest.NewCheckpointSet(testResource) cdesc := metric.NewDescriptor( - "counter", metric.CounterKind, nkind) + "counter", metric.CounterInstrumentKind, nkind) gdesc := metric.NewDescriptor( - "observer", metric.ValueObserverKind, nkind) + "observer", metric.ValueObserverInstrumentKind, nkind) mdesc := metric.NewDescriptor( - "measure", metric.ValueRecorderKind, nkind) + "measure", metric.ValueRecorderInstrumentKind, nkind) tdesc := metric.NewDescriptor( - "timer", metric.ValueRecorderKind, nkind, metric.WithUnit(unit.Milliseconds)) + "timer", metric.ValueRecorderInstrumentKind, nkind, metric.WithUnit(unit.Milliseconds)) labels := []label.KeyValue{ label.String("A", "B"), label.String("C", "D"), } const value = 123.456 - val := number(t, nkind, value) + val := newNumber(t, nkind, value) cagg, cckpt := metrictest.Unslice2(sum.New(2)) gagg, gckpt := metrictest.Unslice2(lastvalue.New(2)) @@ -172,7 +173,7 @@ timer.B.D:%s|ms require.Nil(t, err) var vfmt string - if nkind == metric.Int64NumberKind { + if nkind == number.Int64Kind { fv := value vfmt = strconv.FormatInt(int64(fv), 10) } else { @@ -187,13 +188,13 @@ timer.B.D:%s|ms } } -func number(t *testing.T, kind metric.NumberKind, value float64) metric.Number { +func newNumber(t *testing.T, kind number.Kind, value float64) number.Number { t.Helper() switch kind { - case metric.Int64NumberKind: - return metric.NewInt64Number(int64(value)) - case metric.Float64NumberKind: - return metric.NewFloat64Number(value) + case number.Int64Kind: + return number.NewInt64Number(int64(value)) + case number.Float64Kind: + return number.NewFloat64Number(value) } panic("invalid number kind") } @@ -321,7 +322,7 @@ func TestPacketSplit(t *testing.T) { } checkpointSet := metrictest.NewCheckpointSet(testResource) - desc := metric.NewDescriptor("counter", metric.CounterKind, metric.Int64NumberKind) + desc := metric.NewDescriptor("counter", metric.CounterInstrumentKind, number.Int64Kind) var expected []string @@ -334,7 +335,7 @@ func TestPacketSplit(t *testing.T) { expect := fmt.Sprint("counter:100|c|#", encoded, "\n") expected = append(expected, expect) agg, ckpt := metrictest.Unslice2(sum.New(2)) - aggtest.CheckedUpdate(t, agg, metric.NewInt64Number(100), &desc) + aggtest.CheckedUpdate(t, agg, number.NewInt64Number(100), &desc) require.NoError(t, agg.SynchronizedMove(ckpt, &desc)) checkpointSet.Add(&desc, ckpt, labels...) }) @@ -361,12 +362,12 @@ func TestArraySplit(t *testing.T) { } checkpointSet := metrictest.NewCheckpointSet(testResource) - desc := metric.NewDescriptor("measure", metric.ValueRecorderKind, metric.Int64NumberKind) + desc := metric.NewDescriptor("measure", metric.ValueRecorderInstrumentKind, number.Int64Kind) agg, ckpt := metrictest.Unslice2(array.New(2)) for i := 0; i < 1024; i++ { - aggtest.CheckedUpdate(t, agg, metric.NewInt64Number(100), &desc) + aggtest.CheckedUpdate(t, agg, number.NewInt64Number(100), &desc) } require.NoError(t, agg.SynchronizedMove(ckpt, &desc)) checkpointSet.Add(&desc, ckpt) @@ -396,10 +397,10 @@ func TestPrefix(t *testing.T) { } checkpointSet := metrictest.NewCheckpointSet(testResource) - desc := metric.NewDescriptor("measure", metric.ValueRecorderKind, metric.Int64NumberKind) + desc := metric.NewDescriptor("measure", metric.ValueRecorderInstrumentKind, number.Int64Kind) agg, ckpt := metrictest.Unslice2(array.New(2)) - aggtest.CheckedUpdate(t, agg, metric.NewInt64Number(100), &desc) + aggtest.CheckedUpdate(t, agg, number.NewInt64Number(100), &desc) require.NoError(t, agg.SynchronizedMove(ckpt, &desc)) checkpointSet.Add(&desc, ckpt) diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_test.go index 8469f264100..24b4def29cc 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_test.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/consumer_test.go @@ -24,12 +24,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/label" - otelpropagators "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" - - "go.opentelemetry.io/otel/api/trace/tracetest" + "go.opentelemetry.io/otel/trace" ) const ( @@ -37,10 +36,10 @@ const ( ) func TestWrapPartitionConsumer(t *testing.T) { - propagators := otelpropagators.TraceContext{} + propagators := propagation.TraceContext{} // Mock provider - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // Mock partition consumer controller consumer := mocks.NewConsumer(t, sarama.NewConfig()) @@ -56,10 +55,10 @@ func TestWrapPartitionConsumer(t *testing.T) { } func TestWrapConsumer(t *testing.T) { - propagators := otelpropagators.TraceContext{} + propagators := propagation.TraceContext{} // Mock provider - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // Mock partition consumer controller mockConsumer := mocks.NewConsumer(t, sarama.NewConfig()) @@ -75,11 +74,11 @@ func TestWrapConsumer(t *testing.T) { consumeAndCheck(t, provider.Tracer(defaultTracerName), sr.Completed, mockPartitionConsumer, partitionConsumer) } -func consumeAndCheck(t *testing.T, mt trace.Tracer, complFn func() []*tracetest.Span, mockPartitionConsumer *mocks.PartitionConsumer, partitionConsumer sarama.PartitionConsumer) { +func consumeAndCheck(t *testing.T, mt trace.Tracer, complFn func() []*oteltest.Span, mockPartitionConsumer *mocks.PartitionConsumer, partitionConsumer sarama.PartitionConsumer) { // Create message with span context ctx, _ := mt.Start(context.Background(), "") message := sarama.ConsumerMessage{Key: []byte("foo")} - propagators := otelpropagators.TraceContext{} + propagators := propagation.TraceContext{} propagators.Inject(ctx, NewConsumerMessageCarrier(&message)) // Produce message @@ -166,7 +165,7 @@ func TestConsumerConsumePartitionWithError(t *testing.T) { func BenchmarkWrapPartitionConsumer(b *testing.B) { // Mock provider - provider := tracetest.NewTracerProvider() + provider := oteltest.NewTracerProvider() mockPartitionConsumer, partitionConsumer := createMockPartitionConsumer(b) diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/dispatcher.go b/instrumentation/github.com/Shopify/sarama/otelsarama/dispatcher.go index 15733a903ef..c76f9da874f 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/dispatcher.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/dispatcher.go @@ -20,9 +20,9 @@ import ( "github.com/Shopify/sarama" - "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/semconv" + "go.opentelemetry.io/otel/trace" ) type consumerMessagesDispatcher interface { diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer/consumer.go b/instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer/consumer.go index a78aafcacc2..aa2b6adc4ba 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer/consumer.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer/consumer.go @@ -24,9 +24,9 @@ import ( "github.com/Shopify/sarama" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/semconv" + "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama/example" @@ -76,9 +76,9 @@ func startConsumerGroup(brokerList []string) { func printMessage(msg *sarama.ConsumerMessage) { // Extract tracing info from message - ctx := global.TextMapPropagator().Extract(context.Background(), otelsarama.NewConsumerMessageCarrier(msg)) + ctx := otel.GetTextMapPropagator().Extract(context.Background(), otelsarama.NewConsumerMessageCarrier(msg)) - tr := global.Tracer("consumer") + tr := otel.Tracer("consumer") _, span := tr.Start(ctx, "consume message", trace.WithAttributes( semconv.MessagingOperationProcess, )) diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.mod b/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.mod index 9be72daba64..8477de8e6e1 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.mod +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.mod @@ -9,8 +9,8 @@ replace ( require ( github.com/Shopify/sarama v1.27.2 - go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama v0.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.sum b/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.sum index edbdd5d5224..e2787130799 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.sum +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/example/go.sum @@ -28,6 +28,8 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= @@ -59,12 +61,12 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd github.com/stretchr/testify v1.6.1/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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/init.go b/instrumentation/github.com/Shopify/sarama/otelsarama/example/init.go index 07a1cb95a78..de4e80ed339 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/init.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/example/init.go @@ -18,9 +18,8 @@ import ( "log" "go.opentelemetry.io/otel" - otelglobal "go.opentelemetry.io/otel/api/global" "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" ) @@ -43,6 +42,6 @@ func InitTracer() { if err != nil { log.Fatal(err) } - otelglobal.SetTracerProvider(tp) - otelglobal.SetTextMapPropagator(otel.NewCompositeTextMapPropagator(propagators.TraceContext{})) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{})) } diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/example/producer/producer.go b/instrumentation/github.com/Shopify/sarama/otelsarama/example/producer/producer.go index b5de265c999..24f4781d5e1 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/example/producer/producer.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/example/producer/producer.go @@ -26,10 +26,9 @@ import ( "github.com/Shopify/sarama" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama" "go.opentelemetry.io/contrib/instrumentation/github.com/Shopify/sarama/otelsarama/example" ) @@ -55,7 +54,7 @@ func main() { rand.Seed(time.Now().Unix()) // Create root span - tr := global.Tracer("producer") + tr := otel.Tracer("producer") ctx, span := tr.Start(context.Background(), "produce message") defer span.End() @@ -65,7 +64,7 @@ func main() { Key: sarama.StringEncoder("random_number"), Value: sarama.StringEncoder(fmt.Sprintf("%d", rand.Intn(1000))), } - global.TextMapPropagator().Inject(ctx, otelsarama.NewProducerMessageCarrier(&msg)) + otel.GetTextMapPropagator().Inject(ctx, otelsarama.NewProducerMessageCarrier(&msg)) producer.Input() <- &msg successMsg := <-producer.Successes() diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/go.mod b/instrumentation/github.com/Shopify/sarama/otelsarama/go.mod index dd93a8875fa..676392595c1 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/go.mod +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/go.mod @@ -7,6 +7,6 @@ replace go.opentelemetry.io/contrib => ../../../../.. require ( github.com/Shopify/sarama v1.27.0 github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/otel v0.14.0 ) diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/go.sum b/instrumentation/github.com/Shopify/sarama/otelsarama/go.sum index 6999085fb52..982383f57b1 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/go.sum +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/go.sum @@ -21,8 +21,8 @@ github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/jcmturner/gofork v1.0.0 h1:J7uCkflzTEhUZ64xqKnkDxq3kzc96ajM1Gli5ktUem8= @@ -50,8 +50,8 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd github.com/stretchr/testify v1.6.1/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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/message.go b/instrumentation/github.com/Shopify/sarama/otelsarama/message.go index 343ab0493e6..797b757d557 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/message.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/message.go @@ -17,11 +17,11 @@ package otelsarama import ( "github.com/Shopify/sarama" - "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/propagation" ) -var _ otel.TextMapCarrier = (*ProducerMessageCarrier)(nil) -var _ otel.TextMapCarrier = (*ConsumerMessageCarrier)(nil) +var _ propagation.TextMapCarrier = (*ProducerMessageCarrier)(nil) +var _ propagation.TextMapCarrier = (*ConsumerMessageCarrier)(nil) // ProducerMessageCarrier injects and extracts traces from a sarama.ProducerMessage. type ProducerMessageCarrier struct { diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/option.go b/instrumentation/github.com/Shopify/sarama/otelsarama/option.go index cd1d1d5b0ca..4fd25310150 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/option.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/option.go @@ -17,9 +17,9 @@ package otelsarama import ( "go.opentelemetry.io/contrib" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" ) const ( @@ -30,7 +30,7 @@ const ( type config struct { TracerProvider trace.TracerProvider - Propagators otel.TextMapPropagator + Propagators propagation.TextMapPropagator Tracer trace.Tracer } @@ -38,8 +38,8 @@ type config struct { // newConfig returns a config with all Options set. func newConfig(opts ...Option) config { cfg := config{ - Propagators: global.TextMapPropagator(), - TracerProvider: global.TracerProvider(), + Propagators: otel.GetTextMapPropagator(), + TracerProvider: otel.GetTracerProvider(), } for _, opt := range opts { opt(&cfg) @@ -67,7 +67,7 @@ func WithTracerProvider(provider trace.TracerProvider) Option { // WithPropagators specifies propagators to use for extracting // information from the HTTP requests. If none are specified, global // ones will be used. -func WithPropagators(propagators otel.TextMapPropagator) Option { +func WithPropagators(propagators propagation.TextMapPropagator) Option { return func(cfg *config) { cfg.Propagators = propagators } diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/option_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/option_test.go index b758572526f..88f85687cb3 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/option_test.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/option_test.go @@ -20,8 +20,8 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/contrib" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/trace" ) func TestNewConfig(t *testing.T) { @@ -33,12 +33,12 @@ func TestNewConfig(t *testing.T) { { name: "with provider", opts: []Option{ - WithTracerProvider(global.TracerProvider()), + WithTracerProvider(otel.GetTracerProvider()), }, expected: config{ - TracerProvider: global.TracerProvider(), - Tracer: global.TracerProvider().Tracer(defaultTracerName, trace.WithInstrumentationVersion(contrib.SemVersion())), - Propagators: global.TextMapPropagator(), + TracerProvider: otel.GetTracerProvider(), + Tracer: otel.GetTracerProvider().Tracer(defaultTracerName, trace.WithInstrumentationVersion(contrib.SemVersion())), + Propagators: otel.GetTextMapPropagator(), }, }, { @@ -47,8 +47,8 @@ func TestNewConfig(t *testing.T) { WithPropagators(nil), }, expected: config{ - TracerProvider: global.TracerProvider(), - Tracer: global.TracerProvider().Tracer(defaultTracerName, trace.WithInstrumentationVersion(contrib.SemVersion())), + TracerProvider: otel.GetTracerProvider(), + Tracer: otel.GetTracerProvider().Tracer(defaultTracerName, trace.WithInstrumentationVersion(contrib.SemVersion())), Propagators: nil, }, }, diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/producer.go b/instrumentation/github.com/Shopify/sarama/otelsarama/producer.go index 4b1361985e4..82e887fcd4c 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/producer.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/producer.go @@ -22,9 +22,9 @@ import ( "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/semconv" + "go.opentelemetry.io/otel/trace" ) type syncProducer struct { diff --git a/instrumentation/github.com/Shopify/sarama/otelsarama/producer_test.go b/instrumentation/github.com/Shopify/sarama/otelsarama/producer_test.go index 201589a1aa3..dda7c006e77 100644 --- a/instrumentation/github.com/Shopify/sarama/otelsarama/producer_test.go +++ b/instrumentation/github.com/Shopify/sarama/otelsarama/producer_test.go @@ -24,21 +24,21 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - oteltrace "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/label" - otelpropagators "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" + oteltrace "go.opentelemetry.io/otel/trace" ) func TestWrapSyncProducer(t *testing.T) { - propagators := otelpropagators.TraceContext{} + propagators := propagation.TraceContext{} var err error // Mock provider - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) cfg := newSaramaConfig() // Mock sync producer @@ -141,7 +141,7 @@ func TestWrapSyncProducer(t *testing.T) { } func TestWrapAsyncProducer(t *testing.T) { - propagators := otelpropagators.TraceContext{} + propagators := propagation.TraceContext{} // Create message with span context createMessages := func(mt oteltrace.Tracer) []*sarama.ProducerMessage { ctx, _ := mt.Start(context.Background(), "") @@ -156,9 +156,9 @@ func TestWrapAsyncProducer(t *testing.T) { t.Run("without successes config", func(t *testing.T) { // Mock provider - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider( - tracetest.WithSpanRecorder(sr), + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider( + oteltest.WithSpanRecorder(sr), ) cfg := newSaramaConfig() @@ -226,9 +226,9 @@ func TestWrapAsyncProducer(t *testing.T) { t.Run("with successes config", func(t *testing.T) { // Mock provider - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider( - tracetest.WithSpanRecorder(sr), + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider( + oteltest.WithSpanRecorder(sr), ) // Set producer with successes config @@ -306,10 +306,10 @@ func TestWrapAsyncProducer(t *testing.T) { } func TestWrapAsyncProducerError(t *testing.T) { - propagators := otelpropagators.TraceContext{} + propagators := propagation.TraceContext{} // Mock provider - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // Set producer with successes config cfg := newSaramaConfig() @@ -343,7 +343,7 @@ func newSaramaConfig() *sarama.Config { func BenchmarkWrapSyncProducer(b *testing.B) { // Mock provider - provider := tracetest.NewTracerProvider() + provider := oteltest.NewTracerProvider() cfg := newSaramaConfig() // Mock sync producer @@ -384,7 +384,7 @@ func BenchmarkMockSyncProducer(b *testing.B) { func BenchmarkWrapAsyncProducer(b *testing.B) { // Mock provider - provider := tracetest.NewTracerProvider() + provider := oteltest.NewTracerProvider() cfg := newSaramaConfig() cfg.Producer.Return.Successes = true diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/beego.go b/instrumentation/github.com/astaxie/beego/otelbeego/beego.go index 1d9cdd4e5f1..7c4b4544f70 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/beego.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/beego.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/trace" "github.com/astaxie/beego" ) @@ -98,11 +98,11 @@ func NewOTelBeegoMiddleWare(service string, options ...Option) beego.MiddleWare // if you want to add a child span for the rendering of a template file. // Disable autorender before use, and call this function explicitly. func Render(c *beego.Controller) error { - ctx, span := span(c, renderTemplateSpanName) + _, span := span(c, renderTemplateSpanName) defer span.End() err := c.Render() if err != nil { - span.RecordError(ctx, err) + span.RecordError(err) span.SetStatus(codes.Error, "template failure") } return err @@ -113,11 +113,11 @@ func Render(c *beego.Controller) error { // its string representation. // Disable autorender before use, and call this function explicitly. func RenderString(c *beego.Controller) (string, error) { - ctx, span := span(c, renderStringSpanName) + _, span := span(c, renderStringSpanName) defer span.End() str, err := c.RenderString() if err != nil { - span.RecordError(ctx, err) + span.RecordError(err) span.SetStatus(codes.Error, "render string failure") } return str, err @@ -128,11 +128,11 @@ func RenderString(c *beego.Controller) (string, error) { // byte representation. // Disable autorender before use, and call this function explicitly. func RenderBytes(c *beego.Controller) ([]byte, error) { - ctx, span := span(c, renderBytesSpanName) + _, span := span(c, renderBytesSpanName) defer span.End() bytes, err := c.RenderBytes() if err != nil { - span.RecordError(ctx, err) + span.RecordError(err) span.SetStatus(codes.Error, "render bytes failure") } return bytes, err diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go b/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go index 2c288c923f1..d9b35ea29b3 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go @@ -28,12 +28,11 @@ import ( "go.opentelemetry.io/contrib/propagators/b3" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/metric/metrictest" - "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" "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" "github.com/astaxie/beego" beegoCtx "github.com/astaxie/beego/context" @@ -186,9 +185,9 @@ func TestWithFilters(t *testing.T) { func TestSpanFromContextDefaultProvider(t *testing.T) { defer replaceBeego() - _, provider := metrictest.NewMeterProvider() - global.SetMeterProvider(provider) - global.SetTracerProvider(tracetest.NewTracerProvider()) + _, provider := oteltest.NewMeterProvider() + otel.SetMeterProvider(provider) + otel.SetTracerProvider(oteltest.NewTracerProvider()) router := beego.NewControllerRegister() router.Get("/hello-with-span", func(ctx *beegoCtx.Context) { @@ -209,7 +208,7 @@ func TestSpanFromContextDefaultProvider(t *testing.T) { func TestSpanFromContextCustomProvider(t *testing.T) { defer replaceBeego() - _, provider := metrictest.NewMeterProvider() + _, provider := oteltest.NewMeterProvider() router := beego.NewControllerRegister() router.Get("/hello-with-span", func(ctx *beegoCtx.Context) { assertSpanFromContext(ctx.Request.Context(), t) @@ -222,7 +221,7 @@ func TestSpanFromContextCustomProvider(t *testing.T) { mw := NewOTelBeegoMiddleWare( middleWareName, - WithTracerProvider(tracetest.NewTracerProvider()), + WithTracerProvider(oteltest.NewTracerProvider()), WithMeterProvider(provider), ) @@ -233,9 +232,9 @@ func TestSpanFromContextCustomProvider(t *testing.T) { func TestStatic(t *testing.T) { defer replaceBeego() - sr := new(tracetest.StandardSpanRecorder) - tracerProvider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) - meterimpl, meterProvider := metrictest.NewMeterProvider() + sr := new(oteltest.StandardSpanRecorder) + tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) + meterimpl, meterProvider := oteltest.NewMeterProvider() file, err := ioutil.TempFile("", "static-*.html") require.NoError(t, err) defer os.Remove(file.Name()) @@ -293,8 +292,8 @@ func TestRender(t *testing.T) { beego.SetViewsPath(dir) _, tplName = filepath.Split(file.Name()) - sr := new(tracetest.StandardSpanRecorder) - tracerProvider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) mw := NewOTelBeegoMiddleWare( middleWareName, @@ -333,9 +332,9 @@ func TestRender(t *testing.T) { // ------------------------------------------ Utilities func runTest(t *testing.T, tc *testCase, url string) { - sr := new(tracetest.StandardSpanRecorder) - tracerProvider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) - meterimpl, meterProvider := metrictest.NewMeterProvider() + sr := new(oteltest.StandardSpanRecorder) + tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) + meterimpl, meterProvider := oteltest.NewMeterProvider() addTestRoutes(t) defer replaceBeego() @@ -385,14 +384,14 @@ func defaultAttributes() []label.KeyValue { } } -func assertSpan(t *testing.T, span *tracetest.Span, tc *testCase) { +func assertSpan(t *testing.T, span *oteltest.Span, tc *testCase) { require.Equal(t, tc.expectedSpanName, span.Name()) for _, att := range tc.expectedAttributes { require.Equal(t, att.Value.AsInterface(), span.Attributes()[att.Key].AsInterface()) } } -func assertMetrics(t *testing.T, batches []metrictest.Batch, tc *testCase) { +func assertMetrics(t *testing.T, batches []oteltest.Batch, tc *testCase) { for _, batch := range batches { for _, att := range tc.expectedAttributes { require.Contains(t, batch.Labels, att) @@ -402,10 +401,10 @@ func assertMetrics(t *testing.T, batches []metrictest.Batch, tc *testCase) { func assertSpanFromContext(ctx context.Context, t *testing.T) { span := trace.SpanFromContext(ctx) - _, ok := span.(*tracetest.Span) + _, ok := span.(*oteltest.Span) require.True(t, ok) spanTracer := span.Tracer() - mockTracer, ok := spanTracer.(*tracetest.Tracer) + mockTracer, ok := spanTracer.(*oteltest.Tracer) require.True(t, ok) require.NotEmpty(t, mockTracer.Name) } @@ -489,7 +488,7 @@ var testCases = []*testCase{ method: http.MethodGet, path: "/", options: []Option{ - WithPropagators(otel.NewCompositeTextMapPropagator(b3.B3{})), + WithPropagators(propagation.NewCompositeTextMapPropagator(b3.B3{})), }, hasSpan: true, expectedSpanName: "/", diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/config.go b/instrumentation/github.com/astaxie/beego/otelbeego/config.go index 76b3c41c2f1..35bedca5846 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/config.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/config.go @@ -16,9 +16,9 @@ package otelbeego import ( "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/metric" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" ) // config provides configuration for the beego OpenTelemetry @@ -26,7 +26,7 @@ import ( type config struct { tracerProvider trace.TracerProvider meterProvider metric.MeterProvider - propagators otel.TextMapPropagator + propagators propagation.TextMapPropagator filters []Filter formatter SpanNameFormatter } @@ -65,7 +65,7 @@ func WithMeterProvider(provider metric.MeterProvider) Option { // WithPropagators sets the propagators used in the middleware. // Defaults to global.Propagators(). -func WithPropagators(propagators otel.TextMapPropagator) OptionFunc { +func WithPropagators(propagators propagation.TextMapPropagator) OptionFunc { return OptionFunc(func(c *config) { c.propagators = propagators }) @@ -91,9 +91,9 @@ func WithSpanNameFormatter(f SpanNameFormatter) OptionFunc { func newConfig(options ...Option) *config { config := &config{ - tracerProvider: global.TracerProvider(), - meterProvider: global.MeterProvider(), - propagators: global.TextMapPropagator(), + tracerProvider: otel.GetTracerProvider(), + meterProvider: otel.GetMeterProvider(), + propagators: otel.GetTextMapPropagator(), filters: []Filter{}, formatter: defaultSpanNameFormatter, } diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod index 35ae68b21ce..6b1643f45c1 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod +++ b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod @@ -11,8 +11,8 @@ replace ( require ( github.com/astaxie/beego v1.12.3 - go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego v0.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum index e446b871da6..bdb89742799 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum +++ b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum @@ -73,8 +73,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -149,12 +149,12 @@ 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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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/example/server/server.go b/instrumentation/github.com/astaxie/beego/otelbeego/example/server/server.go index c3b62c530ce..b920fe6e4a4 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/server/server.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/example/server/server.go @@ -22,13 +22,12 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/semconv" + "go.opentelemetry.io/otel/trace" ) type ExampleController struct { @@ -38,7 +37,7 @@ type ExampleController struct { func (c *ExampleController) Get() { ctx := c.Ctx.Request.Context() span := trace.SpanFromContext(ctx) - span.AddEvent(ctx, "handling this...") + span.AddEvent("handling this...") c.Ctx.WriteString("Hello, world!") } @@ -62,12 +61,12 @@ func initTracer() { // In a production application, use sdktrace.ProbabilitySampler with a desired probability. tp := sdktrace.NewTracerProvider(sdktrace.WithConfig(sdktrace.Config{DefaultSampler: sdktrace.AlwaysSample()}), sdktrace.WithSyncer(exporter), - sdktrace.WithResource(resource.New(semconv.ServiceNameKey.String("ExampleService")))) + sdktrace.WithResource(resource.NewWithAttributes(semconv.ServiceNameKey.String("ExampleService")))) if err != nil { log.Fatal(err) } - global.SetTracerProvider(tp) - global.SetTextMapPropagator(otel.NewCompositeTextMapPropagator(propagators.TraceContext{}, propagators.Baggage{})) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) } func main() { diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/go.mod index 5f65aa9cfe7..435e0317d70 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/go.mod +++ b/instrumentation/github.com/astaxie/beego/otelbeego/go.mod @@ -11,9 +11,9 @@ replace ( require ( github.com/astaxie/beego v1.12.2 github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.13.0 - go.opentelemetry.io/contrib/propagators v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.14.0 + go.opentelemetry.io/contrib/propagators v0.14.0 + go.opentelemetry.io/otel v0.14.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 4a4ddab86fc..40a313127e1 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/go.sum +++ b/instrumentation/github.com/astaxie/beego/otelbeego/go.sum @@ -69,8 +69,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= @@ -143,8 +143,8 @@ 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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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/config.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/config.go index 8a691e82391..d83677b4752 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/config.go +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/config.go @@ -15,7 +15,7 @@ package otelmemcache import ( - oteltrace "go.opentelemetry.io/otel/api/trace" + oteltrace "go.opentelemetry.io/otel/trace" ) type config struct { diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/client.go b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/client.go index f024d77b03a..a6cfd5747fe 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/client.go +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/client.go @@ -22,7 +22,7 @@ import ( "github.com/bradfitz/gomemcache/memcache" "go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache" - oteltrace "go.opentelemetry.io/otel/api/trace" + oteltrace "go.opentelemetry.io/otel/trace" oteltracestdout "go.opentelemetry.io/otel/exporters/stdout" sdktrace "go.opentelemetry.io/otel/sdk/trace" 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 2459951af0e..aec4528876c 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.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.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 f94f187a0cb..7ab3d4b6d7a 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.sum +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/example/go.sum @@ -6,8 +6,8 @@ github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b h1:L/QXpzIa3pO github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -15,12 +15,12 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 c2e4a98b8d9..8000f84974d 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.mod +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.mod @@ -7,6 +7,6 @@ replace go.opentelemetry.io/contrib => ../../../../../../ require ( github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/otel v0.14.0 ) diff --git a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.sum b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.sum index f22011d6d21..87eda41f2ce 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.sum +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/go.sum @@ -2,16 +2,16 @@ github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b h1:L/QXpzIa3pO github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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 f1c8c70f3c3..f1bf5ee8b91 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache.go +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache.go @@ -20,10 +20,10 @@ import ( "github.com/bradfitz/gomemcache/memcache" "go.opentelemetry.io/contrib" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/semconv" + oteltrace "go.opentelemetry.io/otel/trace" ) const ( @@ -59,7 +59,7 @@ func NewClientWithTracing(client *memcache.Client, opts ...Option) *Client { } if cfg.tracerProvider == nil { - cfg.tracerProvider = otelglobal.TracerProvider() + cfg.tracerProvider = otel.GetTracerProvider() } return &Client{ 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 6f6ed614f54..2166a13ad91 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache_test.go +++ b/instrumentation/github.com/bradfitz/gomemcache/memcache/otelmemcache/gomemcache_test.go @@ -23,11 +23,11 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/internal/util" - oteltrace "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/semconv" + oteltrace "go.opentelemetry.io/otel/trace" ) func TestMain(m *testing.M) { @@ -98,18 +98,18 @@ func TestOperationWithCacheMissError(t *testing.T) { } // tests require running memcached instance -func initClientWithSpanRecorder(t *testing.T) (*Client, *tracetest.StandardSpanRecorder) { +func initClientWithSpanRecorder(t *testing.T) (*Client, *oteltest.StandardSpanRecorder) { host, port := "localhost", "11211" mc := memcache.New(host + ":" + port) require.NoError(t, clearDB(mc)) - sr := new(tracetest.StandardSpanRecorder) + sr := new(oteltest.StandardSpanRecorder) c := NewClientWithTracing( mc, WithTracerProvider( - tracetest.NewTracerProvider( - tracetest.WithSpanRecorder(sr), + oteltest.NewTracerProvider( + oteltest.WithSpanRecorder(sr), ), ), ) diff --git a/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go b/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go index 0f9b550d792..aca36150dab 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/config.go @@ -15,14 +15,14 @@ package otelrestful import ( - "go.opentelemetry.io/otel" - oteltrace "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/propagation" + oteltrace "go.opentelemetry.io/otel/trace" ) // config is used to configure the go-restful middleware. type config struct { TracerProvider oteltrace.TracerProvider - Propagators otel.TextMapPropagator + Propagators propagation.TextMapPropagator } // Option specifies instrumentation configuration options. @@ -31,7 +31,7 @@ type Option func(*config) // WithPropagators specifies propagators to use for extracting // information from the HTTP requests. If none are specified, global // ones will be used. -func WithPropagators(propagators otel.TextMapPropagator) Option { +func WithPropagators(propagators propagation.TextMapPropagator) Option { return func(cfg *config) { cfg.Propagators = propagators } 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 19ce9c9e8c0..3abcf360b79 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.mod +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.mod @@ -10,8 +10,8 @@ replace ( require ( github.com/emicklei/go-restful/v3 v3.4.0 - go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful v0.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.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 e6f40ec7942..71fb0d610e9 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.sum +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/example/go.sum @@ -8,8 +8,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/emicklei/go-restful/v3 v3.3.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/emicklei/go-restful/v3 v3.4.0 h1:IIDhql3oyWZj1ay2xBZGb4sTOWMad0HVW8rwhVxN/Yk= github.com/emicklei/go-restful/v3 v3.4.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -25,12 +25,12 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 eccce38cd7a..7d438582124 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/example/server.go +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/example/server.go @@ -22,11 +22,11 @@ import ( "github.com/emicklei/go-restful/v3" "go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel" "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" ) var tracer oteltrace.Tracer @@ -75,8 +75,8 @@ func initTracer() { if err != nil { log.Fatal(err) } - otelglobal.SetTracerProvider(tp) - tracer = otelglobal.TracerProvider().Tracer("go-restful-server", oteltrace.WithInstrumentationVersion("0.1")) + otel.SetTracerProvider(tp) + tracer = otel.GetTracerProvider().Tracer("go-restful-server", oteltrace.WithInstrumentationVersion("0.1")) } func (u UserResource) getUser(req *restful.Request, resp *restful.Response) { diff --git a/instrumentation/github.com/emicklei/go-restful/otelrestful/go.mod b/instrumentation/github.com/emicklei/go-restful/otelrestful/go.mod index 453b4719d7a..aa3f2aefff7 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/go.mod +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/go.mod @@ -11,7 +11,7 @@ require ( github.com/emicklei/go-restful/v3 v3.3.1 github.com/json-iterator/go v1.1.10 // indirect github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/contrib/propagators v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/contrib/propagators v0.14.0 + go.opentelemetry.io/otel v0.14.0 ) diff --git a/instrumentation/github.com/emicklei/go-restful/otelrestful/go.sum b/instrumentation/github.com/emicklei/go-restful/otelrestful/go.sum index bd42234ea51..3985269b153 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/go.sum +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/go.sum @@ -3,8 +3,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/go-restful/v3 v3.3.1 h1:engBLuFVe3n4ck963X94ZFfauROk9nthZOKilyHLgpM= github.com/emicklei/go-restful/v3 v3.3.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= @@ -19,8 +19,8 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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 243ba9a46be..e456d828b26 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/restful.go +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/restful.go @@ -18,9 +18,9 @@ import ( "github.com/emicklei/go-restful/v3" "go.opentelemetry.io/contrib" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/semconv" + oteltrace "go.opentelemetry.io/otel/trace" ) const tracerName = "go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful" @@ -36,14 +36,14 @@ func OTelFilter(service string, opts ...Option) restful.FilterFunction { opt(&cfg) } if cfg.TracerProvider == nil { - cfg.TracerProvider = otelglobal.TracerProvider() + cfg.TracerProvider = otel.GetTracerProvider() } tracer := cfg.TracerProvider.Tracer( tracerName, oteltrace.WithInstrumentationVersion(contrib.SemVersion()), ) if cfg.Propagators == nil { - cfg.Propagators = otelglobal.TextMapPropagator() + cfg.Propagators = otel.GetTextMapPropagator() } return func(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) { r := req.Request 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 e3e7cfc18d2..19512b2cb42 100644 --- a/instrumentation/github.com/emicklei/go-restful/otelrestful/restful_test.go +++ b/instrumentation/github.com/emicklei/go-restful/otelrestful/restful_test.go @@ -27,24 +27,23 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful" b3prop "go.opentelemetry.io/contrib/propagators/b3" "go.opentelemetry.io/otel" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" otelkv "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" + oteltrace "go.opentelemetry.io/otel/trace" ) const tracerName = "go.opentelemetry.io/contrib/instrumentation/github.com/emicklei/go-restful/otelrestful" func TestChildSpanFromGlobalTracer(t *testing.T) { - otelglobal.SetTracerProvider(tracetest.NewTracerProvider()) + otel.SetTracerProvider(oteltest.NewTracerProvider()) handlerFunc := func(req *restful.Request, resp *restful.Response) { span := oteltrace.SpanFromContext(req.Request.Context()) - _, ok := span.(*tracetest.Span) + _, ok := span.(*oteltest.Span) assert.True(t, ok) spanTracer := span.Tracer() - mockTracer, ok := spanTracer.(*tracetest.Tracer) + mockTracer, ok := spanTracer.(*oteltest.Tracer) require.True(t, ok) assert.Equal(t, tracerName, mockTracer.Name) resp.WriteHeader(http.StatusOK) @@ -64,14 +63,14 @@ func TestChildSpanFromGlobalTracer(t *testing.T) { } func TestChildSpanFromCustomTracer(t *testing.T) { - provider := tracetest.NewTracerProvider() + provider := oteltest.NewTracerProvider() handlerFunc := func(req *restful.Request, resp *restful.Response) { span := oteltrace.SpanFromContext(req.Request.Context()) - _, ok := span.(*tracetest.Span) + _, ok := span.(*oteltest.Span) assert.True(t, ok) spanTracer := span.Tracer() - mockTracer, ok := spanTracer.(*tracetest.Tracer) + mockTracer, ok := spanTracer.(*oteltest.Tracer) require.True(t, ok) assert.Equal(t, tracerName, mockTracer.Name) resp.WriteHeader(http.StatusOK) @@ -90,8 +89,8 @@ func TestChildSpanFromCustomTracer(t *testing.T) { } func TestChildSpanNames(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) handlerFunc := func(req *restful.Request, resp *restful.Response) { resp.WriteHeader(http.StatusOK) @@ -156,18 +155,18 @@ func TestGetSpanNotInstrumented(t *testing.T) { } func TestPropagationWithGlobalPropagators(t *testing.T) { - provider := tracetest.NewTracerProvider() - otelglobal.SetTextMapPropagator(propagators.TraceContext{}) + provider := oteltest.NewTracerProvider() + otel.SetTextMapPropagator(propagation.TraceContext{}) r := httptest.NewRequest("GET", "/user/123", nil) w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - otelglobal.TextMapPropagator().Inject(ctx, r.Header) + otel.GetTextMapPropagator().Inject(ctx, r.Header) handlerFunc := func(req *restful.Request, resp *restful.Response) { span := oteltrace.SpanFromContext(req.Request.Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, pspan.SpanContext().TraceID, mspan.SpanContext().TraceID) assert.Equal(t, pspan.SpanContext().SpanID, mspan.ParentSpanID()) @@ -181,11 +180,11 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { container.Add(ws) container.ServeHTTP(w, r) - otelglobal.SetTextMapPropagator(otel.NewCompositeTextMapPropagator()) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator()) } func TestPropagationWithCustomPropagators(t *testing.T) { - provider := tracetest.NewTracerProvider() + provider := oteltest.NewTracerProvider() b3 := b3prop.B3{} r := httptest.NewRequest("GET", "/user/123", nil) @@ -196,7 +195,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { handlerFunc := func(req *restful.Request, resp *restful.Response) { span := oteltrace.SpanFromContext(req.Request.Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, pspan.SpanContext().TraceID, mspan.SpanContext().TraceID) assert.Equal(t, pspan.SpanContext().SpanID, mspan.ParentSpanID()) @@ -215,16 +214,16 @@ func TestPropagationWithCustomPropagators(t *testing.T) { } func TestMultiFilters(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) wrappedFunc := func(tracerName string) restful.RouteFunction { return func(req *restful.Request, resp *restful.Response) { span := oteltrace.SpanFromContext(req.Request.Context()) - _, ok := span.(*tracetest.Span) + _, ok := span.(*oteltest.Span) assert.True(t, ok) spanTracer := span.Tracer() - mockTracer, ok := spanTracer.(*tracetest.Tracer) + mockTracer, ok := spanTracer.(*oteltest.Tracer) require.True(t, ok) assert.Equal(t, tracerName, mockTracer.Name) resp.WriteHeader(http.StatusOK) 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 1a17210f65e..3463b1ac616 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.mod +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.mod @@ -10,8 +10,8 @@ replace ( require ( github.com/gin-gonic/gin v1.6.3 - go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.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 c8f1abf4a34..e26d12f6c8d 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.sum +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/example/go.sum @@ -19,8 +19,8 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1 github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -45,12 +45,12 @@ 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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 fcaf658ff69..d51292aac76 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/example/server.go +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/example/server.go @@ -23,15 +23,14 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin" "go.opentelemetry.io/otel" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/exporters/stdout" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" + oteltrace "go.opentelemetry.io/otel/trace" ) -var tracer = otelglobal.Tracer("gin-server") +var tracer = otel.Tracer("gin-server") func main() { initTracer() @@ -67,8 +66,8 @@ func initTracer() { if err != nil { log.Fatal(err) } - otelglobal.SetTracerProvider(tp) - otelglobal.SetTextMapPropagator(otel.NewCompositeTextMapPropagator(propagators.TraceContext{}, propagators.Baggage{})) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) } func getUser(c *gin.Context, id string) string { diff --git a/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go b/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go index 0a862e3127b..1f6f2ba5ce1 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace.go @@ -21,14 +21,14 @@ import ( "github.com/gin-gonic/gin" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" otelcontrib "go.opentelemetry.io/contrib" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/semconv" + oteltrace "go.opentelemetry.io/otel/trace" ) const ( @@ -45,14 +45,14 @@ func Middleware(service string, opts ...Option) gin.HandlerFunc { opt(&cfg) } if cfg.TracerProvider == nil { - cfg.TracerProvider = otelglobal.TracerProvider() + cfg.TracerProvider = otel.GetTracerProvider() } tracer := cfg.TracerProvider.Tracer( tracerName, oteltrace.WithInstrumentationVersion(otelcontrib.SemVersion()), ) if cfg.Propagators == nil { - cfg.Propagators = otelglobal.TextMapPropagator() + cfg.Propagators = otel.GetTextMapPropagator() } return func(c *gin.Context) { c.Set(tracerKey, tracer) @@ -102,7 +102,7 @@ func HTML(c *gin.Context, code int, name string, obj interface{}) { tracer, ok = tracerInterface.(oteltrace.Tracer) } if !ok { - tracer = otelglobal.TracerProvider().Tracer( + tracer = otel.GetTracerProvider().Tracer( tracerName, oteltrace.WithInstrumentationVersion(otelcontrib.SemVersion()), ) @@ -112,11 +112,11 @@ func HTML(c *gin.Context, code int, name string, obj interface{}) { c.Request = c.Request.WithContext(savedContext) }() opt := oteltrace.WithAttributes(label.String("go.template", name)) - ctx, span := tracer.Start(savedContext, "gin.renderer.html", opt) + _, span := tracer.Start(savedContext, "gin.renderer.html", opt) defer func() { if r := recover(); r != nil { err := fmt.Errorf("error rendering template:%s: %s", name, r) - span.RecordError(ctx, err) + span.RecordError(err) span.SetStatus(codes.Error, "template failure") span.End() panic(r) 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 b291e0b402d..3cc88fd715f 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace_test.go +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/gintrace_test.go @@ -30,12 +30,12 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" b3prop "go.opentelemetry.io/contrib/propagators/b3" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" "go.opentelemetry.io/otel/label" + oteltrace "go.opentelemetry.io/otel/trace" ) func init() { @@ -43,16 +43,16 @@ func init() { } func TestChildSpanFromGlobalTracer(t *testing.T) { - otelglobal.SetTracerProvider(tracetest.NewTracerProvider()) + otel.SetTracerProvider(oteltest.NewTracerProvider()) router := gin.New() router.Use(Middleware("foobar")) router.GET("/user/:id", func(c *gin.Context) { span := oteltrace.SpanFromContext(c.Request.Context()) - _, ok := span.(*tracetest.Span) + _, ok := span.(*oteltest.Span) assert.True(t, ok) spanTracer := span.Tracer() - mockTracer, ok := spanTracer.(*tracetest.Tracer) + mockTracer, ok := spanTracer.(*oteltest.Tracer) require.True(t, ok) assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin", mockTracer.Name) }) @@ -64,16 +64,16 @@ func TestChildSpanFromGlobalTracer(t *testing.T) { } func TestChildSpanFromCustomTracer(t *testing.T) { - provider := tracetest.NewTracerProvider() + provider := oteltest.NewTracerProvider() router := gin.New() router.Use(Middleware("foobar", WithTracerProvider(provider))) router.GET("/user/:id", func(c *gin.Context) { span := oteltrace.SpanFromContext(c.Request.Context()) - _, ok := span.(*tracetest.Span) + _, ok := span.(*oteltest.Span) assert.True(t, ok) spanTracer := span.Tracer() - mockTracer, ok := spanTracer.(*tracetest.Tracer) + mockTracer, ok := spanTracer.(*oteltest.Tracer) require.True(t, ok) assert.Equal(t, tracerName, mockTracer.Name) }) @@ -85,14 +85,14 @@ func TestChildSpanFromCustomTracer(t *testing.T) { } func TestTrace200(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) router := gin.New() router.Use(Middleware("foobar", WithTracerProvider(provider))) router.GET("/user/:id", func(c *gin.Context) { span := oteltrace.SpanFromContext(c.Request.Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, label.StringValue("foobar"), mspan.Attributes()["http.server_name"]) id := c.Param("id") @@ -121,8 +121,8 @@ func TestTrace200(t *testing.T) { } func TestError(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // setup router := gin.New() @@ -152,8 +152,8 @@ func TestError(t *testing.T) { } func TestHTML(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // setup router := gin.New() @@ -177,7 +177,7 @@ func TestHTML(t *testing.T) { // verify the errors and status are correct spans := sr.Completed() require.Len(t, spans, 2) - var tspan *tracetest.Span + var tspan *oteltest.Span for _, s := range spans { // we need to pick up the span we're searching for, as the // order is not guaranteed within the buffer @@ -207,33 +207,33 @@ func TestGetSpanNotInstrumented(t *testing.T) { } func TestPropagationWithGlobalPropagators(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) - otelglobal.SetTextMapPropagator(b3prop.B3{}) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) + otel.SetTextMapPropagator(b3prop.B3{}) r := httptest.NewRequest("GET", "/user/123", nil) w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - otelglobal.TextMapPropagator().Inject(ctx, r.Header) + otel.GetTextMapPropagator().Inject(ctx, r.Header) router := gin.New() router.Use(Middleware("foobar", WithTracerProvider(provider))) router.GET("/user/:id", func(c *gin.Context) { span := oteltrace.SpanFromContext(c.Request.Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, pspan.SpanContext().TraceID, mspan.SpanContext().TraceID) assert.Equal(t, pspan.SpanContext().SpanID, mspan.ParentSpanID()) }) router.ServeHTTP(w, r) - otelglobal.SetTextMapPropagator(otel.NewCompositeTextMapPropagator()) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator()) } func TestPropagationWithCustomPropagators(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) b3 := b3prop.B3{} r := httptest.NewRequest("GET", "/user/123", nil) @@ -246,7 +246,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { router.Use(Middleware("foobar", WithTracerProvider(provider), WithPropagators(b3))) router.GET("/user/:id", func(c *gin.Context) { span := oteltrace.SpanFromContext(c.Request.Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, pspan.SpanContext().TraceID, mspan.SpanContext().TraceID) assert.Equal(t, pspan.SpanContext().SpanID, mspan.ParentSpanID()) diff --git a/instrumentation/github.com/gin-gonic/gin/otelgin/go.mod b/instrumentation/github.com/gin-gonic/gin/otelgin/go.mod index efc2d310032..12a3966b2d6 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/go.mod +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/go.mod @@ -10,7 +10,7 @@ replace ( require ( github.com/gin-gonic/gin v1.6.3 github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/contrib/propagators v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/contrib/propagators v0.14.0 + go.opentelemetry.io/otel v0.14.0 ) diff --git a/instrumentation/github.com/gin-gonic/gin/otelgin/go.sum b/instrumentation/github.com/gin-gonic/gin/otelgin/go.sum index eadc2b50407..288c34fc10d 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/go.sum +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/go.sum @@ -15,8 +15,8 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1 github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= @@ -42,8 +42,8 @@ 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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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/gin-gonic/gin/otelgin/option.go b/instrumentation/github.com/gin-gonic/gin/otelgin/option.go index c6d03fb1765..f0a10d56cfe 100644 --- a/instrumentation/github.com/gin-gonic/gin/otelgin/option.go +++ b/instrumentation/github.com/gin-gonic/gin/otelgin/option.go @@ -17,13 +17,13 @@ package otelgin import ( - "go.opentelemetry.io/otel" - oteltrace "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/propagation" + oteltrace "go.opentelemetry.io/otel/trace" ) type config struct { TracerProvider oteltrace.TracerProvider - Propagators otel.TextMapPropagator + Propagators propagation.TextMapPropagator } // Option specifies instrumentation configuration options. @@ -32,7 +32,7 @@ type Option func(*config) // WithPropagators specifies propagators to use for extracting // information from the HTTP requests. If none are specified, global // ones will be used. -func WithPropagators(propagators otel.TextMapPropagator) Option { +func WithPropagators(propagators propagation.TextMapPropagator) Option { return func(cfg *config) { cfg.Propagators = propagators } diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/config.go b/instrumentation/github.com/gocql/gocql/otelgocql/config.go index 89bf855ad44..ef634afe9a4 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/config.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/config.go @@ -17,9 +17,9 @@ package otelgocql import ( "github.com/gocql/gocql" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/metric" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/trace" ) // TracedSessionConfig provides configuration for sessions @@ -90,7 +90,7 @@ func WithTracerProvider(provider trace.TracerProvider) TracedSessionOption { // WithMeterProvider will set the meter provider used to get a meter // for creating instruments. -// Defaults to global.MeterProvider(). +// Defaults to otel.GetMeterProvider(). func WithMeterProvider(provider metric.MeterProvider) TracedSessionOption { return TracedSessionOptionFunc(func(c *TracedSessionConfig) { c.meterProvider = provider @@ -125,8 +125,8 @@ func WithConnectInstrumentation(enabled bool) TracedSessionOption { func newTracedSessionConfig(options ...TracedSessionOption) *TracedSessionConfig { config := &TracedSessionConfig{ - tracerProvider: global.TracerProvider(), - meterProvider: global.MeterProvider(), + tracerProvider: otel.GetTracerProvider(), + meterProvider: otel.GetMeterProvider(), instrumentQuery: true, instrumentBatch: true, instrumentConnect: true, diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/client.go b/instrumentation/github.com/gocql/gocql/otelgocql/example/client.go index 857177af099..6e20a18af1e 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/client.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/example/client.go @@ -39,7 +39,7 @@ import ( "github.com/gocql/gocql" "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql" - "go.opentelemetry.io/otel/api/global" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/metric/prometheus" zipkintrace "go.opentelemetry.io/otel/exporters/trace/zipkin" ) @@ -53,7 +53,7 @@ func main() { initTracer() initDb() - ctx, span := global.Tracer( + ctx, span := otel.Tracer( "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/example", ).Start(context.Background(), "begin example") diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod index 41ec1f4f674..7b33c012dbf 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod +++ b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/gocql/gocql v0.0.0-20200624222514-34081eda590e - go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql v0.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/metric/prometheus v0.13.0 - go.opentelemetry.io/otel/exporters/trace/zipkin v0.13.0 + go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/metric/prometheus v0.14.0 + go.opentelemetry.io/otel/exporters/trace/zipkin v0.14.0 golang.org/x/sys v0.0.0-20200722175500-76b94024e4b6 // indirect ) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum index 8c9ad7887bf..85f88c1b78e 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum +++ b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum @@ -68,8 +68,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= @@ -134,14 +134,14 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/metric/prometheus v0.13.0 h1:Jf7AdsEoHKtNTWxXLj/g9XGjsGpdk0otEf0lx00r2Ps= -go.opentelemetry.io/otel/exporters/metric/prometheus v0.13.0/go.mod h1:Tyh3ACxU9a1tu1mF4at7xvNu+BaiPThrr5XZmsoIW7g= -go.opentelemetry.io/otel/exporters/trace/zipkin v0.13.0 h1:73mFdDfl5lJrtxxHufQ2tNDYQjAXbfVEgv7eg/e/yP8= -go.opentelemetry.io/otel/exporters/trace/zipkin v0.13.0/go.mod h1:R7bkBdeVhrEWP9L1s7SpVDqVDEI2QbNHrCMdI0OlRzo= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/metric/prometheus v0.14.0 h1:F0hQ6ktEf49bJtEctigyaahHHSTVzWamd2cvw2stmtw= +go.opentelemetry.io/otel/exporters/metric/prometheus v0.14.0/go.mod h1:1YFGCWmDN9G7Wz/wTOqEU1+nrfLjc1F1hxIjtdGwjmA= +go.opentelemetry.io/otel/exporters/trace/zipkin v0.14.0 h1:nx2w4hK1IYb5MGSzxvVw5EptULmDuISpGChDgo+rWQI= +go.opentelemetry.io/otel/exporters/trace/zipkin v0.14.0/go.mod h1:H0qPS+vKp1I/vaxtyTvZqpHdPWyBxIwaeyyteTy4dKM= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/go.mod index 1d130bee962..175164c3c45 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/go.mod +++ b/instrumentation/github.com/gocql/gocql/otelgocql/go.mod @@ -8,6 +8,6 @@ require ( github.com/gocql/gocql v0.0.0-20200624222514-34081eda590e github.com/golang/snappy v0.0.1 // indirect github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/otel v0.14.0 ) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/go.sum index 7b3ee98e97c..91003bfe81f 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/go.sum +++ b/instrumentation/github.com/gocql/gocql/otelgocql/go.sum @@ -10,8 +10,8 @@ github.com/golang/snappy v0.0.0-20170215233205-553a64147049 h1:K9KHZbXKpGydfDN0a github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8= github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -26,8 +26,8 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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.go b/instrumentation/github.com/gocql/gocql/otelgocql/gocql.go index df7e5ed5378..c9653686455 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/gocql.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/gocql.go @@ -20,7 +20,7 @@ import ( "github.com/gocql/gocql" otelcontrib "go.opentelemetry.io/contrib" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/trace" ) // NewSessionWithTracing creates a new session using the given cluster diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/gocql_test.go b/instrumentation/github.com/gocql/gocql/otelgocql/gocql_test.go index 80c1b1a801a..1685f6c7747 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/gocql_test.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/gocql_test.go @@ -28,12 +28,11 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/internal/util" - "go.opentelemetry.io/otel/api/metric" - "go.opentelemetry.io/otel/api/metric/metrictest" - "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/metric/number" + "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/semconv" + "go.opentelemetry.io/otel/trace" ) const ( @@ -53,16 +52,16 @@ type testRecord struct { name string meterName string labels []label.KeyValue - number metric.Number - numberKind metric.NumberKind + number number.Number + numberKind number.Kind } func TestQuery(t *testing.T) { defer afterEach() cluster := getCluster() - sr := new(tracetest.StandardSpanRecorder) - tracerProvider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) - meterImpl, meterProvider := metrictest.NewMeterProvider() + sr := new(oteltest.StandardSpanRecorder) + tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) + meterImpl, meterProvider := oteltest.NewMeterProvider() ctx, parentSpan := tracerProvider.Tracer(instrumentationName).Start(context.Background(), "gocql-test") @@ -178,9 +177,9 @@ func TestQuery(t *testing.T) { func TestBatch(t *testing.T) { defer afterEach() cluster := getCluster() - sr := new(tracetest.StandardSpanRecorder) - tracerProvider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) - meterImpl, meterProvider := metrictest.NewMeterProvider() + sr := new(oteltest.StandardSpanRecorder) + tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) + meterImpl, meterProvider := oteltest.NewMeterProvider() ctx, parentSpan := tracerProvider.Tracer(instrumentationName).Start(context.Background(), "gocql-test") @@ -272,9 +271,9 @@ func TestBatch(t *testing.T) { func TestConnection(t *testing.T) { defer afterEach() cluster := getCluster() - sr := new(tracetest.StandardSpanRecorder) - tracerProvider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) - meterImpl, meterProvider := metrictest.NewMeterProvider() + sr := new(oteltest.StandardSpanRecorder) + tracerProvider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) + meterImpl, meterProvider := oteltest.NewMeterProvider() connectObserver := &mockConnectObserver{0} ctx := context.Background() @@ -343,7 +342,7 @@ func TestHostOrIP(t *testing.T) { require.Empty(t, attribute.Value.AsString()) } -func assertConnectionLevelAttributes(t *testing.T, span *tracetest.Span) { +func assertConnectionLevelAttributes(t *testing.T, span *oteltest.Span) { assert.Equal(t, span.Attributes()[semconv.DBSystemKey].AsString(), semconv.DBSystemCassandra.Value.AsString(), ) @@ -367,7 +366,7 @@ func getCluster() *gocql.ClusterConfig { // obtainTestRecords creates a slice of testRecord with values // obtained from measurements -func obtainTestRecords(mbs []metrictest.Batch) []testRecord { +func obtainTestRecords(mbs []oteltest.Batch) []testRecord { var records []testRecord for _, mb := range mbs { for _, m := range mb.Measurements { diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go b/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go index c6d5ccce8e3..7ee710c37db 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go @@ -18,7 +18,7 @@ import ( "log" otelcontrib "go.opentelemetry.io/contrib" - "go.opentelemetry.io/otel/api/metric" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/unit" ) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/observer.go b/instrumentation/github.com/gocql/gocql/otelgocql/observer.go index fd53eabc996..449152ad252 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/observer.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/observer.go @@ -22,8 +22,8 @@ import ( "github.com/gocql/gocql" - "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/trace" ) // OTelQueryObserver implements the gocql.QueryObserver interface diff --git a/instrumentation/github.com/gorilla/mux/otelmux/config.go b/instrumentation/github.com/gorilla/mux/otelmux/config.go index ab5323de78a..fae12c81a83 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/config.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/config.go @@ -15,14 +15,14 @@ package otelmux import ( - "go.opentelemetry.io/otel" - oteltrace "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/propagation" + oteltrace "go.opentelemetry.io/otel/trace" ) // config is used to configure the mux middleware. type config struct { TracerProvider oteltrace.TracerProvider - Propagators otel.TextMapPropagator + Propagators propagation.TextMapPropagator } // Option specifies instrumentation configuration options. @@ -31,7 +31,7 @@ type Option func(*config) // WithPropagators specifies propagators to use for extracting // information from the HTTP requests. If none are specified, global // ones will be used. -func WithPropagators(propagators otel.TextMapPropagator) Option { +func WithPropagators(propagators propagation.TextMapPropagator) Option { return func(cfg *config) { cfg.Propagators = propagators } diff --git a/instrumentation/github.com/gorilla/mux/otelmux/example/go.mod b/instrumentation/github.com/gorilla/mux/otelmux/example/go.mod index 09c5b3a2274..36cf59cc575 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/example/go.mod +++ b/instrumentation/github.com/gorilla/mux/otelmux/example/go.mod @@ -10,8 +10,8 @@ replace ( require ( github.com/gorilla/mux v1.8.0 - go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/instrumentation/github.com/gorilla/mux/otelmux/example/go.sum b/instrumentation/github.com/gorilla/mux/otelmux/example/go.sum index 23d88a84e5d..5937f38e50d 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/example/go.sum +++ b/instrumentation/github.com/gorilla/mux/otelmux/example/go.sum @@ -6,8 +6,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= @@ -17,12 +17,12 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 ed6df7e1c92..ab8beaa6a17 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/example/server.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/example/server.go @@ -24,15 +24,14 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux" "go.opentelemetry.io/otel" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/exporters/stdout" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" + oteltrace "go.opentelemetry.io/otel/trace" ) -var tracer = otelglobal.Tracer("mux-server") +var tracer = otel.Tracer("mux-server") func main() { initTracer() @@ -64,8 +63,8 @@ func initTracer() { if err != nil { log.Fatal(err) } - otelglobal.SetTracerProvider(tp) - otelglobal.SetTextMapPropagator(otel.NewCompositeTextMapPropagator(propagators.TraceContext{}, propagators.Baggage{})) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) } func getUser(ctx context.Context, id string) string { diff --git a/instrumentation/github.com/gorilla/mux/otelmux/go.mod b/instrumentation/github.com/gorilla/mux/otelmux/go.mod index eb34b9d8eb9..d67aa1ec3e6 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/go.mod +++ b/instrumentation/github.com/gorilla/mux/otelmux/go.mod @@ -11,7 +11,7 @@ require ( github.com/felixge/httpsnoop v1.0.1 github.com/gorilla/mux v1.8.0 github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/contrib/propagators v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/contrib/propagators v0.14.0 + go.opentelemetry.io/otel v0.14.0 ) diff --git a/instrumentation/github.com/gorilla/mux/otelmux/go.sum b/instrumentation/github.com/gorilla/mux/otelmux/go.sum index 4c6620d51b6..7c082890d3d 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/go.sum +++ b/instrumentation/github.com/gorilla/mux/otelmux/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -12,8 +12,8 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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 4581c447945..2fac063b128 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/mux.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/mux.go @@ -25,9 +25,9 @@ import ( otelcontrib "go.opentelemetry.io/contrib" "go.opentelemetry.io/otel" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" + oteltrace "go.opentelemetry.io/otel/trace" ) const ( @@ -43,14 +43,14 @@ func Middleware(service string, opts ...Option) mux.MiddlewareFunc { opt(&cfg) } if cfg.TracerProvider == nil { - cfg.TracerProvider = otelglobal.TracerProvider() + cfg.TracerProvider = otel.GetTracerProvider() } tracer := cfg.TracerProvider.Tracer( tracerName, oteltrace.WithInstrumentationVersion(otelcontrib.SemVersion()), ) if cfg.Propagators == nil { - cfg.Propagators = otelglobal.TextMapPropagator() + cfg.Propagators = otel.GetTextMapPropagator() } return func(handler http.Handler) http.Handler { return traceware{ @@ -65,7 +65,7 @@ func Middleware(service string, opts ...Option) mux.MiddlewareFunc { type traceware struct { service string tracer oteltrace.Tracer - propagators otel.TextMapPropagator + propagators propagation.TextMapPropagator handler http.Handler } diff --git a/instrumentation/github.com/gorilla/mux/otelmux/mux_test.go b/instrumentation/github.com/gorilla/mux/otelmux/mux_test.go index e605f78961c..5437716eacb 100644 --- a/instrumentation/github.com/gorilla/mux/otelmux/mux_test.go +++ b/instrumentation/github.com/gorilla/mux/otelmux/mux_test.go @@ -29,24 +29,23 @@ import ( b3prop "go.opentelemetry.io/contrib/propagators/b3" "go.opentelemetry.io/otel" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" + oteltrace "go.opentelemetry.io/otel/trace" ) func TestChildSpanFromGlobalTracer(t *testing.T) { - otelglobal.SetTracerProvider(tracetest.NewTracerProvider()) + otel.SetTracerProvider(oteltest.NewTracerProvider()) router := mux.NewRouter() router.Use(Middleware("foobar")) router.HandleFunc("/user/{id}", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { span := oteltrace.SpanFromContext(r.Context()) - _, ok := span.(*tracetest.Span) + _, ok := span.(*oteltest.Span) assert.True(t, ok) spanTracer := span.Tracer() - mockTracer, ok := spanTracer.(*tracetest.Tracer) + mockTracer, ok := spanTracer.(*oteltest.Tracer) require.True(t, ok) assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux", mockTracer.Name) w.WriteHeader(http.StatusOK) @@ -59,16 +58,16 @@ func TestChildSpanFromGlobalTracer(t *testing.T) { } func TestChildSpanFromCustomTracer(t *testing.T) { - provider := tracetest.NewTracerProvider() + provider := oteltest.NewTracerProvider() router := mux.NewRouter() router.Use(Middleware("foobar", WithTracerProvider(provider))) router.HandleFunc("/user/{id}", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { span := oteltrace.SpanFromContext(r.Context()) - _, ok := span.(*tracetest.Span) + _, ok := span.(*oteltest.Span) assert.True(t, ok) spanTracer := span.Tracer() - mockTracer, ok := spanTracer.(*tracetest.Tracer) + mockTracer, ok := spanTracer.(*oteltest.Tracer) require.True(t, ok) assert.Equal(t, tracerName, mockTracer.Name) w.WriteHeader(http.StatusOK) @@ -81,8 +80,8 @@ func TestChildSpanFromCustomTracer(t *testing.T) { } func TestChildSpanNames(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) router := mux.NewRouter() router.Use(Middleware("foobar", WithTracerProvider(provider))) @@ -138,21 +137,21 @@ func TestGetSpanNotInstrumented(t *testing.T) { } func TestPropagationWithGlobalPropagators(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) - otelglobal.SetTextMapPropagator(propagators.TraceContext{}) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) + otel.SetTextMapPropagator(propagation.TraceContext{}) r := httptest.NewRequest("GET", "/user/123", nil) w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - otelglobal.TextMapPropagator().Inject(ctx, r.Header) + otel.GetTextMapPropagator().Inject(ctx, r.Header) router := mux.NewRouter() router.Use(Middleware("foobar", WithTracerProvider(provider))) router.HandleFunc("/user/{id}", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { span := oteltrace.SpanFromContext(r.Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, pspan.SpanContext().TraceID, mspan.SpanContext().TraceID) assert.Equal(t, pspan.SpanContext().SpanID, mspan.ParentSpanID()) @@ -160,12 +159,12 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { })) router.ServeHTTP(w, r) - otelglobal.SetTextMapPropagator(otel.NewCompositeTextMapPropagator()) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator()) } func TestPropagationWithCustomPropagators(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) b3 := b3prop.B3{} @@ -179,7 +178,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { router.Use(Middleware("foobar", WithTracerProvider(provider), WithPropagators(b3))) router.HandleFunc("/user/{id}", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { span := oteltrace.SpanFromContext(r.Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, pspan.SpanContext().TraceID, mspan.SpanContext().TraceID) assert.Equal(t, pspan.SpanContext().SpanID, mspan.ParentSpanID()) @@ -224,7 +223,7 @@ func (rw *testResponseWriter) ReadFrom(r io.Reader) (n int64, err error) { func TestResponseWriterInterfaces(t *testing.T) { // make sure the recordingResponseWriter preserves interfaces implemented by the wrapped writer - provider := tracetest.NewTracerProvider() + provider := oteltest.NewTracerProvider() router := mux.NewRouter() router.Use(Middleware("foobar", WithTracerProvider(provider))) diff --git a/instrumentation/github.com/labstack/echo/otelecho/config.go b/instrumentation/github.com/labstack/echo/otelecho/config.go index 3b23509b1e7..d94a5380549 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/config.go +++ b/instrumentation/github.com/labstack/echo/otelecho/config.go @@ -15,14 +15,14 @@ package otelecho import ( - "go.opentelemetry.io/otel" - oteltrace "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/propagation" + oteltrace "go.opentelemetry.io/otel/trace" ) // config is used to configure the mux middleware. type config struct { TracerProvider oteltrace.TracerProvider - Propagators otel.TextMapPropagator + Propagators propagation.TextMapPropagator } // Option specifies instrumentation configuration options. @@ -31,7 +31,7 @@ type Option func(*config) // WithPropagators specifies propagators to use for extracting // information from the HTTP requests. If none are specified, global // ones will be used. -func WithPropagators(propagators otel.TextMapPropagator) Option { +func WithPropagators(propagators propagation.TextMapPropagator) Option { return func(cfg *config) { cfg.Propagators = propagators } diff --git a/instrumentation/github.com/labstack/echo/otelecho/echo.go b/instrumentation/github.com/labstack/echo/otelecho/echo.go index c5c7eb99a4b..05904db420c 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/echo.go +++ b/instrumentation/github.com/labstack/echo/otelecho/echo.go @@ -20,11 +20,11 @@ import ( "github.com/labstack/echo/v4" otelcontrib "go.opentelemetry.io/contrib" + "go.opentelemetry.io/otel" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/semconv" + oteltrace "go.opentelemetry.io/otel/trace" ) const ( @@ -39,14 +39,14 @@ func Middleware(service string, opts ...Option) echo.MiddlewareFunc { opt(&cfg) } if cfg.TracerProvider == nil { - cfg.TracerProvider = otelglobal.TracerProvider() + cfg.TracerProvider = otel.GetTracerProvider() } tracer := cfg.TracerProvider.Tracer( tracerName, oteltrace.WithInstrumentationVersion(otelcontrib.SemVersion()), ) if cfg.Propagators == nil { - cfg.Propagators = otelglobal.TextMapPropagator() + cfg.Propagators = otel.GetTextMapPropagator() } return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { diff --git a/instrumentation/github.com/labstack/echo/otelecho/echo_test.go b/instrumentation/github.com/labstack/echo/otelecho/echo_test.go index b08176c068a..03739b915b3 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/echo_test.go +++ b/instrumentation/github.com/labstack/echo/otelecho/echo_test.go @@ -30,26 +30,25 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" b3prop "go.opentelemetry.io/contrib/propagators/b3" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" "go.opentelemetry.io/otel/label" + oteltrace "go.opentelemetry.io/otel/trace" ) func TestChildSpanFromGlobalTracer(t *testing.T) { - otelglobal.SetTracerProvider(tracetest.NewTracerProvider()) + otel.SetTracerProvider(oteltest.NewTracerProvider()) router := echo.New() router.Use(Middleware("foobar")) router.GET("/user/:id", func(c echo.Context) error { span := oteltrace.SpanFromContext(c.Request().Context()) - _, ok := span.(*tracetest.Span) + _, ok := span.(*oteltest.Span) assert.True(t, ok) spanTracer := span.Tracer() - mockTracer, ok := spanTracer.(*tracetest.Tracer) + mockTracer, ok := spanTracer.(*oteltest.Tracer) require.True(t, ok) assert.Equal(t, "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho", mockTracer.Name) return c.NoContent(200) @@ -62,16 +61,16 @@ func TestChildSpanFromGlobalTracer(t *testing.T) { } func TestChildSpanFromCustomTracer(t *testing.T) { - provider := tracetest.NewTracerProvider() + provider := oteltest.NewTracerProvider() router := echo.New() router.Use(Middleware("foobar", WithTracerProvider(provider))) router.GET("/user/:id", func(c echo.Context) error { span := oteltrace.SpanFromContext(c.Request().Context()) - _, ok := span.(*tracetest.Span) + _, ok := span.(*oteltest.Span) assert.True(t, ok) spanTracer := span.Tracer() - mockTracer, ok := spanTracer.(*tracetest.Tracer) + mockTracer, ok := spanTracer.(*oteltest.Tracer) require.True(t, ok) assert.Equal(t, tracerName, mockTracer.Name) return c.NoContent(200) @@ -84,14 +83,14 @@ func TestChildSpanFromCustomTracer(t *testing.T) { } func TestTrace200(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) router := echo.New() router.Use(Middleware("foobar", WithTracerProvider(provider))) router.GET("/user/:id", func(c echo.Context) error { span := oteltrace.SpanFromContext(c.Request().Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, label.StringValue("foobar"), mspan.Attributes()["http.server_name"]) id := c.Param("id") @@ -120,8 +119,8 @@ func TestTrace200(t *testing.T) { } func TestError(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) // setup router := echo.New() @@ -184,21 +183,21 @@ func TestGetSpanNotInstrumented(t *testing.T) { } func TestPropagationWithGlobalPropagators(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) - otelglobal.SetTextMapPropagator(propagators.TraceContext{}) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) + otel.SetTextMapPropagator(propagation.TraceContext{}) r := httptest.NewRequest("GET", "/user/123", nil) w := httptest.NewRecorder() ctx, pspan := provider.Tracer(tracerName).Start(context.Background(), "test") - otelglobal.TextMapPropagator().Inject(ctx, r.Header) + otel.GetTextMapPropagator().Inject(ctx, r.Header) router := echo.New() router.Use(Middleware("foobar", WithTracerProvider(provider))) router.GET("/user/:id", func(c echo.Context) error { span := oteltrace.SpanFromContext(c.Request().Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, pspan.SpanContext().TraceID, mspan.SpanContext().TraceID) assert.Equal(t, pspan.SpanContext().SpanID, mspan.ParentSpanID()) @@ -206,12 +205,12 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { }) router.ServeHTTP(w, r) - otelglobal.SetTextMapPropagator(otel.NewCompositeTextMapPropagator()) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator()) } func TestPropagationWithCustomPropagators(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) b3 := b3prop.B3{} @@ -225,7 +224,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { router.Use(Middleware("foobar", WithTracerProvider(provider), WithPropagators(b3))) router.GET("/user/:id", func(c echo.Context) error { span := oteltrace.SpanFromContext(c.Request().Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, pspan.SpanContext().TraceID, mspan.SpanContext().TraceID) assert.Equal(t, pspan.SpanContext().SpanID, mspan.ParentSpanID()) diff --git a/instrumentation/github.com/labstack/echo/otelecho/example/go.mod b/instrumentation/github.com/labstack/echo/otelecho/example/go.mod index 33dfb6e1e03..70e3fae148d 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/example/go.mod +++ b/instrumentation/github.com/labstack/echo/otelecho/example/go.mod @@ -10,8 +10,8 @@ replace ( require ( github.com/labstack/echo/v4 v4.1.17 - go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho v0.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/instrumentation/github.com/labstack/echo/otelecho/example/go.sum b/instrumentation/github.com/labstack/echo/otelecho/example/go.sum index ace287836cd..89d04018173 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/example/go.sum +++ b/instrumentation/github.com/labstack/echo/otelecho/example/go.sum @@ -5,8 +5,8 @@ github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiU github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/labstack/echo/v4 v4.1.17 h1:PQIBaRplyRy3OjwILGkPg89JRtH2x5bssi59G2EL3fo= @@ -31,12 +31,12 @@ 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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 da1ab3710eb..876df9ac849 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/example/server.go +++ b/instrumentation/github.com/labstack/echo/otelecho/example/server.go @@ -23,15 +23,14 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho" "go.opentelemetry.io/otel" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/exporters/stdout" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" + oteltrace "go.opentelemetry.io/otel/trace" ) -var tracer = otelglobal.Tracer("gin-server") +var tracer = otel.Tracer("gin-server") func main() { initTracer() @@ -67,8 +66,8 @@ func initTracer() { if err != nil { log.Fatal(err) } - otelglobal.SetTracerProvider(tp) - otelglobal.SetTextMapPropagator(otel.NewCompositeTextMapPropagator(propagators.TraceContext{}, propagators.Baggage{})) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) } func getUser(ctx context.Context, id string) string { diff --git a/instrumentation/github.com/labstack/echo/otelecho/go.mod b/instrumentation/github.com/labstack/echo/otelecho/go.mod index cdf62f1afe9..4be936850f0 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/go.mod +++ b/instrumentation/github.com/labstack/echo/otelecho/go.mod @@ -10,7 +10,7 @@ replace ( require ( github.com/labstack/echo/v4 v4.1.17 github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/contrib/propagators v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/contrib/propagators v0.14.0 + go.opentelemetry.io/otel v0.14.0 ) diff --git a/instrumentation/github.com/labstack/echo/otelecho/go.sum b/instrumentation/github.com/labstack/echo/otelecho/go.sum index 8ddd9cd5cbf..7541df2478f 100644 --- a/instrumentation/github.com/labstack/echo/otelecho/go.sum +++ b/instrumentation/github.com/labstack/echo/otelecho/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/labstack/echo/v4 v4.1.17 h1:PQIBaRplyRy3OjwILGkPg89JRtH2x5bssi59G2EL3fo= github.com/labstack/echo/v4 v4.1.17/go.mod h1:Tn2yRQL/UclUalpb5rPdXDevbkJ+lp/2svdyFBg6CHQ= github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0= @@ -27,8 +27,8 @@ 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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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/config.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/config.go index 88a205b91ec..b98181d2900 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/config.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/config.go @@ -16,8 +16,8 @@ package otelmongo import ( "go.opentelemetry.io/contrib" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/trace" ) const defaultTracerName = "go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo" @@ -32,7 +32,7 @@ type config struct { // newConfig returns a config with all Options set. func newConfig(opts ...Option) config { cfg := config{ - TracerProvider: global.TracerProvider(), + TracerProvider: otel.GetTracerProvider(), } for _, opt := range opts { opt(&cfg) 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 292798e684e..2343ce8cb2d 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.mod +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.mod @@ -8,7 +8,7 @@ require ( github.com/stretchr/testify v1.6.1 github.com/xdg/stringprep v1.0.0 // indirect go.mongodb.org/mongo-driver v1.4.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/otel v0.14.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 d89c5198df8..1ec05a1b695 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.sum +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/go.sum @@ -35,8 +35,8 @@ github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY9 github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -88,8 +88,8 @@ 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.1 h1:38NSAyDPagwnFpUA/D5SFgbugUYR3NzYRNa4Qk9UxKs= go.mongodb.org/mongo-driver v1.4.1/go.mod h1:llVBH2pkj9HywK0Dtdt6lDikOjFLbceHVu/Rc0iMKLs= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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 46d0ca672e3..89e00cede07 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go @@ -20,8 +20,8 @@ import ( "strings" "sync" - "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/trace" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/event" 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 80303f896a7..1fa6392b131 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 @@ -26,7 +26,7 @@ import ( "go.mongodb.org/mongo-driver/mongo/options" "go.opentelemetry.io/contrib/internal/util" - "go.opentelemetry.io/otel/api/trace/tracetest" + "go.opentelemetry.io/otel/oteltest" ) func TestMain(m *testing.M) { @@ -35,8 +35,8 @@ func TestMain(m *testing.M) { } func Test(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) hostname, port := "localhost", "27017" diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/benchmark_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/benchmark_test.go index e49bc55dad5..6b0353a2840 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/benchmark_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/benchmark_test.go @@ -25,12 +25,12 @@ import ( "google.golang.org/grpc/test/bufconn" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - "go.opentelemetry.io/otel/api/trace/tracetest" + "go.opentelemetry.io/otel/oteltest" ) const bufSize = 2048 -var tracerProvider = tracetest.NewTracerProvider() +var tracerProvider = oteltest.NewTracerProvider() func benchmark(b *testing.B, cOpt []grpc.DialOption, sOpt []grpc.ServerOption) { l := bufconn.Listen(bufSize) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/example/config/config.go b/instrumentation/google.golang.org/grpc/otelgrpc/example/config/config.go index afc1e465b0a..233d984ff34 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/example/config/config.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/example/config/config.go @@ -18,9 +18,8 @@ import ( "log" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" ) @@ -37,6 +36,6 @@ func Init() { if err != nil { log.Fatal(err) } - global.SetTracerProvider(tp) - global.SetTextMapPropagator(otel.NewCompositeTextMapPropagator(propagators.TraceContext{}, propagators.Baggage{})) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) } diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod index d70da6009c0..5db154bbcb7 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.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 golang.org/x/net v0.0.0-20200707034311-ab3426394381 google.golang.org/grpc v1.33.2 ) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum index 2a737b8d61d..678cef3b039 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum +++ b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum @@ -31,8 +31,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -42,12 +42,12 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/go.mod b/instrumentation/google.golang.org/grpc/otelgrpc/go.mod index a2d4cb913bb..c16702c6889 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/go.mod +++ b/instrumentation/google.golang.org/grpc/otelgrpc/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/contrib => ../../../../ require ( github.com/golang/protobuf v1.4.3 github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/otel v0.14.0 google.golang.org/grpc v1.33.2 ) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/go.sum b/instrumentation/google.golang.org/grpc/otelgrpc/go.sum index 71f106562e3..14db1a191b5 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/go.sum +++ b/instrumentation/google.golang.org/grpc/otelgrpc/go.sum @@ -27,8 +27,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -36,8 +36,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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/instrumentation/google.golang.org/grpc/otelgrpc/grpc_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/grpc_test.go index 57a583f9d31..077ad053900 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/grpc_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/grpc_test.go @@ -28,8 +28,8 @@ import ( "google.golang.org/grpc/test/bufconn" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - "go.opentelemetry.io/otel/api/trace/tracetest" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/semconv" ) @@ -72,17 +72,17 @@ func doCalls(cOpt []grpc.DialOption, sOpt []grpc.ServerOption) error { } func TestInterceptors(t *testing.T) { - clientUnarySR := new(tracetest.StandardSpanRecorder) - clientUnaryTP := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(clientUnarySR)) + clientUnarySR := new(oteltest.StandardSpanRecorder) + clientUnaryTP := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(clientUnarySR)) - clientStreamSR := new(tracetest.StandardSpanRecorder) - clientStreamTP := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(clientStreamSR)) + clientStreamSR := new(oteltest.StandardSpanRecorder) + clientStreamTP := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(clientStreamSR)) - serverUnarySR := new(tracetest.StandardSpanRecorder) - serverUnaryTP := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(serverUnarySR)) + serverUnarySR := new(oteltest.StandardSpanRecorder) + serverUnaryTP := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(serverUnarySR)) - serverStreamSR := new(tracetest.StandardSpanRecorder) - serverStreamTP := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(serverStreamSR)) + serverStreamSR := new(oteltest.StandardSpanRecorder) + serverStreamTP := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(serverStreamSR)) assert.NoError(t, doCalls( []grpc.DialOption{ @@ -112,13 +112,13 @@ func TestInterceptors(t *testing.T) { }) } -func checkUnaryClientSpans(t *testing.T, spans []*tracetest.Span) { +func checkUnaryClientSpans(t *testing.T, spans []*oteltest.Span) { require.Len(t, spans, 2) emptySpan := spans[0] assert.True(t, emptySpan.Ended()) assert.Equal(t, "grpc.testing.TestService/EmptyCall", emptySpan.Name()) - assert.Equal(t, []tracetest.Event{ + assert.Equal(t, []oteltest.Event{ { Name: "message", Attributes: map[label.Key]label.Value{ @@ -146,7 +146,7 @@ func checkUnaryClientSpans(t *testing.T, spans []*tracetest.Span) { largeSpan := spans[1] assert.True(t, largeSpan.Ended()) assert.Equal(t, "grpc.testing.TestService/UnaryCall", largeSpan.Name()) - assert.Equal(t, []tracetest.Event{ + assert.Equal(t, []oteltest.Event{ { Name: "message", Attributes: map[label.Key]label.Value{ @@ -174,14 +174,14 @@ func checkUnaryClientSpans(t *testing.T, spans []*tracetest.Span) { }, largeSpan.Attributes()) } -func checkStreamClientSpans(t *testing.T, spans []*tracetest.Span) { +func checkStreamClientSpans(t *testing.T, spans []*oteltest.Span) { require.Len(t, spans, 3) streamInput := spans[0] assert.True(t, streamInput.Ended()) assert.Equal(t, "grpc.testing.TestService/StreamingInputCall", streamInput.Name()) // sizes from reqSizes in "google.golang.org/grpc/interop". - assert.Equal(t, []tracetest.Event{ + assert.Equal(t, []oteltest.Event{ { Name: "message", Attributes: map[label.Key]label.Value{ @@ -227,7 +227,7 @@ func checkStreamClientSpans(t *testing.T, spans []*tracetest.Span) { assert.True(t, streamOutput.Ended()) assert.Equal(t, "grpc.testing.TestService/StreamingOutputCall", streamOutput.Name()) // sizes from respSizes in "google.golang.org/grpc/interop". - assert.Equal(t, []tracetest.Event{ + assert.Equal(t, []oteltest.Event{ { Name: "message", Attributes: map[label.Key]label.Value{ @@ -279,7 +279,7 @@ func checkStreamClientSpans(t *testing.T, spans []*tracetest.Span) { pingPong := spans[2] assert.True(t, pingPong.Ended()) assert.Equal(t, "grpc.testing.TestService/FullDuplexCall", pingPong.Name()) - assert.Equal(t, []tracetest.Event{ + assert.Equal(t, []oteltest.Event{ { Name: "message", Attributes: map[label.Key]label.Value{ @@ -353,14 +353,14 @@ func checkStreamClientSpans(t *testing.T, spans []*tracetest.Span) { }, pingPong.Attributes()) } -func checkStreamServerSpans(t *testing.T, spans []*tracetest.Span) { +func checkStreamServerSpans(t *testing.T, spans []*oteltest.Span) { require.Len(t, spans, 3) streamInput := spans[0] assert.True(t, streamInput.Ended()) assert.Equal(t, "grpc.testing.TestService/StreamingInputCall", streamInput.Name()) // sizes from reqSizes in "google.golang.org/grpc/interop". - assert.Equal(t, []tracetest.Event{ + assert.Equal(t, []oteltest.Event{ { Name: "message", Attributes: map[label.Key]label.Value{ @@ -413,7 +413,7 @@ func checkStreamServerSpans(t *testing.T, spans []*tracetest.Span) { assert.True(t, streamOutput.Ended()) assert.Equal(t, "grpc.testing.TestService/StreamingOutputCall", streamOutput.Name()) // sizes from respSizes in "google.golang.org/grpc/interop". - assert.Equal(t, []tracetest.Event{ + assert.Equal(t, []oteltest.Event{ { Name: "message", Attributes: map[label.Key]label.Value{ @@ -465,7 +465,7 @@ func checkStreamServerSpans(t *testing.T, spans []*tracetest.Span) { pingPong := spans[2] assert.True(t, pingPong.Ended()) assert.Equal(t, "grpc.testing.TestService/FullDuplexCall", pingPong.Name()) - assert.Equal(t, []tracetest.Event{ + assert.Equal(t, []oteltest.Event{ { Name: "message", Attributes: map[label.Key]label.Value{ @@ -539,13 +539,13 @@ func checkStreamServerSpans(t *testing.T, spans []*tracetest.Span) { }, pingPong.Attributes()) } -func checkUnaryServerSpans(t *testing.T, spans []*tracetest.Span) { +func checkUnaryServerSpans(t *testing.T, spans []*oteltest.Span) { require.Len(t, spans, 2) emptySpan := spans[0] assert.True(t, emptySpan.Ended()) assert.Equal(t, "grpc.testing.TestService/EmptyCall", emptySpan.Name()) - assert.Equal(t, []tracetest.Event{ + assert.Equal(t, []oteltest.Event{ { Name: "message", Attributes: map[label.Key]label.Value{ @@ -573,7 +573,7 @@ func checkUnaryServerSpans(t *testing.T, spans []*tracetest.Span) { largeSpan := spans[1] assert.True(t, largeSpan.Ended()) assert.Equal(t, "grpc.testing.TestService/UnaryCall", largeSpan.Name()) - assert.Equal(t, []tracetest.Event{ + assert.Equal(t, []oteltest.Event{ { Name: "message", Attributes: map[label.Key]label.Value{ @@ -601,10 +601,10 @@ func checkUnaryServerSpans(t *testing.T, spans []*tracetest.Span) { }, largeSpan.Attributes()) } -func noTimestamp(events []tracetest.Event) []tracetest.Event { - out := make([]tracetest.Event, 0, len(events)) +func noTimestamp(events []oteltest.Event) []oteltest.Event { + out := make([]oteltest.Event, 0, len(events)) for _, e := range events { - out = append(out, tracetest.Event{ + out = append(out, oteltest.Event{ Name: e.Name, Attributes: e.Attributes, }) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go b/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go index 69ef242502c..0cf3d9e00b2 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/grpctrace.go @@ -20,9 +20,10 @@ import ( "google.golang.org/grpc/metadata" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" ) const ( @@ -34,7 +35,7 @@ const ( // config is a group of options for this instrumentation. type config struct { - Propagators otel.TextMapPropagator + Propagators propagation.TextMapPropagator TracerProvider trace.TracerProvider } @@ -46,8 +47,8 @@ type Option interface { // newConfig returns a config configured with all the passed Options. func newConfig(opts []Option) *config { c := &config{ - Propagators: global.TextMapPropagator(), - TracerProvider: global.TracerProvider(), + Propagators: otel.GetTextMapPropagator(), + TracerProvider: otel.GetTracerProvider(), } for _, o := range opts { o.Apply(c) @@ -55,7 +56,7 @@ func newConfig(opts []Option) *config { return c } -type propagatorsOption struct{ p otel.TextMapPropagator } +type propagatorsOption struct{ p propagation.TextMapPropagator } func (o propagatorsOption) Apply(c *config) { c.Propagators = o.p @@ -63,7 +64,7 @@ func (o propagatorsOption) Apply(c *config) { // WithPropagators returns an Option to use the Propagators when extracting // and injecting trace context from requests. -func WithPropagators(p otel.TextMapPropagator) Option { +func WithPropagators(p propagation.TextMapPropagator) Option { return propagatorsOption{p: p} } @@ -114,7 +115,7 @@ func Extract(ctx context.Context, metadata *metadata.MD, opts ...Option) ([]labe metadata: metadata, }) - labelSet := otel.Baggage(ctx) + labelSet := baggage.Set(ctx) return (&labelSet).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 41d67373f60..9bdbbf607e7 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go @@ -30,11 +30,11 @@ import ( "google.golang.org/grpc/peer" "google.golang.org/grpc/status" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/trace" + "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" ) @@ -46,16 +46,16 @@ type messageType label.KeyValue func (m messageType) Event(ctx context.Context, id int, message interface{}) { span := trace.SpanFromContext(ctx) if p, ok := message.(proto.Message); ok { - span.AddEvent(ctx, "message", + span.AddEvent("message", trace.WithAttributes( label.KeyValue(m), semconv.RPCMessageIDKey.Int(id), semconv.RPCMessageUncompressedSizeKey.Int(proto.Size(p)), - ) + )) } else { - span.AddEvent(ctx, "message", + span.AddEvent("message", trace.WithAttributes( label.KeyValue(m), semconv.RPCMessageIDKey.Int(id), - ) + )) } } @@ -312,7 +312,7 @@ func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor { metadataCopy := requestMetadata.Copy() entries, spanCtx := Extract(ctx, &metadataCopy, opts...) - ctx = otel.ContextWithBaggageValues(ctx, entries...) + ctx = baggage.ContextWithValues(ctx, entries...) tracer := newConfig(opts).TracerProvider.Tracer( instrumentationName, @@ -401,7 +401,7 @@ func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor { metadataCopy := requestMetadata.Copy() entries, spanCtx := Extract(ctx, &metadataCopy, opts...) - ctx = otel.ContextWithBaggageValues(ctx, entries...) + ctx = baggage.ContextWithValues(ctx, entries...) tracer := newConfig(opts).TracerProvider.Tracer( instrumentationName, diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor_test.go index 9246b5c398e..5feafba6fc9 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/interceptor_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/interceptor_test.go @@ -20,9 +20,9 @@ import ( "testing" "time" - "go.opentelemetry.io/otel/api/trace/tracetest" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/oteltest" "go.opentelemetry.io/otel/semconv" "github.com/golang/protobuf/proto" //nolint:staticcheck @@ -37,22 +37,22 @@ import ( type SpanRecorder struct { mu sync.RWMutex - spans map[string]*tracetest.Span + spans map[string]*oteltest.Span } func NewSpanRecorder() *SpanRecorder { - return &SpanRecorder{spans: make(map[string]*tracetest.Span)} + return &SpanRecorder{spans: make(map[string]*oteltest.Span)} } -func (sr *SpanRecorder) OnStart(span *tracetest.Span) {} +func (sr *SpanRecorder) OnStart(span *oteltest.Span) {} -func (sr *SpanRecorder) OnEnd(span *tracetest.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) (*tracetest.Span, bool) { +func (sr *SpanRecorder) Get(name string) (*oteltest.Span, bool) { sr.mu.RLock() defer sr.mu.RUnlock() s, ok := sr.spans[name] @@ -93,7 +93,7 @@ func TestUnaryClientInterceptor(t *testing.T) { } sr := NewSpanRecorder() - tp := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) unaryInterceptor := UnaryClientInterceptor(WithTracerProvider(tp)) req := &mockProtoMessage{} @@ -271,7 +271,7 @@ func TestUnaryClientInterceptor(t *testing.T) { } } -func eventAttrMap(events []tracetest.Event) []map[label.Key]label.Value { +func eventAttrMap(events []oteltest.Event) []map[label.Key]label.Value { maps := make([]map[label.Key]label.Value, len(events)) for i, event := range events { maps[i] = event.Attributes @@ -299,7 +299,7 @@ func TestStreamClientInterceptor(t *testing.T) { // tracer sr := NewSpanRecorder() - tp := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) streamCI := StreamClientInterceptor(WithTracerProvider(tp)) var mockClStr mockClientStream @@ -339,7 +339,7 @@ func TestStreamClientInterceptor(t *testing.T) { _ = streamClient.RecvMsg(reply) // added retry because span end is called in separate go routine - var span *tracetest.Span + var span *oteltest.Span for retry := 0; retry < 5; retry++ { span, ok = sr.Get(name) if ok { @@ -383,7 +383,7 @@ func TestStreamClientInterceptor(t *testing.T) { func TestServerInterceptorError(t *testing.T) { sr := NewSpanRecorder() - tp := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) usi := UnaryServerInterceptor(WithTracerProvider(tp)) deniedErr := status.Error(grpc_codes.PermissionDenied, "PERMISSION_DENIED_TEXT") handler := func(_ context.Context, _ interface{}) (interface{}, error) { diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/config.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/config.go index 0c5c39f3343..ceb8a26074b 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/config.go +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/config.go @@ -16,14 +16,14 @@ package otelmacaron import ( "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" ) // config is a group of options for this instrumentation. type config struct { TracerProvider trace.TracerProvider - Propagators otel.TextMapPropagator + Propagators propagation.TextMapPropagator } // Option applies an option value for a config. @@ -34,8 +34,8 @@ type Option interface { // newConfig returns a config configured with all the passed Options. func newConfig(opts []Option) *config { c := &config{ - Propagators: global.TextMapPropagator(), - TracerProvider: global.TracerProvider(), + Propagators: otel.GetTextMapPropagator(), + TracerProvider: otel.GetTracerProvider(), } for _, o := range opts { o.Apply(c) @@ -43,7 +43,7 @@ func newConfig(opts []Option) *config { return c } -type propagatorsOption struct{ p otel.TextMapPropagator } +type propagatorsOption struct{ p propagation.TextMapPropagator } func (o propagatorsOption) Apply(c *config) { c.Propagators = o.p @@ -51,7 +51,7 @@ func (o propagatorsOption) Apply(c *config) { // WithPropagators returns an Option to use the Propagators when extracting // and injecting trace context from HTTP requests. -func WithPropagators(p otel.TextMapPropagator) Option { +func WithPropagators(p propagation.TextMapPropagator) Option { return propagatorsOption{p: p} } diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.mod b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.mod index 56213fc65cc..5eed47132c0 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.mod +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron v0.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.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 e6aec9531bf..01d25c9fadb 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.sum +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/go.sum @@ -6,8 +6,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191 h1:NjHlg70DuOkcAMqgt0+XA+NHwtu66MkTVVgR4fFWbcI= github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191/go.mod h1:VFI2o2q9kYsC4o7VP1HrEVosiZZTd+MVT3YZx4gqvJw= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -31,12 +31,12 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd github.com/stretchr/testify v1.6.1/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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 75769572e27..53d73ca4308 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/server.go +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/example/server.go @@ -23,15 +23,14 @@ import ( "go.opentelemetry.io/contrib/instrumentation/gopkg.in/macaron.v1/otelmacaron" "go.opentelemetry.io/otel" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/exporters/stdout" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" + oteltrace "go.opentelemetry.io/otel/trace" ) -var tracer = otelglobal.Tracer("macaron-server") +var tracer = otel.Tracer("macaron-server") func main() { initTracer() @@ -60,8 +59,8 @@ func initTracer() { if err != nil { log.Fatal(err) } - otelglobal.SetTracerProvider(tp) - otelglobal.SetTextMapPropagator(otel.NewCompositeTextMapPropagator(propagators.TraceContext{}, propagators.Baggage{})) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) } func getUser(ctx context.Context, id string) string { diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.mod b/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.mod index 5c6ae62eed2..dde61c215b3 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.mod +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.mod @@ -9,8 +9,8 @@ replace ( require ( github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/contrib/propagators v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/contrib/propagators v0.14.0 + go.opentelemetry.io/otel v0.14.0 gopkg.in/macaron.v1 v1.3.9 ) diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.sum b/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.sum index da77493a624..3fa90c11ae7 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.sum +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191 h1:NjHlg70DuOkcAMqgt0+XA+NHwtu66MkTVVgR4fFWbcI= github.com/go-macaron/inject v0.0.0-20160627170012-d8a0b8677191/go.mod h1:VFI2o2q9kYsC4o7VP1HrEVosiZZTd+MVT3YZx4gqvJw= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRidnzC1Oq86fpX1q/iEv2KJdrCtttYjT4= @@ -26,8 +26,8 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd github.com/stretchr/testify v1.6.1/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.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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 bbbddb45b37..a2a05c7e814 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron.go +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron.go @@ -20,8 +20,8 @@ import ( "gopkg.in/macaron.v1" - oteltrace "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/semconv" + oteltrace "go.opentelemetry.io/otel/trace" otelcontrib "go.opentelemetry.io/contrib" ) diff --git a/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron_test.go b/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron_test.go index 6be35e5c0e9..eeda89c55ad 100644 --- a/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron_test.go +++ b/instrumentation/gopkg.in/macaron.v1/otelmacaron/macaron_test.go @@ -26,24 +26,23 @@ import ( b3prop "go.opentelemetry.io/contrib/propagators/b3" "go.opentelemetry.io/otel" - otelglobal "go.opentelemetry.io/otel/api/global" - oteltrace "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" + oteltrace "go.opentelemetry.io/otel/trace" ) func TestChildSpanFromGlobalTracer(t *testing.T) { - otelglobal.SetTracerProvider(tracetest.NewTracerProvider()) + otel.SetTracerProvider(oteltest.NewTracerProvider()) m := macaron.Classic() m.Use(Middleware("foobar")) m.Get("/user/:id", func(ctx *macaron.Context) { span := oteltrace.SpanFromContext(ctx.Req.Request.Context()) - _, ok := span.(*tracetest.Span) + _, ok := span.(*oteltest.Span) assert.True(t, ok) spanTracer := span.Tracer() - mockTracer, ok := spanTracer.(*tracetest.Tracer) + mockTracer, ok := spanTracer.(*oteltest.Tracer) require.True(t, ok) assert.Equal(t, instrumentationName, mockTracer.Name) ctx.Resp.WriteHeader(http.StatusOK) @@ -56,8 +55,8 @@ func TestChildSpanFromGlobalTracer(t *testing.T) { } func TestChildSpanNames(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - tp := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) m := macaron.Classic() m.Use(Middleware("foobar", WithTracerProvider(tp))) @@ -120,20 +119,20 @@ func TestGetSpanNotInstrumented(t *testing.T) { } func TestPropagationWithGlobalPropagators(t *testing.T) { - tracer := tracetest.NewTracerProvider().Tracer("test-tracer") - otelglobal.SetTextMapPropagator(propagators.TraceContext{}) + tracer := oteltest.NewTracerProvider().Tracer("test-tracer") + otel.SetTextMapPropagator(propagation.TraceContext{}) r := httptest.NewRequest("GET", "/user/123", nil) w := httptest.NewRecorder() ctx, pspan := tracer.Start(context.Background(), "test") - otelglobal.TextMapPropagator().Inject(ctx, r.Header) + otel.GetTextMapPropagator().Inject(ctx, r.Header) m := macaron.Classic() m.Use(Middleware("foobar")) m.Get("/user/:id", func(ctx *macaron.Context) { span := oteltrace.SpanFromContext(ctx.Req.Request.Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, pspan.SpanContext().TraceID, mspan.SpanContext().TraceID) assert.Equal(t, pspan.SpanContext().SpanID, mspan.ParentSpanID()) @@ -141,11 +140,11 @@ func TestPropagationWithGlobalPropagators(t *testing.T) { }) m.ServeHTTP(w, r) - otelglobal.SetTextMapPropagator(otel.NewCompositeTextMapPropagator()) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator()) } func TestPropagationWithCustomPropagators(t *testing.T) { - tp := tracetest.NewTracerProvider() + tp := oteltest.NewTracerProvider() tracer := tp.Tracer("test-tracer") b3 := b3prop.B3{} @@ -159,7 +158,7 @@ func TestPropagationWithCustomPropagators(t *testing.T) { m.Use(Middleware("foobar", WithTracerProvider(tp), WithPropagators(b3))) m.Get("/user/:id", func(ctx *macaron.Context) { span := oteltrace.SpanFromContext(ctx.Req.Request.Context()) - mspan, ok := span.(*tracetest.Span) + mspan, ok := span.(*oteltest.Span) require.True(t, ok) assert.Equal(t, pspan.SpanContext().TraceID, mspan.SpanContext().TraceID) assert.Equal(t, pspan.SpanContext().SpanID, mspan.ParentSpanID()) diff --git a/instrumentation/host/example/go.mod b/instrumentation/host/example/go.mod index 333bde25fdd..1308b43a455 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.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/host v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/instrumentation/host/example/go.sum b/instrumentation/host/example/go.sum index 72d23847898..8d1fd19d057 100644 --- a/instrumentation/host/example/go.sum +++ b/instrumentation/host/example/go.sum @@ -8,8 +8,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -19,12 +19,12 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 c8fca39a7f5..2f542ea5742 100644 --- a/instrumentation/host/go.mod +++ b/instrumentation/host/go.mod @@ -9,7 +9,7 @@ require ( github.com/go-ole/go-ole v1.2.4 // indirect github.com/shirou/gopsutil v2.20.9+incompatible github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/otel v0.14.0 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a // indirect ) diff --git a/instrumentation/host/go.sum b/instrumentation/host/go.sum index eca1e3a7cbf..7ee7c42da7f 100644 --- a/instrumentation/host/go.sum +++ b/instrumentation/host/go.sum @@ -4,8 +4,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/shirou/gopsutil v2.20.9+incompatible h1:msXs2frUV+O/JLva9EDLpuJ84PrFsdCTCQex8PUdtkQ= @@ -13,8 +13,8 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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 65d939b97f7..d5ac3b557d2 100644 --- a/instrumentation/host/host.go +++ b/instrumentation/host/host.go @@ -26,9 +26,9 @@ import ( "github.com/shirou/gopsutil/process" "go.opentelemetry.io/contrib" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/metric" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/unit" ) @@ -87,7 +87,7 @@ var ( // newConfig computes a config from a list of Options. func newConfig(opts ...Option) config { c := config{ - MeterProvider: global.MeterProvider(), + MeterProvider: otel.GetMeterProvider(), } for _, opt := range opts { opt.ApplyHost(&c) @@ -99,7 +99,7 @@ func newConfig(opts ...Option) config { func Start(opts ...Option) error { c := newConfig(opts...) if c.MeterProvider == nil { - c.MeterProvider = global.MeterProvider() + c.MeterProvider = otel.GetMeterProvider() } h := &host{ meter: c.MeterProvider.Meter( @@ -146,33 +146,33 @@ func (h *host) register() error { // specific metrics that are not universal. processTimes, err := proc.TimesWithContext(ctx) if err != nil { - global.Handle(err) + otel.Handle(err) return } hostTimeSlice, err := cpu.TimesWithContext(ctx, false) if err != nil { - global.Handle(err) + otel.Handle(err) return } if len(hostTimeSlice) != 1 { - global.Handle(fmt.Errorf("host CPU usage: incorrect summary count")) + otel.Handle(fmt.Errorf("host CPU usage: incorrect summary count")) return } vmStats, err := mem.VirtualMemoryWithContext(ctx) if err != nil { - global.Handle(err) + otel.Handle(err) return } ioStats, err := net.IOCountersWithContext(ctx, false) if err != nil { - global.Handle(err) + otel.Handle(err) return } if len(ioStats) != 1 { - global.Handle(fmt.Errorf("host network usage: incorrect summary count")) + otel.Handle(fmt.Errorf("host network usage: incorrect summary count")) return } diff --git a/instrumentation/host/host_test.go b/instrumentation/host/host_test.go index 0785a4bca39..1aa423f8dbc 100644 --- a/instrumentation/host/host_test.go +++ b/instrumentation/host/host_test.go @@ -30,11 +30,11 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/instrumentation/host" - "go.opentelemetry.io/otel/api/metric/metrictest" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/oteltest" ) -func getMetric(impl *metrictest.MeterImpl, name string, lbl label.KeyValue) float64 { +func getMetric(impl *oteltest.MeterImpl, name string, lbl label.KeyValue) float64 { for _, b := range impl.MeasurementBatches { foundLabel := false for _, haveLabel := range b.Labels { @@ -60,7 +60,7 @@ func getMetric(impl *metrictest.MeterImpl, name string, lbl label.KeyValue) floa } func TestHostCPU(t *testing.T) { - impl, provider := metrictest.NewMeterProvider() + impl, provider := oteltest.NewMeterProvider() err := host.Start( host.WithMeterProvider(provider), ) @@ -134,7 +134,7 @@ func TestHostCPU(t *testing.T) { } func TestHostMemory(t *testing.T) { - impl, provider := metrictest.NewMeterProvider() + impl, provider := oteltest.NewMeterProvider() err := host.Start( host.WithMeterProvider(provider), ) @@ -206,7 +206,7 @@ func sendBytes(t *testing.T, count int) error { } func TestHostNetwork(t *testing.T) { - impl, provider := metrictest.NewMeterProvider() + impl, provider := oteltest.NewMeterProvider() err := host.Start( host.WithMeterProvider(provider), ) diff --git a/instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go b/instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go index 43f5ab3d2e1..38b789db8cc 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/clienttrace.go @@ -23,11 +23,11 @@ import ( "sync" "go.opentelemetry.io/contrib" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/label" "go.opentelemetry.io/otel/semconv" + "go.opentelemetry.io/otel/trace" ) var ( @@ -68,7 +68,7 @@ func NewClientTrace(ctx context.Context) *httptrace.ClientTrace { activeHooks: make(map[string]context.Context), } - ct.tr = global.TracerProvider().Tracer( + ct.tr = otel.GetTracerProvider().Tracer( "go.opentelemetry.io/otel/instrumentation/httptrace", trace.WithInstrumentationVersion(contrib.SemVersion()), ) @@ -219,18 +219,18 @@ func (ct *clientTracer) wroteRequest(info httptrace.WroteRequestInfo) { } func (ct *clientTracer) got100Continue() { - ct.span("http.receive").AddEvent(ct.Context, "GOT 100 - Continue") + ct.span("http.receive").AddEvent("GOT 100 - Continue") } func (ct *clientTracer) wait100Continue() { - ct.span("http.receive").AddEvent(ct.Context, "GOT 100 - Wait") + ct.span("http.receive").AddEvent("GOT 100 - Wait") } func (ct *clientTracer) got1xxResponse(code int, header textproto.MIMEHeader) error { - ct.span("http.receive").AddEvent(ct.Context, "GOT 1xx", + ct.span("http.receive").AddEvent("GOT 1xx", trace.WithAttributes( HTTPStatus.Int(code), HTTPHeaderMIME.String(sm2s(header)), - ) + )) return nil } diff --git a/instrumentation/net/http/httptrace/otelhttptrace/clienttrace_test.go b/instrumentation/net/http/httptrace/otelhttptrace/clienttrace_test.go index e096e5bc5c7..0b34c6db6ef 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/clienttrace_test.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/clienttrace_test.go @@ -24,20 +24,20 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace/tracetest" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/oteltest" ) -type SpanRecorder map[string]*tracetest.Span +type SpanRecorder map[string]*oteltest.Span -func (sr *SpanRecorder) OnStart(span *tracetest.Span) {} -func (sr *SpanRecorder) OnEnd(span *tracetest.Span) { (*sr)[span.Name()] = span } +func (sr *SpanRecorder) OnStart(span *oteltest.Span) {} +func (sr *SpanRecorder) OnEnd(span *oteltest.Span) { (*sr)[span.Name()] = span } func TestHTTPRequestWithClientTrace(t *testing.T) { sr := SpanRecorder{} - tp := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(&sr)) - global.SetTracerProvider(tp) + tp := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(&sr)) + otel.SetTracerProvider(tp) tr := tp.Tracer("httptrace/client") // Mock http server @@ -126,18 +126,18 @@ func TestHTTPRequestWithClientTrace(t *testing.T) { } } -type MultiSpanRecorder map[string][]*tracetest.Span +type MultiSpanRecorder map[string][]*oteltest.Span -func (sr *MultiSpanRecorder) Reset() { (*sr) = MultiSpanRecorder{} } -func (sr *MultiSpanRecorder) OnStart(span *tracetest.Span) {} -func (sr *MultiSpanRecorder) OnEnd(span *tracetest.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{} - global.SetTracerProvider( - tracetest.NewTracerProvider(tracetest.WithSpanRecorder(&sr)), + otel.SetTracerProvider( + oteltest.NewTracerProvider(oteltest.WithSpanRecorder(&sr)), ) ct := otelhttptrace.NewClientTrace(context.Background()) tts := []struct { @@ -224,8 +224,8 @@ func TestConcurrentConnectionStart(t *testing.T) { func TestEndBeforeStartCreatesSpan(t *testing.T) { sr := MultiSpanRecorder{} - global.SetTracerProvider( - tracetest.NewTracerProvider(tracetest.WithSpanRecorder(&sr)), + otel.SetTracerProvider( + oteltest.NewTracerProvider(oteltest.WithSpanRecorder(&sr)), ) ct := otelhttptrace.NewClientTrace(context.Background()) diff --git a/instrumentation/net/http/httptrace/otelhttptrace/example/client/client.go b/instrumentation/net/http/httptrace/otelhttptrace/example/client/client.go index bafccd82370..28a92c19d0d 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/client/client.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/example/client/client.go @@ -29,13 +29,13 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/exporters/stdout" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/semconv" + "go.opentelemetry.io/otel/trace" ) func initTracer() { @@ -53,8 +53,8 @@ func initTracer() { if err != nil { log.Fatal(err) } - global.SetTracerProvider(tp) - global.SetTextMapPropagator(otel.NewCompositeTextMapPropagator(propagators.TraceContext{}, propagators.Baggage{})) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) } func main() { @@ -64,13 +64,13 @@ func main() { client := http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)} - ctx := otel.ContextWithBaggageValues(context.Background(), + ctx := baggage.ContextWithValues(context.Background(), label.String("username", "donuts"), ) var body []byte - tr := global.Tracer("example/client") + tr := otel.Tracer("example/client") err := func(ctx context.Context) error { ctx, span := tr.Start(ctx, "say hello", trace.WithAttributes(semconv.PeerServiceKey.String("ExampleService"))) defer span.End() diff --git a/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod b/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod index 49eff460b89..7e5ecd81571 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod +++ b/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.13.0 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.14.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum b/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum index 01211e66f39..c57b0728b8b 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum +++ b/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum @@ -6,8 +6,6 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= @@ -17,12 +15,12 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 da22da7d2ce..594d8322813 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/server/server.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/example/server/server.go @@ -22,14 +22,14 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/exporters/stdout" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/semconv" + "go.opentelemetry.io/otel/trace" ) func initTracer() { @@ -44,12 +44,12 @@ func initTracer() { // In a production application, use sdktrace.ProbabilitySampler with a desired probability. tp := sdktrace.NewTracerProvider(sdktrace.WithConfig(sdktrace.Config{DefaultSampler: sdktrace.AlwaysSample()}), sdktrace.WithSyncer(exporter), - sdktrace.WithResource(resource.New(semconv.ServiceNameKey.String("ExampleService")))) + sdktrace.WithResource(resource.NewWithAttributes(semconv.ServiceNameKey.String("ExampleService")))) if err != nil { log.Fatal(err) } - global.SetTracerProvider(tp) - global.SetTextMapPropagator(otel.NewCompositeTextMapPropagator(propagators.TraceContext{}, propagators.Baggage{})) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) } func main() { @@ -60,8 +60,8 @@ func main() { helloHandler := func(w http.ResponseWriter, req *http.Request) { ctx := req.Context() span := trace.SpanFromContext(ctx) - username := otel.BaggageValue(ctx, uk) - span.AddEvent(ctx, "handling this...", uk.String(username.AsString())) + username := baggage.Value(ctx, uk) + span.AddEvent("handling this...", trace.WithAttributes(uk.String(username.AsString()))) _, _ = io.WriteString(w, "Hello, world!\n") } diff --git a/instrumentation/net/http/httptrace/otelhttptrace/go.mod b/instrumentation/net/http/httptrace/otelhttptrace/go.mod index 8fb71cba849..fa1f7c1f6a3 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/go.mod +++ b/instrumentation/net/http/httptrace/otelhttptrace/go.mod @@ -2,9 +2,11 @@ module go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptr go 1.14 +replace go.opentelemetry.io/contrib => ../../../../.. + require ( github.com/google/go-cmp v0.5.3 github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/otel v0.14.0 ) diff --git a/instrumentation/net/http/httptrace/otelhttptrace/go.sum b/instrumentation/net/http/httptrace/otelhttptrace/go.sum index 764ed8a5447..3f628996f99 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/go.sum +++ b/instrumentation/net/http/httptrace/otelhttptrace/go.sum @@ -1,30 +1,17 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/contrib v0.13.0 h1:q34CFu5REx9Dt2ksESHC/doIjFJkEg1oV3aSwlL5JR0= -go.opentelemetry.io/contrib v0.13.0/go.mod h1:HzCu6ebm0ywgNxGaEfs3izyJOMP4rZnzxycyTgpI5Sg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/net/http/httptrace/otelhttptrace/httptrace.go b/instrumentation/net/http/httptrace/otelhttptrace/httptrace.go index 7b6a121a2ac..6fc3025a38e 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/httptrace.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/httptrace.go @@ -19,10 +19,11 @@ import ( "net/http" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" + "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" ) // Option is a function that allows configuration of the httptrace Extract() @@ -30,11 +31,11 @@ import ( type Option func(*config) type config struct { - propagators otel.TextMapPropagator + propagators propagation.TextMapPropagator } func newConfig(opts []Option) *config { - c := &config{propagators: global.TextMapPropagator()} + c := &config{propagators: otel.GetTextMapPropagator()} for _, o := range opts { o(c) } @@ -42,7 +43,7 @@ func newConfig(opts []Option) *config { } // WithPropagators sets the propagators to use for Extraction and Injection -func WithPropagators(props otel.TextMapPropagator) Option { +func WithPropagators(props propagation.TextMapPropagator) Option { return func(c *config) { c.propagators = props } @@ -58,7 +59,7 @@ func Extract(ctx context.Context, req *http.Request, opts ...Option) ([]label.Ke semconv.NetAttributesFromHTTPRequest("tcp", req)..., ) - labels := otel.Baggage(ctx) + labels := baggage.Set(ctx) return attrs, (&labels).ToSlice(), trace.RemoteSpanContextFromContext(ctx) } diff --git a/instrumentation/net/http/httptrace/otelhttptrace/httptrace_test.go b/instrumentation/net/http/httptrace/otelhttptrace/httptrace_test.go index bac1284f696..af9c584f16b 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/httptrace_test.go +++ b/instrumentation/net/http/httptrace/otelhttptrace/httptrace_test.go @@ -24,20 +24,20 @@ import ( "github.com/google/go-cmp/cmp" "go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/trace/tracetest" + "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" ) func TestRoundtrip(t *testing.T) { - tr := tracetest.NewTracerProvider().Tracer("httptrace/client") + tr := oteltest.NewTracerProvider().Tracer("httptrace/client") var expectedAttrs map[label.Key]string expectedCorrs := map[label.Key]string{label.Key("foo"): "bar"} - props := otelhttptrace.WithPropagators(otel.NewCompositeTextMapPropagator(propagators.TraceContext{}, propagators.Baggage{})) + props := otelhttptrace.WithPropagators(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) // Mock http server ts := httptest.NewServer( @@ -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 = otel.ContextWithBaggageValues(ctx, label.String("foo", "bar")) + ctx = baggage.ContextWithValues(ctx, label.String("foo", "bar")) req, _ := http.NewRequest("GET", ts.URL, strings.NewReader("foo")) otelhttptrace.Inject(ctx, req, props) @@ -116,14 +116,14 @@ func TestRoundtrip(t *testing.T) { } func TestSpecifyPropagators(t *testing.T) { - tr := tracetest.NewTracerProvider().Tracer("httptrace/client") + tr := oteltest.NewTracerProvider().Tracer("httptrace/client") expectedCorrs := map[label.Key]string{label.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(propagators.Baggage{})) + _, corrs, span := otelhttptrace.Extract(r.Context(), r, otelhttptrace.WithPropagators(propagation.Baggage{})) actualCorrs := make(map[label.Key]string) for _, corr := range corrs { @@ -150,9 +150,9 @@ func TestSpecifyPropagators(t *testing.T) { err := func(ctx context.Context) error { ctx, span := tr.Start(ctx, "test") defer span.End() - ctx = otel.ContextWithBaggageValues(ctx, label.String("foo", "bar")) + ctx = baggage.ContextWithValues(ctx, label.String("foo", "bar")) req, _ := http.NewRequest("GET", ts.URL, nil) - otelhttptrace.Inject(ctx, req, otelhttptrace.WithPropagators(propagators.Baggage{})) + otelhttptrace.Inject(ctx, req, otelhttptrace.WithPropagators(propagation.Baggage{})) res, err := client.Do(req) if err != nil { diff --git a/instrumentation/net/http/otelhttp/client_test.go b/instrumentation/net/http/otelhttp/client_test.go index ed16426f790..2b9efe33b11 100644 --- a/instrumentation/net/http/otelhttp/client_test.go +++ b/instrumentation/net/http/otelhttp/client_test.go @@ -22,15 +22,15 @@ import ( "strings" "testing" - "go.opentelemetry.io/otel/api/trace/tracetest" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/oteltest" ) func TestConvenienceWrappers(t *testing.T) { - sr := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider(tracetest.WithSpanRecorder(sr)) + sr := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider(oteltest.WithSpanRecorder(sr)) orig := DefaultClient DefaultClient = &http.Client{ Transport: NewTransport( diff --git a/instrumentation/net/http/otelhttp/config.go b/instrumentation/net/http/otelhttp/config.go index d85a32d5ad7..168c3d8ff53 100644 --- a/instrumentation/net/http/otelhttp/config.go +++ b/instrumentation/net/http/otelhttp/config.go @@ -19,9 +19,9 @@ import ( "go.opentelemetry.io/contrib" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/metric" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" ) const ( @@ -33,7 +33,7 @@ const ( type config struct { Tracer trace.Tracer Meter metric.Meter - Propagators otel.TextMapPropagator + Propagators propagation.TextMapPropagator SpanStartOptions []trace.SpanOption ReadEvent bool WriteEvent bool @@ -60,9 +60,9 @@ func (o OptionFunc) Apply(c *config) { // newConfig creates a new config struct and applies opts to it. func newConfig(opts ...Option) *config { c := &config{ - Propagators: global.TextMapPropagator(), - TracerProvider: global.TracerProvider(), - MeterProvider: global.MeterProvider(), + Propagators: otel.GetTextMapPropagator(), + TracerProvider: otel.GetTracerProvider(), + MeterProvider: otel.GetMeterProvider(), } for _, opt := range opts { opt.Apply(c) @@ -107,8 +107,7 @@ func WithPublicEndpoint() Option { // WithPropagators configures specific propagators. If this // option isn't specified then -// go.opentelemetry.io/otel/api/global.TextMapPropagator() is used. -func WithPropagators(ps otel.TextMapPropagator) Option { +func WithPropagators(ps propagation.TextMapPropagator) Option { return OptionFunc(func(c *config) { c.Propagators = ps }) diff --git a/instrumentation/net/http/otelhttp/config_test.go b/instrumentation/net/http/otelhttp/config_test.go index 9eca423e94e..74aad017b39 100644 --- a/instrumentation/net/http/otelhttp/config_test.go +++ b/instrumentation/net/http/otelhttp/config_test.go @@ -23,15 +23,15 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/api/trace/tracetest" + "go.opentelemetry.io/otel/oteltest" ) func TestBasicFilter(t *testing.T) { rr := httptest.NewRecorder() - spanRecorder := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider( - tracetest.WithSpanRecorder(spanRecorder), + spanRecorder := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider( + oteltest.WithSpanRecorder(spanRecorder), ) h := NewHandler( @@ -101,9 +101,9 @@ func TestSpanNameFormatter(t *testing.T) { t.Run(tc.name, func(t *testing.T) { rr := httptest.NewRecorder() - spanRecorder := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider( - tracetest.WithSpanRecorder(spanRecorder), + spanRecorder := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider( + oteltest.WithSpanRecorder(spanRecorder), ) handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if _, err := io.WriteString(w, "hello world"); err != nil { diff --git a/instrumentation/net/http/otelhttp/example/client/client.go b/instrumentation/net/http/otelhttp/example/client/client.go index 9b1e2cdd4e9..c46c9de67f6 100644 --- a/instrumentation/net/http/otelhttp/example/client/client.go +++ b/instrumentation/net/http/otelhttp/example/client/client.go @@ -27,13 +27,13 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/exporters/stdout" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/propagation" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/semconv" + "go.opentelemetry.io/otel/trace" ) func initTracer() { @@ -51,8 +51,8 @@ func initTracer() { if err != nil { log.Fatal(err) } - global.SetTracerProvider(tp) - global.SetTextMapPropagator(otel.NewCompositeTextMapPropagator(propagators.TraceContext{}, propagators.Baggage{})) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) } func main() { @@ -62,13 +62,13 @@ func main() { client := http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)} - ctx := otel.ContextWithBaggageValues(context.Background(), + ctx := baggage.ContextWithValues(context.Background(), label.String("username", "donuts"), ) var body []byte - tr := global.Tracer("example/client") + tr := otel.Tracer("example/client") err := func(ctx context.Context) error { ctx, span := tr.Start(ctx, "say hello", trace.WithAttributes(semconv.PeerServiceKey.String("ExampleService"))) defer span.End() diff --git a/instrumentation/net/http/otelhttp/example/go.mod b/instrumentation/net/http/otelhttp/example/go.mod index 339c3fda830..fc8dfd3cb87 100644 --- a/instrumentation/net/http/otelhttp/example/go.mod +++ b/instrumentation/net/http/otelhttp/example/go.mod @@ -8,8 +8,8 @@ replace ( ) require ( - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.13.0 - go.opentelemetry.io/otel v0.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.14.0 + go.opentelemetry.io/otel v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/instrumentation/net/http/otelhttp/example/go.sum b/instrumentation/net/http/otelhttp/example/go.sum index d216db7fef0..c57b0728b8b 100644 --- a/instrumentation/net/http/otelhttp/example/go.sum +++ b/instrumentation/net/http/otelhttp/example/go.sum @@ -6,8 +6,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -15,12 +15,12 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 da22da7d2ce..594d8322813 100644 --- a/instrumentation/net/http/otelhttp/example/server/server.go +++ b/instrumentation/net/http/otelhttp/example/server/server.go @@ -22,14 +22,14 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/exporters/stdout" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/semconv" + "go.opentelemetry.io/otel/trace" ) func initTracer() { @@ -44,12 +44,12 @@ func initTracer() { // In a production application, use sdktrace.ProbabilitySampler with a desired probability. tp := sdktrace.NewTracerProvider(sdktrace.WithConfig(sdktrace.Config{DefaultSampler: sdktrace.AlwaysSample()}), sdktrace.WithSyncer(exporter), - sdktrace.WithResource(resource.New(semconv.ServiceNameKey.String("ExampleService")))) + sdktrace.WithResource(resource.NewWithAttributes(semconv.ServiceNameKey.String("ExampleService")))) if err != nil { log.Fatal(err) } - global.SetTracerProvider(tp) - global.SetTextMapPropagator(otel.NewCompositeTextMapPropagator(propagators.TraceContext{}, propagators.Baggage{})) + otel.SetTracerProvider(tp) + otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{})) } func main() { @@ -60,8 +60,8 @@ func main() { helloHandler := func(w http.ResponseWriter, req *http.Request) { ctx := req.Context() span := trace.SpanFromContext(ctx) - username := otel.BaggageValue(ctx, uk) - span.AddEvent(ctx, "handling this...", uk.String(username.AsString())) + username := baggage.Value(ctx, uk) + span.AddEvent("handling this...", trace.WithAttributes(uk.String(username.AsString()))) _, _ = io.WriteString(w, "Hello, world!\n") } diff --git a/instrumentation/net/http/otelhttp/go.mod b/instrumentation/net/http/otelhttp/go.mod index 3542e4e486e..29e048f5764 100644 --- a/instrumentation/net/http/otelhttp/go.mod +++ b/instrumentation/net/http/otelhttp/go.mod @@ -7,6 +7,6 @@ replace go.opentelemetry.io/contrib => ../../../.. require ( github.com/felixge/httpsnoop v1.0.1 github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/otel v0.14.0 ) diff --git a/instrumentation/net/http/otelhttp/go.sum b/instrumentation/net/http/otelhttp/go.sum index 01463f8c40d..d1e341cdd89 100644 --- a/instrumentation/net/http/otelhttp/go.sum +++ b/instrumentation/net/http/otelhttp/go.sum @@ -2,15 +2,15 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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 3bbb1dabe1c..8ef06eddc2c 100644 --- a/instrumentation/net/http/otelhttp/handler.go +++ b/instrumentation/net/http/otelhttp/handler.go @@ -22,11 +22,11 @@ import ( "github.com/felixge/httpsnoop" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/metric" - "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" + "go.opentelemetry.io/otel/trace" ) var _ http.Handler = &Handler{} @@ -41,7 +41,7 @@ type Handler struct { tracer trace.Tracer meter metric.Meter - propagators otel.TextMapPropagator + propagators propagation.TextMapPropagator spanStartOptions []trace.SpanOption readEvent bool writeEvent bool @@ -88,7 +88,7 @@ func (h *Handler) configure(c *config) { func handleErr(err error) { if err != nil { - global.Handle(err) + otel.Handle(err) } } @@ -134,7 +134,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { readRecordFunc := func(int64) {} if h.readEvent { readRecordFunc = func(n int64) { - span.AddEvent(ctx, "read", ReadBytesKey.Int64(n)) + span.AddEvent("read", trace.WithAttributes(ReadBytesKey.Int64(n))) } } bw := bodyWrapper{ReadCloser: r.Body, record: readRecordFunc} @@ -143,7 +143,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { writeRecordFunc := func(int64) {} if h.writeEvent { writeRecordFunc = func(n int64) { - span.AddEvent(ctx, "write", WroteBytesKey.Int64(n)) + span.AddEvent("write", trace.WithAttributes(WroteBytesKey.Int64(n))) } } diff --git a/instrumentation/net/http/otelhttp/handler_example_test.go b/instrumentation/net/http/otelhttp/handler_example_test.go index e7d891a25b2..257745bdfdf 100644 --- a/instrumentation/net/http/otelhttp/handler_example_test.go +++ b/instrumentation/net/http/otelhttp/handler_example_test.go @@ -22,8 +22,8 @@ import ( "net/http" "strings" - "go.opentelemetry.io/otel/api/trace" "go.opentelemetry.io/otel/label" + "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" ) diff --git a/instrumentation/net/http/otelhttp/handler_test.go b/instrumentation/net/http/otelhttp/handler_test.go index e03c97fa3d6..e35dfb7dcde 100644 --- a/instrumentation/net/http/otelhttp/handler_test.go +++ b/instrumentation/net/http/otelhttp/handler_test.go @@ -24,16 +24,15 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/api/metric/metrictest" - "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/label" - "go.opentelemetry.io/otel/propagators" + "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 []metrictest.Batch) { +func assertMetricLabels(t *testing.T, expectedLabels []label.KeyValue, measurementBatches []oteltest.Batch) { for _, batch := range measurementBatches { assert.ElementsMatch(t, expectedLabels, batch.Labels) } @@ -42,11 +41,11 @@ func assertMetricLabels(t *testing.T, expectedLabels []label.KeyValue, measureme func TestHandlerBasics(t *testing.T) { rr := httptest.NewRecorder() - spanRecorder := new(tracetest.StandardSpanRecorder) - provider := tracetest.NewTracerProvider( - tracetest.WithSpanRecorder(spanRecorder), + spanRecorder := new(oteltest.StandardSpanRecorder) + provider := oteltest.NewTracerProvider( + oteltest.WithSpanRecorder(spanRecorder), ) - meterimpl, meterProvider := metrictest.NewMeterProvider() + meterimpl, meterProvider := oteltest.NewMeterProvider() operation := "test_handler" @@ -61,7 +60,7 @@ func TestHandlerBasics(t *testing.T) { }), operation, WithTracerProvider(provider), WithMeterProvider(meterProvider), - WithPropagators(propagators.TraceContext{}), + WithPropagators(propagation.TraceContext{}), ) r, err := http.NewRequest(http.MethodGet, "http://localhost/", strings.NewReader("foo")) @@ -111,7 +110,7 @@ func TestHandlerBasics(t *testing.T) { func TestHandlerNoWrite(t *testing.T) { rr := httptest.NewRecorder() - provider := tracetest.NewTracerProvider() + provider := oteltest.NewTracerProvider() operation := "test_handler" var span trace.Span @@ -121,7 +120,7 @@ func TestHandlerNoWrite(t *testing.T) { span = trace.SpanFromContext(r.Context()) }), operation, WithTracerProvider(provider), - WithPropagators(propagators.TraceContext{}), + WithPropagators(propagation.TraceContext{}), ) r, err := http.NewRequest(http.MethodGet, "http://localhost/", nil) @@ -140,7 +139,7 @@ func TestHandlerNoWrite(t *testing.T) { if got, expected := span.SpanContext().SpanID, expectSpanID; got != expected { t.Fatalf("got %d, expected %d", got, expected) } - if mockSpan, ok := span.(*tracetest.Span); ok { + if mockSpan, ok := span.(*oteltest.Span); ok { if got, expected := mockSpan.StatusCode(), codes.Unset; got != expected { t.Fatalf("got %q, expected %q", got, expected) } @@ -152,7 +151,7 @@ func TestHandlerNoWrite(t *testing.T) { func TestResponseWriterOptionalInterfaces(t *testing.T) { rr := httptest.NewRecorder() - provider := tracetest.NewTracerProvider() + provider := oteltest.NewTracerProvider() // ResponseRecorder implements the Flusher interface. Make sure the // wrapped ResponseWriter passed to the handler still implements diff --git a/instrumentation/net/http/otelhttp/transport.go b/instrumentation/net/http/otelhttp/transport.go index 04ec0d14978..c0e292bfa47 100644 --- a/instrumentation/net/http/otelhttp/transport.go +++ b/instrumentation/net/http/otelhttp/transport.go @@ -19,11 +19,9 @@ import ( "io" "net/http" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/semconv" - - "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" ) // Transport implements the http.RoundTripper interface and wraps @@ -32,7 +30,7 @@ type Transport struct { rt http.RoundTripper tracer trace.Tracer - propagators otel.TextMapPropagator + propagators propagation.TextMapPropagator spanStartOptions []trace.SpanOption filters []Filter spanNameFormatter func(string, *http.Request) string @@ -91,7 +89,7 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { res, err := t.rt.RoundTrip(r) if err != nil { - span.RecordError(ctx, err, trace.WithErrorStatus(codes.Error)) + span.RecordError(err) span.End() return res, err } @@ -120,7 +118,7 @@ func (wb *wrappedBody) Read(b []byte) (int, error) { case io.EOF: wb.span.End() default: - wb.span.RecordError(wb.ctx, err, trace.WithErrorStatus(codes.Error)) + wb.span.RecordError(err) } return n, err } diff --git a/instrumentation/net/http/otelhttp/transport_test.go b/instrumentation/net/http/otelhttp/transport_test.go index 0c92f0aafe3..2e5240101c5 100644 --- a/instrumentation/net/http/otelhttp/transport_test.go +++ b/instrumentation/net/http/otelhttp/transport_test.go @@ -22,15 +22,14 @@ import ( "net/http/httptest" "testing" - "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/propagators" - - "go.opentelemetry.io/otel/api/trace/tracetest" + "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" ) func TestTransportBasics(t *testing.T) { - prop := propagators.TraceContext{} - provider := tracetest.NewTracerProvider() + prop := propagation.TraceContext{} + provider := oteltest.NewTracerProvider() content := []byte("Hello, world!") ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/instrumentation/net/http/otelhttp/wrap.go b/instrumentation/net/http/otelhttp/wrap.go index 11d8538044d..7672191facc 100644 --- a/instrumentation/net/http/otelhttp/wrap.go +++ b/instrumentation/net/http/otelhttp/wrap.go @@ -19,7 +19,7 @@ import ( "io" "net/http" - "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/propagation" ) var _ io.ReadCloser = &bodyWrapper{} @@ -61,7 +61,7 @@ type respWriterWrapper struct { // used to inject the header ctx context.Context - props otel.TextMapPropagator + props propagation.TextMapPropagator written int64 statusCode int diff --git a/instrumentation/runtime/example/go.mod b/instrumentation/runtime/example/go.mod index a558f658a33..6d1f0c496e1 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.13.0 - go.opentelemetry.io/otel/exporters/stdout v0.13.0 - go.opentelemetry.io/otel/sdk v0.13.0 + go.opentelemetry.io/contrib/instrumentation/runtime v0.14.0 + go.opentelemetry.io/otel/exporters/stdout v0.14.0 + go.opentelemetry.io/otel/sdk v0.14.0 ) diff --git a/instrumentation/runtime/example/go.sum b/instrumentation/runtime/example/go.sum index de175e449c0..8fe25024336 100644 --- a/instrumentation/runtime/example/go.sum +++ b/instrumentation/runtime/example/go.sum @@ -4,8 +4,8 @@ github.com/benbjohnson/clock v1.0.3 h1:vkLuvpK4fmtSCuo60+yC63p7y0BmQ8gm5ZXGuBCJy github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -13,12 +13,12 @@ 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= -go.opentelemetry.io/otel/exporters/stdout v0.13.0 h1:A+XiGIPQbGoJoBOJfKAKnZyiUSjSWvL3XWETUvtom5k= -go.opentelemetry.io/otel/exporters/stdout v0.13.0/go.mod h1:JJt8RpNY6K+ft9ir3iKpceCvT/rhzJXEExGrWFCbv1o= -go.opentelemetry.io/otel/sdk v0.13.0 h1:4VCfpKamZ8GtnepXxMRurSpHpMKkcxhtO33z1S4rGDQ= -go.opentelemetry.io/otel/sdk v0.13.0/go.mod h1:dKvLH8Uu8LcEPlSAUsfW7kMGaJBhk/1NYvpPZ6wIMbU= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= +go.opentelemetry.io/otel/exporters/stdout v0.14.0 h1:gDMMj9fo1V70W5EImpnK3chkhk+xE193slrvofXYHDM= +go.opentelemetry.io/otel/exporters/stdout v0.14.0/go.mod h1:KG9w470+KbZZexYbC/g3TPKgluS0VgBJHh4KlnJpG18= +go.opentelemetry.io/otel/sdk v0.14.0 h1:Pqgd85y5XhyvHQlOxkKW+FD4DAX7AoeaNIDKC2VhfHQ= +go.opentelemetry.io/otel/sdk v0.14.0/go.mod h1:kGO5pEMSNqSJppHAm8b73zztLxB5fgDQnD56/dl5xqE= 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 8b5057d011a..fb16022d93d 100644 --- a/instrumentation/runtime/go.mod +++ b/instrumentation/runtime/go.mod @@ -6,6 +6,6 @@ replace go.opentelemetry.io/contrib => ../.. require ( github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/contrib v0.13.0 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/contrib v0.14.0 + go.opentelemetry.io/otel v0.14.0 ) diff --git a/instrumentation/runtime/go.sum b/instrumentation/runtime/go.sum index aea1db3f4c7..65a50faf12b 100644 --- a/instrumentation/runtime/go.sum +++ b/instrumentation/runtime/go.sum @@ -1,15 +1,15 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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/runtime.go b/instrumentation/runtime/runtime.go index d563d58187b..bd0db4b1e1b 100644 --- a/instrumentation/runtime/runtime.go +++ b/instrumentation/runtime/runtime.go @@ -21,8 +21,8 @@ import ( "time" "go.opentelemetry.io/contrib" - "go.opentelemetry.io/otel/api/global" - "go.opentelemetry.io/otel/api/metric" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/unit" ) @@ -89,7 +89,7 @@ func (o metricProviderOption) ApplyRuntime(c *config) { // newConfig computes a config from the supplied Options. func newConfig(opts ...Option) config { c := config{ - MeterProvider: global.MeterProvider(), + MeterProvider: otel.GetMeterProvider(), MinimumReadMemStatsInterval: DefaultMinimumReadMemStatsInterval, } for _, opt := range opts { @@ -105,7 +105,7 @@ func Start(opts ...Option) error { c.MinimumReadMemStatsInterval = DefaultMinimumReadMemStatsInterval } if c.MeterProvider == nil { - c.MeterProvider = global.MeterProvider() + c.MeterProvider = otel.GetMeterProvider() } r := &runtime{ meter: c.MeterProvider.Meter( diff --git a/instrumentation/runtime/runtime_test.go b/instrumentation/runtime/runtime_test.go index 0eab6438fb6..b82c01ee457 100644 --- a/instrumentation/runtime/runtime_test.go +++ b/instrumentation/runtime/runtime_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/instrumentation/runtime" - "go.opentelemetry.io/otel/api/metric/metrictest" + "go.opentelemetry.io/otel/oteltest" ) func TestRuntime(t *testing.T) { @@ -34,7 +34,7 @@ func TestRuntime(t *testing.T) { time.Sleep(time.Second) } -func getGCCount(impl *metrictest.MeterImpl) int { +func getGCCount(impl *oteltest.MeterImpl) int { for _, b := range impl.MeasurementBatches { for _, m := range b.Measurements { if m.Instrument.Descriptor().Name() == "runtime.go.gc.count" { @@ -52,7 +52,7 @@ func testMinimumInterval(t *testing.T, shouldHappen bool, opts ...runtime.Option goruntime.ReadMemStats(&mstats0) baseline := int(mstats0.NumGC) - impl, provider := metrictest.NewMeterProvider() + impl, provider := oteltest.NewMeterProvider() err := runtime.Start( append( diff --git a/propagators/b3/b3_benchmark_test.go b/propagators/b3/b3_benchmark_test.go index bffb4ac4484..1c79bf3279a 100644 --- a/propagators/b3/b3_benchmark_test.go +++ b/propagators/b3/b3_benchmark_test.go @@ -20,7 +20,7 @@ import ( "testing" "go.opentelemetry.io/contrib/propagators/b3" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/trace" ) func BenchmarkExtractB3(b *testing.B) { diff --git a/propagators/b3/b3_data_test.go b/propagators/b3/b3_data_test.go index 814554939d0..8c8837f7494 100644 --- a/propagators/b3/b3_data_test.go +++ b/propagators/b3/b3_data_test.go @@ -18,7 +18,7 @@ import ( "fmt" "go.opentelemetry.io/contrib/propagators/b3" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/trace" ) const ( @@ -42,9 +42,9 @@ var ( traceID64bitPadded = mustTraceIDFromHex("0000000000000000a3ce929d0e0e4736") ) -func mustTraceIDFromHex(s string) (t trace.ID) { +func mustTraceIDFromHex(s string) (t trace.TraceID) { var err error - t, err = trace.IDFromHex(s) + t, err = trace.TraceIDFromHex(s) if err != nil { panic(err) } @@ -70,7 +70,7 @@ var extractHeaders = []extractTest{ { name: "empty", headers: map[string]string{}, - wantSc: trace.EmptySpanContext(), + wantSc: trace.SpanContext{}, }, { name: "multiple: sampling state defer", @@ -196,7 +196,7 @@ var extractHeaders = []extractTest{ headers: map[string]string{ b3Sampled: "0", }, - wantSc: trace.EmptySpanContext(), + wantSc: trace.SpanContext{}, }, { name: "multiple: left-padding 64-bit traceID", @@ -269,7 +269,7 @@ var extractHeaders = []extractTest{ headers: map[string]string{ b3Context: "0", }, - wantSc: trace.EmptySpanContext(), + wantSc: trace.SpanContext{}, }, { name: "single: left-padding 64-bit traceID", diff --git a/propagators/b3/b3_example_test.go b/propagators/b3/b3_example_test.go index 47a55c46c38..3e125d13394 100644 --- a/propagators/b3/b3_example_test.go +++ b/propagators/b3/b3_example_test.go @@ -16,13 +16,13 @@ package b3_test import ( "go.opentelemetry.io/contrib/propagators/b3" - "go.opentelemetry.io/otel/api/global" + "go.opentelemetry.io/otel" ) func ExampleB3() { b3 := b3.B3{} // Register the B3 propagator globally. - global.SetTextMapPropagator(b3) + otel.SetTextMapPropagator(b3) } func ExampleB3_injectEncoding() { @@ -31,5 +31,5 @@ func ExampleB3_injectEncoding() { b3 := b3.B3{ InjectEncoding: b3.B3MultipleHeader | b3.B3SingleHeader, } - global.SetTextMapPropagator(b3) + otel.SetTextMapPropagator(b3) } diff --git a/propagators/b3/b3_integration_test.go b/propagators/b3/b3_integration_test.go index 7204535289b..6f59ebe31b4 100644 --- a/propagators/b3/b3_integration_test.go +++ b/propagators/b3/b3_integration_test.go @@ -22,12 +22,12 @@ import ( "github.com/google/go-cmp/cmp" "go.opentelemetry.io/contrib/propagators/b3" - "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" + "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/trace" ) var ( - mockTracer = tracetest.NewTracerProvider().Tracer("") + mockTracer = oteltest.NewTracerProvider().Tracer("") _, mockSpan = mockTracer.Start(context.Background(), "") ) diff --git a/propagators/b3/b3_propagator.go b/propagators/b3/b3_propagator.go index 99a581d0bc3..bad9004bc3e 100644 --- a/propagators/b3/b3_propagator.go +++ b/propagators/b3/b3_propagator.go @@ -19,8 +19,8 @@ import ( "errors" "strings" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" ) const ( @@ -44,7 +44,7 @@ const ( ) var ( - empty = trace.EmptySpanContext() + empty = trace.SpanContext{} errInvalidSampledByte = errors.New("invalid B3 Sampled found") errInvalidSampledHeader = errors.New("invalid B3 Sampled header found") @@ -96,12 +96,12 @@ type B3 struct { InjectEncoding Encoding } -var _ otel.TextMapPropagator = B3{} +var _ propagation.TextMapPropagator = B3{} // Inject injects a context into the carrier as B3 headers. // The parent span ID is omitted because it is not tracked in the // SpanContext. -func (b3 B3) Inject(ctx context.Context, carrier otel.TextMapCarrier) { +func (b3 B3) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { sc := trace.SpanFromContext(ctx).SpanContext() if b3.InjectEncoding.supports(B3SingleHeader) { @@ -143,7 +143,7 @@ func (b3 B3) Inject(ctx context.Context, carrier otel.TextMapCarrier) { } // Extract extracts a context from the carrier if it contains B3 headers. -func (b3 B3) Extract(ctx context.Context, carrier otel.TextMapCarrier) context.Context { +func (b3 B3) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { var ( sc trace.SpanContext err error @@ -225,7 +225,7 @@ func extractMultiple(traceID, spanID, parentSpanID, sampled, flags string) (trac // Pad 64-bit trace IDs. id = b3TraceIDPadding + traceID } - if sc.TraceID, err = trace.IDFromHex(id); err != nil { + if sc.TraceID, err = trace.TraceIDFromHex(id); err != nil { return empty, errInvalidTraceIDHeader } } @@ -290,7 +290,7 @@ func extractSingle(contextHeader string) (trace.SpanContext, error) { return empty, errInvalidTraceIDValue } var err error - sc.TraceID, err = trace.IDFromHex(traceID) + sc.TraceID, err = trace.TraceIDFromHex(traceID) if err != nil { return empty, errInvalidTraceIDValue } diff --git a/propagators/b3/b3_propagator_test.go b/propagators/b3/b3_propagator_test.go index 3ffa22585c0..86d5ca22e56 100644 --- a/propagators/b3/b3_propagator_test.go +++ b/propagators/b3/b3_propagator_test.go @@ -19,11 +19,11 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/trace" ) var ( - traceID = trace.ID{0, 0, 0, 0, 0, 0, 0, 0x7b, 0, 0, 0, 0, 0, 0, 0x1, 0xc8} + traceID = trace.TraceID{0, 0, 0, 0, 0, 0, 0, 0x7b, 0, 0, 0, 0, 0, 0, 0x1, 0xc8} traceIDStr = "000000000000007b00000000000001c8" spanID = trace.SpanID{0, 0, 0, 0, 0, 0, 0, 0x7b} spanIDStr = "000000000000007b" @@ -116,7 +116,7 @@ func TestExtractMultiple(t *testing.T) { { "00000000000001c8", spanIDStr, "", "0", "", trace.SpanContext{ - TraceID: trace.ID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1, 0xc8}, + TraceID: trace.TraceID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1, 0xc8}, SpanID: spanID, }, nil, @@ -223,7 +223,7 @@ func TestExtractSingle(t *testing.T) { { "00000000000001c8-000000000000007b", trace.SpanContext{ - TraceID: trace.ID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1, 0xc8}, + TraceID: trace.TraceID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1, 0xc8}, SpanID: spanID, TraceFlags: trace.FlagsDeferred, }, diff --git a/propagators/go.mod b/propagators/go.mod index 8ab28e3d55c..9c2a3cff7a4 100644 --- a/propagators/go.mod +++ b/propagators/go.mod @@ -5,7 +5,7 @@ go 1.14 replace go.opentelemetry.io/contrib => ./.. require ( - github.com/google/go-cmp v0.5.2 + github.com/google/go-cmp v0.5.3 github.com/stretchr/testify v1.6.1 - go.opentelemetry.io/otel v0.13.0 + go.opentelemetry.io/otel v0.14.0 ) diff --git a/propagators/go.sum b/propagators/go.sum index 3c2067cd595..3f628996f99 100644 --- a/propagators/go.sum +++ b/propagators/go.sum @@ -1,14 +1,14 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA= -go.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY= +go.opentelemetry.io/otel v0.14.0 h1:YFBEfjCk9MTjaytCNSUkp9Q8lF7QJezA06T71FbQxLQ= +go.opentelemetry.io/otel v0.14.0/go.mod h1:vH5xEuwy7Rts0GNtsCW3HYQoZDY+OmBJ6t1bFGGlxgw= 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_data_test.go b/propagators/jaeger/jaeger_data_test.go index f5f7946feaf..01ede3da2c8 100644 --- a/propagators/jaeger/jaeger_data_test.go +++ b/propagators/jaeger/jaeger_data_test.go @@ -17,7 +17,7 @@ package jaeger_test import ( "fmt" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/trace" ) const ( @@ -28,8 +28,8 @@ const ( ) var ( - traceID16 = trace.ID{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0xce, 0x92, 0x9d, 0x0e, 0x0e, 0x47, 0x36} - traceID32 = trace.ID{0xa1, 0xce, 0x92, 0x9d, 0x0e, 0x0e, 0x47, 0x36, 0xa3, 0xce, 0x92, 0x9d, 0x0e, 0x0e, 0x47, 0x36} + 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} ) diff --git a/propagators/jaeger/jaeger_example_test.go b/propagators/jaeger/jaeger_example_test.go index 1db824b109f..7d950c19fbf 100644 --- a/propagators/jaeger/jaeger_example_test.go +++ b/propagators/jaeger/jaeger_example_test.go @@ -16,11 +16,11 @@ package jaeger_test import ( "go.opentelemetry.io/contrib/propagators/jaeger" - "go.opentelemetry.io/otel/api/global" + "go.opentelemetry.io/otel" ) func ExampleJaeger() { jaeger := jaeger.Jaeger{} // register jaeger propagator - global.SetTextMapPropagator(jaeger) + otel.SetTextMapPropagator(jaeger) } diff --git a/propagators/jaeger/jaeger_integration_test.go b/propagators/jaeger/jaeger_integration_test.go index 4d8df4b0ef8..ba3e71ea7ba 100644 --- a/propagators/jaeger/jaeger_integration_test.go +++ b/propagators/jaeger/jaeger_integration_test.go @@ -22,12 +22,12 @@ import ( "github.com/google/go-cmp/cmp" "go.opentelemetry.io/contrib/propagators/jaeger" - "go.opentelemetry.io/otel/api/trace" - "go.opentelemetry.io/otel/api/trace/tracetest" + "go.opentelemetry.io/otel/oteltest" + "go.opentelemetry.io/otel/trace" ) var ( - mockTracer = tracetest.NewTracerProvider().Tracer("") + mockTracer = oteltest.NewTracerProvider().Tracer("") _, mockSpan = mockTracer.Start(context.Background(), "") ) diff --git a/propagators/jaeger/jaeger_propagator.go b/propagators/jaeger/jaeger_propagator.go index 4c9809209b6..a175a5d0214 100644 --- a/propagators/jaeger/jaeger_propagator.go +++ b/propagators/jaeger/jaeger_propagator.go @@ -21,8 +21,8 @@ import ( "strconv" "strings" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" ) const ( @@ -42,7 +42,7 @@ const ( ) var ( - empty = trace.EmptySpanContext() + empty = trace.SpanContext{} errMalformedTraceContextVal = errors.New("header value of uber-trace-id should contain four different part separated by : ") errInvalidTraceIDLength = errors.New("invalid trace id length, must be either 16 or 32") @@ -59,11 +59,11 @@ var ( // uber-trace-id: {trace-id}:{span-id}:{parent-span-id}:{flags} type Jaeger struct{} -var _ otel.TextMapPropagator = &Jaeger{} +var _ propagation.TextMapPropagator = &Jaeger{} // Inject injects a context to the carrier following jaeger format. // The parent span ID is set to an dummy parent span id as the most implementations do. -func (jaeger Jaeger) Inject(ctx context.Context, carrier otel.TextMapCarrier) { +func (jaeger Jaeger) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { sc := trace.SpanFromContext(ctx).SpanContext() headers := []string{} if !sc.TraceID.IsValid() || !sc.SpanID.IsValid() { @@ -82,7 +82,7 @@ func (jaeger Jaeger) Inject(ctx context.Context, carrier otel.TextMapCarrier) { } // Extract extracts a context from the carrier if it contains Jaeger headers. -func (jaeger Jaeger) Extract(ctx context.Context, carrier otel.TextMapCarrier) context.Context { +func (jaeger Jaeger) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { // extract tracing information if h := carrier.Get(jaegerHeader); h != "" { sc, err := extract(h) @@ -115,7 +115,7 @@ func extract(headerVal string) (trace.SpanContext, error) { if len(id) == traceID64bitsWidth { id = traceIDPadding + id } - sc.TraceID, err = trace.IDFromHex(id) + sc.TraceID, err = trace.TraceIDFromHex(id) if err != nil { return empty, errMalformedTraceID } diff --git a/propagators/jaeger/jaeger_propagator_test.go b/propagators/jaeger/jaeger_propagator_test.go index 7bbcc74ab07..e0554aa22e1 100644 --- a/propagators/jaeger/jaeger_propagator_test.go +++ b/propagators/jaeger/jaeger_propagator_test.go @@ -21,11 +21,11 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/api/trace" + "go.opentelemetry.io/otel/trace" ) var ( - traceID = trace.ID{0, 0, 0, 0, 0, 0, 0, 0, 0x7b, 0, 0, 0, 0, 0, 0x1, 0xc8} + traceID = trace.TraceID{0, 0, 0, 0, 0, 0, 0, 0, 0x7b, 0, 0, 0, 0, 0, 0x1, 0xc8} traceID128Str = "00000000000000007b000000000001c8" zeroTraceIDStr = "00000000000000000000000000000000" traceID64Str = "7b000000000001c8"