diff --git a/cmd/containerd/command/main.go b/cmd/containerd/command/main.go index 82d54eab9..73676d8a6 100644 --- a/cmd/containerd/command/main.go +++ b/cmd/containerd/command/main.go @@ -35,6 +35,7 @@ import ( "github.com/containerd/containerd/services/server" srvconfig "github.com/containerd/containerd/services/server/config" "github.com/containerd/containerd/sys" + "github.com/containerd/containerd/tracing" "github.com/containerd/containerd/version" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/go.mod b/go.mod index 3af0334fb..a8566c985 100644 --- a/go.mod +++ b/go.mod @@ -56,10 +56,10 @@ require ( github.com/urfave/cli v1.22.2 go.etcd.io/bbolt v1.3.6 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.21.0 - go.opentelemetry.io/otel v1.0.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0 - go.opentelemetry.io/otel/sdk v1.0.0 - go.opentelemetry.io/otel/trace v1.0.0 + go.opentelemetry.io/otel v1.0.0-RC2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0-RC2 + go.opentelemetry.io/otel/sdk v1.0.0-RC2 + go.opentelemetry.io/otel/trace v1.0.0-RC2 golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c diff --git a/go.sum b/go.sum index b46a69f00..6f3f336f7 100644 --- a/go.sum +++ b/go.sum @@ -579,27 +579,27 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.2 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4= go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= go.opentelemetry.io/otel v1.0.0-RC1/go.mod h1:x9tRa9HK4hSSq7jf2TKbqFbtt58/TGk0f9XiEYISI1I= -go.opentelemetry.io/otel v1.0.0 h1:qTTn6x71GVBvoafHK/yaRUmFzI4LcONZD0/kXxl5PHI= -go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnfmS4cg= +go.opentelemetry.io/otel v1.0.0-RC2 h1:SHhxSjB+omnGZPgGlKe+QMp3MyazcOHdQ8qwo89oKbg= +go.opentelemetry.io/otel v1.0.0-RC2/go.mod h1:w1thVQ7qbAy8MHb0IFj8a5Q2QU0l2ksf8u/CN8m3NOM= go.opentelemetry.io/otel/exporters/otlp v0.20.0 h1:PTNgq9MRmQqqJY0REVbZFvwkYOA85vbdQU/nVfxDyqg= go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0 h1:Vv4wbLEjheCTPV07jEav7fyUpJkyftQK7Ss2G7qgdSo= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0/go.mod h1:3VqVbIbjAycfL1C7sIu/Uh/kACIUPWHztt8ODYwR3oM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0 h1:B9VtEB1u41Ohnl8U6rMCh1jjedu8HwFh4D0QeB+1N+0= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0/go.mod h1:zhEt6O5GGJ3NCAICr4hlCPoDb2GQuh4Obb4gZBgkoQQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0-RC2 h1:Z/91DSYkOqnVuECrd+hxCU9lzeo5Fihjp28uq0Izfpw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0-RC2/go.mod h1:T+s8GKi1OqMwPuZ+ouDtZW4vWYpJuzIzh2Matq4Jo9k= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0-RC2 h1:PaSlrCE+hRbamroLGGgFDmzDamCxp7ID+hBvPmOhcSc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0-RC2/go.mod h1:3shayJIFcDqHi9/GT2fAHyMI/bRgc6FO0CAkhaDkhi0= go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= go.opentelemetry.io/otel/oteltest v1.0.0-RC1 h1:G685iP3XiskCwk/z0eIabL55XUl2gk0cljhGk9sB0Yk= go.opentelemetry.io/otel/oteltest v1.0.0-RC1/go.mod h1:+eoIG0gdEOaPNftuy1YScLr1Gb4mL/9lpDkZ0JjMRq4= go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= -go.opentelemetry.io/otel/sdk v1.0.0 h1:BNPMYUONPNbLneMttKSjQhOTlFLOD9U22HNG1KrIN2Y= -go.opentelemetry.io/otel/sdk v1.0.0/go.mod h1:PCrDHlSy5x1kjezSdL37PhbFUMjrsLRshJ2zCzeXwbM= +go.opentelemetry.io/otel/sdk v1.0.0-RC2 h1:ROuteeSCBaZNjiT9JcFzZepmInDvLktR28Y6qKo8bCs= +go.opentelemetry.io/otel/sdk v1.0.0-RC2/go.mod h1:fgwHyiDn4e5k40TD9VX243rOxXR+jzsWBZYA2P5jpEw= go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE= go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE= go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= go.opentelemetry.io/otel/trace v1.0.0-RC1/go.mod h1:86UHmyHWFEtWjfWPSbu0+d0Pf9Q6e1U+3ViBOc+NXAg= -go.opentelemetry.io/otel/trace v1.0.0 h1:TSBr8GTEtKevYMG/2d21M989r5WJYVimhTHBKVEZuh4= -go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs= +go.opentelemetry.io/otel/trace v1.0.0-RC2 h1:dunAP0qDULMIT82atj34m5RgvsIK6LcsXf1c/MsYg1w= +go.opentelemetry.io/otel/trace v1.0.0-RC2/go.mod h1:JPQ+z6nNw9mqEGT8o3eoPTdnNI+Aj5JcxEsVGREIAy4= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.9.0 h1:C0g6TWmQYvjKRnljRULLWUVJGy8Uvu0NEL/5frY2/t4= go.opentelemetry.io/proto/otlp v0.9.0/go.mod h1:1vKfU9rv61e9EVGthD1zNvUbiwPcimSsOPU9brfSHJg= @@ -860,6 +860,7 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/integration/client/go.sum b/integration/client/go.sum index 9a0963396..ab4f30bf3 100644 --- a/integration/client/go.sum +++ b/integration/client/go.sum @@ -535,20 +535,20 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.2 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4= go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= go.opentelemetry.io/otel v1.0.0-RC1/go.mod h1:x9tRa9HK4hSSq7jf2TKbqFbtt58/TGk0f9XiEYISI1I= -go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnfmS4cg= +go.opentelemetry.io/otel v1.0.0-RC2/go.mod h1:w1thVQ7qbAy8MHb0IFj8a5Q2QU0l2ksf8u/CN8m3NOM= go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0/go.mod h1:3VqVbIbjAycfL1C7sIu/Uh/kACIUPWHztt8ODYwR3oM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0/go.mod h1:zhEt6O5GGJ3NCAICr4hlCPoDb2GQuh4Obb4gZBgkoQQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0-RC2/go.mod h1:T+s8GKi1OqMwPuZ+ouDtZW4vWYpJuzIzh2Matq4Jo9k= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0-RC2/go.mod h1:3shayJIFcDqHi9/GT2fAHyMI/bRgc6FO0CAkhaDkhi0= go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= go.opentelemetry.io/otel/oteltest v1.0.0-RC1/go.mod h1:+eoIG0gdEOaPNftuy1YScLr1Gb4mL/9lpDkZ0JjMRq4= go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= -go.opentelemetry.io/otel/sdk v1.0.0/go.mod h1:PCrDHlSy5x1kjezSdL37PhbFUMjrsLRshJ2zCzeXwbM= +go.opentelemetry.io/otel/sdk v1.0.0-RC2/go.mod h1:fgwHyiDn4e5k40TD9VX243rOxXR+jzsWBZYA2P5jpEw= go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE= go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE= go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= go.opentelemetry.io/otel/trace v1.0.0-RC1/go.mod h1:86UHmyHWFEtWjfWPSbu0+d0Pf9Q6e1U+3ViBOc+NXAg= -go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs= +go.opentelemetry.io/otel/trace v1.0.0-RC2/go.mod h1:JPQ+z6nNw9mqEGT8o3eoPTdnNI+Aj5JcxEsVGREIAy4= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.9.0/go.mod h1:1vKfU9rv61e9EVGthD1zNvUbiwPcimSsOPU9brfSHJg= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -804,6 +804,7 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/vendor/go.opentelemetry.io/otel/.gitignore b/vendor/go.opentelemetry.io/otel/.gitignore index 759cf53e0..f798ce8fb 100644 --- a/vendor/go.opentelemetry.io/otel/.gitignore +++ b/vendor/go.opentelemetry.io/otel/.gitignore @@ -10,7 +10,6 @@ coverage.* gen/ -/example/fib/fib /example/jaeger/jaeger /example/namedtracer/namedtracer /example/opencensus/opencensus diff --git a/vendor/go.opentelemetry.io/otel/CHANGELOG.md b/vendor/go.opentelemetry.io/otel/CHANGELOG.md index 2cb46459c..aee8a03a3 100644 --- a/vendor/go.opentelemetry.io/otel/CHANGELOG.md +++ b/vendor/go.opentelemetry.io/otel/CHANGELOG.md @@ -8,86 +8,21 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] -### Changed - -- NoopMeterProvider is now private and NewNoopMeterProvider must be used to obtain a noopMeterProvider. (#2237) - -## [1.0.0] - 2021-09-20 - -This is the first stable release for the project. -This release includes an API and SDK for the tracing signal that will comply with the stability guarantees defined by the projects [versioning policy](./VERSIONING.md). - ### Added -- OTLP trace exporter now sets the `SchemaURL` field in the exported telemetry if the Tracer has `WithSchemaURL` option. (#2242) - -### Fixed - -- Slice-valued attributes can correctly be used as map keys. (#2223) - -### Removed - -- Removed the `"go.opentelemetry.io/otel/exporters/zipkin".WithSDKOptions` function. (#2248) -- Removed the deprecated package `go.opentelemetry.io/otel/oteltest`. (#2234) -- Removed the deprecated package `go.opentelemetry.io/otel/bridge/opencensus/utils`. (#2233) -- Removed deprecated functions, types, and methods from `go.opentelemetry.io/otel/attribute` package. - Use the typed functions and methods added to the package instead. (#2235) - - The `Key.Array` method is removed. - - The `Array` function is removed. - - The `Any` function is removed. - - The `ArrayValue` function is removed. - - The `AsArray` function is removed. - -## [1.0.0-RC3] - 2021-09-02 - -### Added - -- Added `ErrorHandlerFunc` to use a function as an `"go.opentelemetry.io/otel".ErrorHandler`. (#2149) -- Added `"go.opentelemetry.io/otel/trace".WithStackTrace` option to add a stack trace when using `span.RecordError` or when panic is handled in `span.End`. (#2163) -- Added typed slice attribute types and functionality to the `go.opentelemetry.io/otel/attribute` package to replace the existing array type and functions. (#2162) - - `BoolSlice`, `IntSlice`, `Int64Slice`, `Float64Slice`, and `StringSlice` replace the use of the `Array` function in the package. -- Added the `go.opentelemetry.io/otel/example/fib` example package. - Included is an example application that computes Fibonacci numbers. (#2203) - ### Changed -- Metric instruments have been renamed to match the (feature-frozen) metric API specification: - - ValueRecorder becomes Histogram - - ValueObserver becomes Gauge - - SumObserver becomes CounterObserver - - UpDownSumObserver becomes UpDownCounterObserver - The API exported from this project is still considered experimental. (#2202) -- Metric SDK/API implementation type `InstrumentKind` moves into `sdkapi` sub-package. (#2091) -- The Metrics SDK export record no longer contains a Resource pointer, the SDK `"go.opentelemetry.io/otel/sdk/trace/export/metric".Exporter.Export()` function for push-based exporters now takes a single Resource argument, pull-based exporters use `"go.opentelemetry.io/otel/sdk/metric/controller/basic".Controller.Resource()`. (#2120) -- The JSON output of the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` is harmonized now such that the output is "plain" JSON objects after each other of the form `{ ... } { ... } { ... }`. Earlier the JSON objects describing a span were wrapped in a slice for each `Exporter.ExportSpans` call, like `[ { ... } ][ { ... } { ... } ]`. Outputting JSON object directly after each other is consistent with JSON loggers, and a bit easier to parse and read. (#2196) -- Update the `NewTracerConfig`, `NewSpanStartConfig`, `NewSpanEndConfig`, and `NewEventConfig` function in the `go.opentelemetry.io/otel/trace` package to return their respective configurations as structs instead of pointers to the struct. (#2212) - ### Deprecated -- The `go.opentelemetry.io/otel/bridge/opencensus/utils` package is deprecated. - All functionality from this package now exists in the `go.opentelemetry.io/otel/bridge/opencensus` package. - The functions from that package should be used instead. (#2166) -- The `"go.opentelemetry.io/otel/attribute".Array` function and the related `ARRAY` value type is deprecated. - Use the typed `*Slice` functions and types added to the package instead. (#2162) -- The `"go.opentelemetry.io/otel/attribute".Any` function is deprecated. - Use the typed functions instead. (#2181) -- The `go.opentelemetry.io/otel/oteltest` package is deprecated. - The `"go.opentelemetry.io/otel/sdk/trace/tracetest".SpanRecorder` can be registered with the default SDK (`go.opentelemetry.io/otel/sdk/trace`) as a `SpanProcessor` and used as a replacement for this deprecated package. (#2188) - ### Removed - Removed metrics test package `go.opentelemetry.io/otel/sdk/export/metric/metrictest`. (#2105) ### Fixed -- The `fromEnv` detector no longer throws an error when `OTEL_RESOURCE_ATTRIBUTES` environment variable is not set or empty. (#2138) -- Setting the global `ErrorHandler` with `"go.opentelemetry.io/otel".SetErrorHandler` multiple times is now supported. (#2160, #2140) -- The `"go.opentelemetry.io/otel/attribute".Any` function now supports `int32` values. (#2169) -- Multiple calls to `"go.opentelemetry.io/otel/sdk/metric/controller/basic".WithResource()` are handled correctly, and when no resources are provided `"go.opentelemetry.io/otel/sdk/resource".Default()` is used. (#2120) -- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly ommit timestamps. (#2195) -- Fixed typos in resources.go. (#2201) +### Security -## [1.0.0-RC2] - 2021-07-26 +## [v1.0.0-RC2] - 2021-07-26 ### Added @@ -99,13 +34,12 @@ This release includes an API and SDK for the tracing signal that will comply wit - Added a new `Link` type under the SDK `otel/sdk/trace` package that counts the number of attributes that were dropped for surpassing the `AttributePerLinkCountLimit` configured in the Span's `SpanLimits`. This new type replaces the equal-named API `Link` type found in the `otel/trace` package for most usages within the SDK. For example, instances of this type are now returned by the `Links()` function of `ReadOnlySpan`s provided in places like the `OnEnd` function of `SpanProcessor` implementations. (#2118) -- Added the `SpanRecorder` type to the `go.opentelemetry.io/otel/skd/trace/tracetest` package. - This type can be used with the default SDK as a `SpanProcessor` during testing. (#2132) ### Changed - The `SpanModels` function is now exported from the `go.opentelemetry.io/otel/exporters/zipkin` package to convert OpenTelemetry spans into Zipkin model spans. (#2027) - Rename the `"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc".RetrySettings` to `RetryConfig`. (#2095) +- Rename the `"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp".RetrySettings` to `RetryConfig`. (#2095) ### Deprecated @@ -132,7 +66,6 @@ This release includes an API and SDK for the tracing signal that will comply wit - The OTel span status is correctly transformed into the OTLP status in the `go.opentelemetry.io/otel/exporters/otlp/otlptrace` package. This fix will by default set the status to `Unset` if it is not explicitly set to `Ok` or `Error`. (#2099 #2102) - The `Inject` method for the `"go.opentelemetry.io/otel/propagation".TraceContext` type no longer injects empty `tracestate` values. (#2108) -- Use `6831` as default Jaeger agent port instead of `6832`. (#2131) ## [Experimental Metrics v0.22.0] - 2021-07-19 @@ -1539,9 +1472,7 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.0.0...HEAD -[1.0.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0 -[1.0.0-RC3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC3 +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.0.0-RC2...HEAD [1.0.0-RC2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC2 [Experimental Metrics v0.22.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.22.0 [1.0.0-RC1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.0.0-RC1 diff --git a/vendor/go.opentelemetry.io/otel/Makefile b/vendor/go.opentelemetry.io/otel/Makefile index d5f52c638..7df5424e2 100644 --- a/vendor/go.opentelemetry.io/otel/Makefile +++ b/vendor/go.opentelemetry.io/otel/Makefile @@ -40,8 +40,8 @@ $(TOOLS)/%: | $(TOOLS) cd $(TOOLS_MOD_DIR) && \ $(GO) build -o $@ $(PACKAGE) -SEMCONVGEN = $(TOOLS)/semconvgen -$(TOOLS)/semconvgen: PACKAGE=go.opentelemetry.io/build-tools/semconvgen +SEMCONVGEN = $(TOOLS)/semconv-gen +$(TOOLS)/semconv-gen: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconv-gen CROSSLINK = $(TOOLS)/crosslink $(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/crosslink @@ -52,16 +52,13 @@ $(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-l MISSPELL = $(TOOLS)/misspell $(TOOLS)/misspell: PACKAGE= github.com/client9/misspell/cmd/misspell -GOCOVMERGE = $(TOOLS)/gocovmerge -$(TOOLS)/gocovmerge: PACKAGE= github.com/wadey/gocovmerge - STRINGER = $(TOOLS)/stringer $(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq .PHONY: tools -tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(TOOLS)/gojq $(SEMCONVGEN) +tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(STRINGER) $(TOOLS)/gojq $(SEMCONVGEN) # Build @@ -114,18 +111,19 @@ test: COVERAGE_MODE = atomic COVERAGE_PROFILE = coverage.out .PHONY: test-coverage -test-coverage: | $(GOCOVMERGE) +test-coverage: @set -e; \ printf "" > coverage.txt; \ for dir in $(ALL_COVERAGE_MOD_DIRS); do \ - echo "$(GO) test -coverpkg=go.opentelemetry.io/otel/... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" $${dir}/..."; \ + echo "$(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" $${dir}/..."; \ (cd "$${dir}" && \ $(GO) list ./... \ | grep -v third_party \ | xargs $(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" && \ $(GO) tool cover -html=coverage.out -o coverage.html); \ + [ -f "$${dir}/coverage.out" ] && cat "$${dir}/coverage.out" >> coverage.txt; \ done; \ - $(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt + sed -i.bak -e '2,$$ { /^mode: /d; }' coverage.txt .PHONY: lint lint: misspell lint-modules | $(GOLANGCI_LINT) diff --git a/vendor/go.opentelemetry.io/otel/README.md b/vendor/go.opentelemetry.io/otel/README.md index d90db542f..8bfac1e2d 100644 --- a/vendor/go.opentelemetry.io/otel/README.md +++ b/vendor/go.opentelemetry.io/otel/README.md @@ -11,13 +11,15 @@ It provides a set of APIs to directly measure performance and behavior of your s ## Project Status -| Signal | Status | Project | -| ------- | ---------- | ------- | -| Traces | Stable | N/A | -| Metrics | Alpha | N/A | -| Logs | Frozen [1] | N/A | +| Signal | Status | Project | +| ------- | ---------------------- | ----------------------------------------------------------- | +| Traces | Release Candidate | [1.0.0](https://github.com/orgs/open-telemetry/projects/15) | +| Metrics | Development paused [1] | N/A | +| Logs | Frozen [2] | N/A | -- [1]: The Logs signal development is halted for this project while we develop both Traces and Metrics. +- [1]: The development of the metrics API and SDK has paused due to limited development resources, prioritization of a stable Traces release, and instability of the official overall design from the OpenTelemetry specification. + Pull Requests for metrics related issues are not being accepted currently outside of security vulnerability mitigations. +- [2]: The Logs signal development is halted for this project while we develop both Traces and Metrics. No Logs Pull Requests are currently being accepted. Progress and status specific to this repository is tracked in our local diff --git a/vendor/go.opentelemetry.io/otel/RELEASING.md b/vendor/go.opentelemetry.io/otel/RELEASING.md index 730436672..215e5c872 100644 --- a/vendor/go.opentelemetry.io/otel/RELEASING.md +++ b/vendor/go.opentelemetry.io/otel/RELEASING.md @@ -3,8 +3,8 @@ ## Semantic Convention Generation If a new version of the OpenTelemetry Specification has been released it will be necessary to generate a new -semantic convention package from the YAML definitions in the specification repository. There is a `semconvgen` utility -installed by `make tools` that can be used to generate the a package with the name matching the specification +semantic convention package from the YAML definitions in the specification repository. There is a utility in +`internal/tools/semconv-gen` that can be used to generate the a package with the name matching the specification version number under the `semconv` package. This will ideally be done soon after the specification release is tagged. Make sure that the specification repo contains a checkout of the the latest tagged release so that the generated files match the released semantic conventions. @@ -12,8 +12,9 @@ generated files match the released semantic conventions. There are currently two categories of semantic conventions that must be generated, `resource` and `trace`. ``` -.tools/semconvgen -i /path/to/specification/repo/semantic_conventions/resource -t semconv/template.j2 -.tools/semconvgen -i /path/to/specification/repo/semantic_conventions/trace -t semconv/template.j2 +cd internal/tools/semconv-gen +go run generator.go -i /path/to/specification/repo/semantic_conventions/resource +go run generator.go -i /path/to/specification/repo/semantic_conventions/trace ``` Using default values for all options other than `input` will result in using the `template.j2` template to diff --git a/vendor/go.opentelemetry.io/otel/VERSIONING.md b/vendor/go.opentelemetry.io/otel/VERSIONING.md index 412f1e362..fba712f62 100644 --- a/vendor/go.opentelemetry.io/otel/VERSIONING.md +++ b/vendor/go.opentelemetry.io/otel/VERSIONING.md @@ -150,10 +150,10 @@ The `otel` package is refactored to remove its dependencies on `otel/metric` so it can be released as stable as well. With that done the following release candidates are made: -* `otel`: `v1.0.0-RC1` -* `otel/trace`: `v1.0.0-RC1` -* `otel/baggage`: `v1.0.0-RC1` -* `otel/sdk/trace`: `v1.0.0-RC1` +* `otel`: `v1.0.0-rc.1` +* `otel/trace`: `v1.0.0-rc.1` +* `otel/baggage`: `v1.0.0-rc.1` +* `otel/sdk/trace`: `v1.0.0-rc.1` The `otel/metric` and `otel/sdk/metric` modules remain at `v0.14.0`. @@ -161,10 +161,10 @@ A few minor issues are discovered in the `otel/trace` package. These issues are resolved with some minor, but backwards incompatible, changes and are released as a second release candidate: -* `otel`: `v1.0.0-RC2` -* `otel/trace`: `v1.0.0-RC2` -* `otel/baggage`: `v1.0.0-RC2` -* `otel/sdk/trace`: `v1.0.0-RC2` +* `otel`: `v1.0.0-rc.2` +* `otel/trace`: `v1.0.0-rc.2` +* `otel/baggage`: `v1.0.0-rc.2` +* `otel/sdk/trace`: `v1.0.0-rc.2` Notice that all module version numbers are incremented to adhere to our versioning policy. @@ -205,12 +205,12 @@ As we progress, the `otel/metric` and `otel/sdk/metric` packages have reached a point where they should be evaluated for stability. The `otel` module is reintegrated with the `otel/metric` package and the following release is made: -* `otel`: `v1.1.0-RC1` -* `otel/trace`: `v1.1.0-RC1` -* `otel/metric`: `v1.1.0-RC1` -* `otel/baggage`: `v1.1.0-RC1` -* `otel/sdk/trace`: `v1.1.0-RC1` -* `otel/sdk/metric`: `v1.1.0-RC1` +* `otel`: `v1.1.0-rc.1` +* `otel/trace`: `v1.1.0-rc.1` +* `otel/metric`: `v1.1.0-rc.1` +* `otel/baggage`: `v1.1.0-rc.1` +* `otel/sdk/trace`: `v1.1.0-rc.1` +* `otel/sdk/metric`: `v1.1.0-rc.1` All the modules are evaluated and determined to a viable stable release. They are then released as version `v1.1.0` (the minor version is incremented to diff --git a/vendor/go.opentelemetry.io/otel/attribute/doc.go b/vendor/go.opentelemetry.io/otel/attribute/doc.go index dafe7424d..42d090052 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/doc.go +++ b/vendor/go.opentelemetry.io/otel/attribute/doc.go @@ -12,5 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package attribute provides key and value attributes. +// package attribute provides key and value attributes. +// +// This package is currently in a Release Candidate phase. Backwards incompatible changes +// may be introduced prior to v1.0.0, but we believe the current API is ready to stabilize. package attribute // import "go.opentelemetry.io/otel/attribute" diff --git a/vendor/go.opentelemetry.io/otel/attribute/key.go b/vendor/go.opentelemetry.io/otel/attribute/key.go index 0656a04e4..492c438a9 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/key.go +++ b/vendor/go.opentelemetry.io/otel/attribute/key.go @@ -20,8 +20,10 @@ type Key string // Bool creates a KeyValue instance with a BOOL Value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Bool(name, value). +// If creating both key and a bool value at the same time, then +// instead of calling Key(name).Bool(value) consider using a +// convenience function provided by the api/key package - +// key.Bool(name, value). func (k Key) Bool(v bool) KeyValue { return KeyValue{ Key: k, @@ -29,43 +31,12 @@ func (k Key) Bool(v bool) KeyValue { } } -// BoolSlice creates a KeyValue instance with a BOOLSLICE Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- BoolSlice(name, value). -func (k Key) BoolSlice(v []bool) KeyValue { - return KeyValue{ - Key: k, - Value: BoolSliceValue(v), - } -} - -// Int creates a KeyValue instance with an INT64 Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Int(name, value). -func (k Key) Int(v int) KeyValue { - return KeyValue{ - Key: k, - Value: IntValue(v), - } -} - -// IntSlice creates a KeyValue instance with an INT64SLICE Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- IntSlice(name, value). -func (k Key) IntSlice(v []int) KeyValue { - return KeyValue{ - Key: k, - Value: IntSliceValue(v), - } -} - // Int64 creates a KeyValue instance with an INT64 Value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Int64(name, value). +// If creating both key and an int64 value at the same time, then +// instead of calling Key(name).Int64(value) consider using a +// convenience function provided by the api/key package - +// key.Int64(name, value). func (k Key) Int64(v int64) KeyValue { return KeyValue{ Key: k, @@ -73,21 +44,12 @@ func (k Key) Int64(v int64) KeyValue { } } -// Int64Slice creates a KeyValue instance with an INT64SLICE Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Int64Slice(name, value). -func (k Key) Int64Slice(v []int64) KeyValue { - return KeyValue{ - Key: k, - Value: Int64SliceValue(v), - } -} - // Float64 creates a KeyValue instance with a FLOAT64 Value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Float64(name, value). +// If creating both key and a float64 value at the same time, then +// instead of calling Key(name).Float64(value) consider using a +// convenience function provided by the api/key package - +// key.Float64(name, value). func (k Key) Float64(v float64) KeyValue { return KeyValue{ Key: k, @@ -95,21 +57,12 @@ func (k Key) Float64(v float64) KeyValue { } } -// Float64Slice creates a KeyValue instance with a FLOAT64SLICE Value. -// -// If creating both a key and value at the same time, use the provided -// convenience function instead -- Float64(name, value). -func (k Key) Float64Slice(v []float64) KeyValue { - return KeyValue{ - Key: k, - Value: Float64SliceValue(v), - } -} - // String creates a KeyValue instance with a STRING Value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- String(name, value). +// If creating both key and a string value at the same time, then +// instead of calling Key(name).String(value) consider using a +// convenience function provided by the api/key package - +// key.String(name, value). func (k Key) String(v string) KeyValue { return KeyValue{ Key: k, @@ -117,14 +70,16 @@ func (k Key) String(v string) KeyValue { } } -// StringSlice creates a KeyValue instance with a STRINGSLICE Value. +// Int creates a KeyValue instance with an INT64 Value. // -// If creating both a key and value at the same time, use the provided -// convenience function instead -- StringSlice(name, value). -func (k Key) StringSlice(v []string) KeyValue { +// If creating both key and an int value at the same time, then +// instead of calling Key(name).Int(value) consider using a +// convenience function provided by the api/key package - +// key.Int(name, value). +func (k Key) Int(v int) KeyValue { return KeyValue{ Key: k, - Value: StringSliceValue(v), + Value: IntValue(v), } } @@ -132,3 +87,16 @@ func (k Key) StringSlice(v []string) KeyValue { func (k Key) Defined() bool { return len(k) != 0 } + +// Array creates a KeyValue instance with a ARRAY Value. +// +// If creating both key and a array value at the same time, then +// instead of calling Key(name).String(value) consider using a +// convenience function provided by the api/key package - +// key.Array(name, value). +func (k Key) Array(v interface{}) KeyValue { + return KeyValue{ + Key: k, + Value: ArrayValue(v), + } +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/kv.go b/vendor/go.opentelemetry.io/otel/attribute/kv.go index 8f5793385..2fcc8863f 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/kv.go +++ b/vendor/go.opentelemetry.io/otel/attribute/kv.go @@ -15,7 +15,9 @@ package attribute // import "go.opentelemetry.io/otel/attribute" import ( + "encoding/json" "fmt" + "reflect" ) // KeyValue holds a key and value pair. @@ -29,58 +31,78 @@ func (kv KeyValue) Valid() bool { return kv.Key != "" && kv.Value.Type() != INVALID } -// Bool creates a KeyValue with a BOOL Value type. +// Bool creates a new key-value pair with a passed name and a bool +// value. func Bool(k string, v bool) KeyValue { return Key(k).Bool(v) } -// BoolSlice creates a KeyValue with a BOOLSLICE Value type. -func BoolSlice(k string, v []bool) KeyValue { - return Key(k).BoolSlice(v) -} - -// Int creates a KeyValue with an INT64 Value type. -func Int(k string, v int) KeyValue { - return Key(k).Int(v) -} - -// IntSlice creates a KeyValue with an INT64SLICE Value type. -func IntSlice(k string, v []int) KeyValue { - return Key(k).IntSlice(v) -} - -// Int64 creates a KeyValue with an INT64 Value type. +// Int64 creates a new key-value pair with a passed name and an int64 +// value. func Int64(k string, v int64) KeyValue { return Key(k).Int64(v) } -// Int64Slice creates a KeyValue with an INT64SLICE Value type. -func Int64Slice(k string, v []int64) KeyValue { - return Key(k).Int64Slice(v) -} - -// Float64 creates a KeyValue with a FLOAT64 Value type. +// Float64 creates a new key-value pair with a passed name and a float64 +// value. func Float64(k string, v float64) KeyValue { return Key(k).Float64(v) } -// Float64Slice creates a KeyValue with a FLOAT64SLICE Value type. -func Float64Slice(k string, v []float64) KeyValue { - return Key(k).Float64Slice(v) -} - -// String creates a KeyValue with a STRING Value type. +// String creates a new key-value pair with a passed name and a string +// value. func String(k, v string) KeyValue { return Key(k).String(v) } -// StringSlice creates a KeyValue with a STRINGSLICE Value type. -func StringSlice(k string, v []string) KeyValue { - return Key(k).StringSlice(v) -} - // Stringer creates a new key-value pair with a passed name and a string // value generated by the passed Stringer interface. func Stringer(k string, v fmt.Stringer) KeyValue { return Key(k).String(v.String()) } + +// Int creates a new key-value pair instance with a passed name and +// either an int32 or an int64 value, depending on whether the int +// type is 32 or 64 bits wide. +func Int(k string, v int) KeyValue { + return Key(k).Int(v) +} + +// Array creates a new key-value pair with a passed name and a array. +// Only arrays of primitive type are supported. +func Array(k string, v interface{}) KeyValue { + return Key(k).Array(v) +} + +// Any creates a new key-value pair instance with a passed name and +// automatic type inference. This is slower, and not type-safe. +func Any(k string, value interface{}) KeyValue { + if value == nil { + return String(k, "") + } + + if stringer, ok := value.(fmt.Stringer); ok { + return String(k, stringer.String()) + } + + rv := reflect.ValueOf(value) + + switch rv.Kind() { + case reflect.Array, reflect.Slice: + return Array(k, value) + case reflect.Bool: + return Bool(k, rv.Bool()) + case reflect.Int, reflect.Int8, reflect.Int16: + return Int(k, int(rv.Int())) + case reflect.Int64: + return Int64(k, rv.Int()) + case reflect.Float64: + return Float64(k, rv.Float()) + case reflect.String: + return String(k, rv.String()) + } + if b, err := json.Marshal(value); b != nil && err == nil { + return String(k, string(b)) + } + return String(k, fmt.Sprint(value)) +} diff --git a/vendor/go.opentelemetry.io/otel/attribute/type_string.go b/vendor/go.opentelemetry.io/otel/attribute/type_string.go index e584b2477..1f2c7dccf 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/type_string.go +++ b/vendor/go.opentelemetry.io/otel/attribute/type_string.go @@ -13,15 +13,12 @@ func _() { _ = x[INT64-2] _ = x[FLOAT64-3] _ = x[STRING-4] - _ = x[BOOLSLICE-5] - _ = x[INT64SLICE-6] - _ = x[FLOAT64SLICE-7] - _ = x[STRINGSLICE-8] + _ = x[ARRAY-5] } -const _Type_name = "INVALIDBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICESTRINGSLICE" +const _Type_name = "INVALIDBOOLINT64FLOAT64STRINGARRAY" -var _Type_index = [...]uint8{0, 7, 11, 16, 23, 29, 38, 48, 60, 71} +var _Type_index = [...]uint8{0, 7, 11, 16, 23, 29, 34} func (i Type) String() string { if i < 0 || i >= Type(len(_Type_index)-1) { diff --git a/vendor/go.opentelemetry.io/otel/attribute/value.go b/vendor/go.opentelemetry.io/otel/attribute/value.go index 545bea50c..7b979409e 100644 --- a/vendor/go.opentelemetry.io/otel/attribute/value.go +++ b/vendor/go.opentelemetry.io/otel/attribute/value.go @@ -17,6 +17,7 @@ package attribute // import "go.opentelemetry.io/otel/attribute" import ( "encoding/json" "fmt" + "reflect" "strconv" "go.opentelemetry.io/otel/internal" @@ -32,7 +33,9 @@ type Value struct { vtype Type numeric uint64 stringly string - slice interface{} + // TODO Lazy value type? + + array interface{} } const ( @@ -46,14 +49,10 @@ const ( FLOAT64 // STRING is a string Type Value. STRING - // BOOLSLICE is a slice of booleans Type Value. - BOOLSLICE - // INT64SLICE is a slice of 64-bit signed integral numbers Type Value. - INT64SLICE - // FLOAT64SLICE is a slice of 64-bit floating point numbers Type Value. - FLOAT64SLICE - // STRINGSLICE is a slice of strings Type Value. - STRINGSLICE + // ARRAY is an array Type Value used to store 1-dimensional slices or + // arrays of bool, int, int32, int64, uint, uint32, uint64, float, + // float32, float64, or string types. + ARRAY ) // BoolValue creates a BOOL Value. @@ -64,33 +63,6 @@ func BoolValue(v bool) Value { } } -// BoolSliceValue creates a BOOLSLICE Value. -func BoolSliceValue(v []bool) Value { - cp := make([]bool, len(v)) - copy(cp, v) - return Value{ - vtype: BOOLSLICE, - slice: &cp, - } -} - -// IntValue creates an INT64 Value. -func IntValue(v int) Value { - return Int64Value(int64(v)) -} - -// IntSliceValue creates an INTSLICE Value. -func IntSliceValue(v []int) Value { - cp := make([]int64, 0, len(v)) - for _, i := range v { - cp = append(cp, int64(i)) - } - return Value{ - vtype: INT64SLICE, - slice: &cp, - } -} - // Int64Value creates an INT64 Value. func Int64Value(v int64) Value { return Value{ @@ -99,16 +71,6 @@ func Int64Value(v int64) Value { } } -// Int64SliceValue creates an INT64SLICE Value. -func Int64SliceValue(v []int64) Value { - cp := make([]int64, len(v)) - copy(cp, v) - return Value{ - vtype: INT64SLICE, - slice: &cp, - } -} - // Float64Value creates a FLOAT64 Value. func Float64Value(v float64) Value { return Value{ @@ -117,16 +79,6 @@ func Float64Value(v float64) Value { } } -// Float64SliceValue creates a FLOAT64SLICE Value. -func Float64SliceValue(v []float64) Value { - cp := make([]float64, len(v)) - copy(cp, v) - return Value{ - vtype: FLOAT64SLICE, - slice: &cp, - } -} - // StringValue creates a STRING Value. func StringValue(v string) Value { return Value{ @@ -135,14 +87,38 @@ func StringValue(v string) Value { } } -// StringSliceValue creates a STRINGSLICE Value. -func StringSliceValue(v []string) Value { - cp := make([]string, len(v)) - copy(cp, v) - return Value{ - vtype: STRINGSLICE, - slice: &cp, +// IntValue creates an INT64 Value. +func IntValue(v int) Value { + return Int64Value(int64(v)) +} + +// ArrayValue creates an ARRAY value from an array or slice. +// Only arrays or slices of bool, int, int64, float, float64, or string types are allowed. +// Specifically, arrays and slices can not contain other arrays, slices, structs, or non-standard +// types. If the passed value is not an array or slice of these types an +// INVALID value is returned. +func ArrayValue(v interface{}) Value { + switch reflect.TypeOf(v).Kind() { + case reflect.Array, reflect.Slice: + // get array type regardless of dimensions + typ := reflect.TypeOf(v).Elem() + kind := typ.Kind() + switch kind { + case reflect.Bool, reflect.Int, reflect.Int64, + reflect.Float64, reflect.String: + val := reflect.ValueOf(v) + length := val.Len() + frozen := reflect.Indirect(reflect.New(reflect.ArrayOf(length, typ))) + reflect.Copy(frozen, val) + return Value{ + vtype: ARRAY, + array: frozen.Interface(), + } + default: + return Value{vtype: INVALID} + } } + return Value{vtype: INVALID} } // Type returns a type of the Value. @@ -156,58 +132,27 @@ func (v Value) AsBool() bool { return internal.RawToBool(v.numeric) } -// AsBoolSlice returns the []bool value. Make sure that the Value's type is -// BOOLSLICE. -func (v Value) AsBoolSlice() []bool { - if s, ok := v.slice.(*[]bool); ok { - return *s - } - return nil -} - // AsInt64 returns the int64 value. Make sure that the Value's type is // INT64. func (v Value) AsInt64() int64 { return internal.RawToInt64(v.numeric) } -// AsInt64Slice returns the []int64 value. Make sure that the Value's type is -// INT64SLICE. -func (v Value) AsInt64Slice() []int64 { - if s, ok := v.slice.(*[]int64); ok { - return *s - } - return nil -} - // AsFloat64 returns the float64 value. Make sure that the Value's // type is FLOAT64. func (v Value) AsFloat64() float64 { return internal.RawToFloat64(v.numeric) } -// AsFloat64Slice returns the []float64 value. Make sure that the Value's type is -// INT64SLICE. -func (v Value) AsFloat64Slice() []float64 { - if s, ok := v.slice.(*[]float64); ok { - return *s - } - return nil -} - // AsString returns the string value. Make sure that the Value's type // is STRING. func (v Value) AsString() string { return v.stringly } -// AsStringSlice returns the []string value. Make sure that the Value's type is -// INT64SLICE. -func (v Value) AsStringSlice() []string { - if s, ok := v.slice.(*[]string); ok { - return *s - } - return nil +// AsArray returns the array Value as an interface{}. +func (v Value) AsArray() interface{} { + return v.array } type unknownValueType struct{} @@ -215,22 +160,16 @@ type unknownValueType struct{} // AsInterface returns Value's data as interface{}. func (v Value) AsInterface() interface{} { switch v.Type() { + case ARRAY: + return v.AsArray() case BOOL: return v.AsBool() - case BOOLSLICE: - return v.AsBoolSlice() case INT64: return v.AsInt64() - case INT64SLICE: - return v.AsInt64Slice() case FLOAT64: return v.AsFloat64() - case FLOAT64SLICE: - return v.AsFloat64Slice() case STRING: return v.stringly - case STRINGSLICE: - return v.AsStringSlice() } return unknownValueType{} } @@ -238,20 +177,14 @@ func (v Value) AsInterface() interface{} { // Emit returns a string representation of Value's data. func (v Value) Emit() string { switch v.Type() { - case BOOLSLICE: - return fmt.Sprint(*(v.slice.(*[]bool))) + case ARRAY: + return fmt.Sprint(v.array) case BOOL: return strconv.FormatBool(v.AsBool()) - case INT64SLICE: - return fmt.Sprint(*(v.slice.(*[]int64))) case INT64: return strconv.FormatInt(v.AsInt64(), 10) - case FLOAT64SLICE: - return fmt.Sprint(*(v.slice.(*[]float64))) case FLOAT64: return fmt.Sprint(v.AsFloat64()) - case STRINGSLICE: - return fmt.Sprint(*(v.slice.(*[]string))) case STRING: return v.stringly default: diff --git a/vendor/go.opentelemetry.io/otel/baggage/doc.go b/vendor/go.opentelemetry.io/otel/baggage/doc.go index 4545100df..188e53f40 100644 --- a/vendor/go.opentelemetry.io/otel/baggage/doc.go +++ b/vendor/go.opentelemetry.io/otel/baggage/doc.go @@ -16,5 +16,8 @@ Package baggage provides functionality for storing and retrieving baggage items in Go context. For propagating the baggage, see the go.opentelemetry.io/otel/propagation package. + +This package is currently in a Release Candidate phase. Backwards incompatible changes +may be introduced prior to v1.0.0, but we believe the current API is ready to stabilize. */ package baggage // import "go.opentelemetry.io/otel/baggage" diff --git a/vendor/go.opentelemetry.io/otel/codes/doc.go b/vendor/go.opentelemetry.io/otel/codes/doc.go index df3e0f1b6..7b60f983c 100644 --- a/vendor/go.opentelemetry.io/otel/codes/doc.go +++ b/vendor/go.opentelemetry.io/otel/codes/doc.go @@ -15,6 +15,9 @@ /* Package codes defines the canonical error codes used by OpenTelemetry. +This package is currently in a Release Candidate phase. Backwards incompatible changes +may be introduced prior to v1.0.0, but we believe the current API is ready to stabilize. + It conforms to [the OpenTelemetry specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#statuscanonicalcode). */ diff --git a/vendor/go.opentelemetry.io/otel/doc.go b/vendor/go.opentelemetry.io/otel/doc.go index daa36c89d..484749420 100644 --- a/vendor/go.opentelemetry.io/otel/doc.go +++ b/vendor/go.opentelemetry.io/otel/doc.go @@ -16,6 +16,9 @@ Package otel provides global access to the OpenTelemetry API. The subpackages of the otel package provide an implementation of the OpenTelemetry API. +This package is currently in a Release Candidate phase. Backwards incompatible changes +may be introduced prior to v1.0.0, but we believe the current API is ready to stabilize. + The provided API is used to instrument code and measure data about that code's performance and operation. The measured data, by default, is not processed or transmitted anywhere. An implementation of the OpenTelemetry SDK, like the diff --git a/vendor/go.opentelemetry.io/otel/error_handler.go b/vendor/go.opentelemetry.io/otel/error_handler.go index 72fad8541..a51b2dee4 100644 --- a/vendor/go.opentelemetry.io/otel/error_handler.go +++ b/vendor/go.opentelemetry.io/otel/error_handler.go @@ -25,14 +25,3 @@ type ErrorHandler interface { // DO NOT CHANGE: any modification will not be backwards compatible and // must never be done outside of a new major release. } - -// ErrorHandlerFunc is a convenience adapter to allow the use of a function -// as an ErrorHandler. -type ErrorHandlerFunc func(error) - -var _ ErrorHandler = ErrorHandlerFunc(nil) - -// Handle handles the irremediable error by calling the ErrorHandlerFunc itself. -func (f ErrorHandlerFunc) Handle(err error) { - f(err) -} diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md deleted file mode 100644 index 451ad6dc4..000000000 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# OpenTelemetry-Go OTLP Span Exporter - -[![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/otlp/otlptrace.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace) - -[OpenTelemetry Protocol Exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.5.0/specification/protocol/exporter.md) implementation. - -## Installation - -``` -go get -u go.opentelemetry.io/otel/exporters/otlp/otlptrace -``` - -## Examples - -- [Exporter setup and examples](./otlptracehttp/example_test.go) -- [Full example sending telemetry to a local collector](../../../example/otel-collector) - -## [`otlptrace`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace) - -The `otlptrace` package provides an exporter implementing the OTel span exporter interface. -This exporter is configured using a client satisfying the `otlptrace.Client` interface. -This client handles the transformation of data into wire format and the transmission of that data to the collector. - -## [`otlptracegrpc`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc) - -The `otlptracegrpc` package implements a client for the span exporter that sends trace telemetry data to the collector using gRPC with protobuf-encoded payloads. - -## [`otlptracehttp`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp) - -The `otlptracehttp` package implements a client for the span exporter that sends trace telemetry data to the collector using HTTP with protobuf-encoded payloads. - -## Configuration - -### Environment Variables - -The following environment variables can be used -(instead of options objects) to override the default configuration. - -| Environment variable | Option | Default value | -| ------------------------------------------------------------------------ |------------------------------ | ----------------------------------- | -| `OTEL_EXPORTER_OTLP_ENDPOINT` `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | `WithEndpoint` `WithInsecure` | `https://localhost:4317` | -| `OTEL_EXPORTER_OTLP_CERTIFICATE` `OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE` | `WithTLSClientConfig` | | -| `OTEL_EXPORTER_OTLP_HEADERS` `OTEL_EXPORTER_OTLP_TRACES_HEADERS` | `WithHeaders` | | -| `OTEL_EXPORTER_OTLP_COMPRESSION` `OTEL_EXPORTER_OTLP_TRACES_COMPRESSION` | `WithCompression` | | -| `OTEL_EXPORTER_OTLP_TIMEOUT` `OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` | `WithTimeout` | `10s` | - -Configuration using options have precedence over the environment variables. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/go.mod b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/go.mod index def4b562b..a36b66117 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/go.mod +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/go.mod @@ -6,12 +6,12 @@ require ( github.com/cenkalti/backoff/v4 v4.1.1 github.com/google/go-cmp v0.5.6 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.0.0 - go.opentelemetry.io/otel/sdk v1.0.0 - go.opentelemetry.io/otel/trace v1.0.0 + go.opentelemetry.io/otel v1.0.0-RC2 + go.opentelemetry.io/otel/sdk v1.0.0-RC2 + go.opentelemetry.io/otel/trace v1.0.0-RC2 go.opentelemetry.io/proto/otlp v0.9.0 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 - google.golang.org/grpc v1.40.0 + google.golang.org/grpc v1.39.0 google.golang.org/protobuf v1.27.1 ) @@ -21,6 +21,8 @@ replace go.opentelemetry.io/otel/sdk => ../../../sdk replace go.opentelemetry.io/otel/metric => ../../../metric +replace go.opentelemetry.io/otel/oteltest => ../../../oteltest + replace go.opentelemetry.io/otel/trace => ../../../trace replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus @@ -72,7 +74,3 @@ replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../stdout/s replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../stdout/stdouttrace replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../../example/fib diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/go.sum b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/go.sum index 5b952dd70..b366899d9 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/go.sum +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/go.sum @@ -1,12 +1,10 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.1.1 h1:G2HAfAmvm/GcKan2oOQpBXOd2tT2G57ZnZGWa1PxPBQ= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -52,7 +50,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= @@ -109,8 +106,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.39.0 h1:Klz8I9kdtkIN6EpHHUOMLCYhTn/2WAe5a0s1hcBkdTI= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go index 0ec2c879e..a97c880a4 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig/options.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/internal/otlpconfig" import ( "crypto/tls" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go index 01579fac7..2bf8ccecc 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go @@ -15,145 +15,127 @@ package tracetransform import ( + "reflect" + "go.opentelemetry.io/otel/attribute" commonpb "go.opentelemetry.io/proto/otlp/common/v1" "go.opentelemetry.io/otel/sdk/resource" ) -// KeyValues transforms a slice of attribute KeyValues into OTLP key-values. -func KeyValues(attrs []attribute.KeyValue) []*commonpb.KeyValue { +// Attributes transforms a slice of KeyValues into a slice of OTLP attribute key-values. +func Attributes(attrs []attribute.KeyValue) []*commonpb.KeyValue { if len(attrs) == 0 { return nil } out := make([]*commonpb.KeyValue, 0, len(attrs)) for _, kv := range attrs { - out = append(out, KeyValue(kv)) + out = append(out, toAttribute(kv)) } return out } -// Iterator transforms an attribute iterator into OTLP key-values. -func Iterator(iter attribute.Iterator) []*commonpb.KeyValue { - l := iter.Len() - if l == 0 { +// ResourceAttributes transforms a Resource into a slice of OTLP attribute key-values. +func ResourceAttributes(resource *resource.Resource) []*commonpb.KeyValue { + if resource.Len() == 0 { return nil } - out := make([]*commonpb.KeyValue, 0, l) - for iter.Next() { - out = append(out, KeyValue(iter.Attribute())) + out := make([]*commonpb.KeyValue, 0, resource.Len()) + for iter := resource.Iter(); iter.Next(); { + out = append(out, toAttribute(iter.Attribute())) } + return out } -// ResourceAttributes transforms a Resource OTLP key-values. -func ResourceAttributes(resource *resource.Resource) []*commonpb.KeyValue { - return Iterator(resource.Iter()) -} - -// KeyValue transforms an attribute KeyValue into an OTLP key-value. -func KeyValue(kv attribute.KeyValue) *commonpb.KeyValue { - return &commonpb.KeyValue{Key: string(kv.Key), Value: Value(kv.Value)} -} - -// Value transforms an attribute Value into an OTLP AnyValue. -func Value(v attribute.Value) *commonpb.AnyValue { - av := new(commonpb.AnyValue) - switch v.Type() { +func toAttribute(v attribute.KeyValue) *commonpb.KeyValue { + result := &commonpb.KeyValue{ + Key: string(v.Key), + Value: new(commonpb.AnyValue), + } + switch v.Value.Type() { case attribute.BOOL: - av.Value = &commonpb.AnyValue_BoolValue{ - BoolValue: v.AsBool(), - } - case attribute.BOOLSLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: boolSliceValues(v.AsBoolSlice()), - }, + result.Value.Value = &commonpb.AnyValue_BoolValue{ + BoolValue: v.Value.AsBool(), } case attribute.INT64: - av.Value = &commonpb.AnyValue_IntValue{ - IntValue: v.AsInt64(), - } - case attribute.INT64SLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: int64SliceValues(v.AsInt64Slice()), - }, + result.Value.Value = &commonpb.AnyValue_IntValue{ + IntValue: v.Value.AsInt64(), } case attribute.FLOAT64: - av.Value = &commonpb.AnyValue_DoubleValue{ - DoubleValue: v.AsFloat64(), - } - case attribute.FLOAT64SLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: float64SliceValues(v.AsFloat64Slice()), - }, + result.Value.Value = &commonpb.AnyValue_DoubleValue{ + DoubleValue: v.Value.AsFloat64(), } case attribute.STRING: - av.Value = &commonpb.AnyValue_StringValue{ - StringValue: v.AsString(), + result.Value.Value = &commonpb.AnyValue_StringValue{ + StringValue: v.Value.AsString(), } - case attribute.STRINGSLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ + case attribute.ARRAY: + result.Value.Value = &commonpb.AnyValue_ArrayValue{ ArrayValue: &commonpb.ArrayValue{ - Values: stringSliceValues(v.AsStringSlice()), + Values: arrayValues(v), }, } default: - av.Value = &commonpb.AnyValue_StringValue{ + result.Value.Value = &commonpb.AnyValue_StringValue{ StringValue: "INVALID", } } - return av + return result } -func boolSliceValues(vals []bool) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_BoolValue{ - BoolValue: v, - }, +func arrayValues(kv attribute.KeyValue) []*commonpb.AnyValue { + a := kv.Value.AsArray() + aType := reflect.TypeOf(a) + var valueFunc func(reflect.Value) *commonpb.AnyValue + switch aType.Elem().Kind() { + case reflect.Bool: + valueFunc = func(v reflect.Value) *commonpb.AnyValue { + return &commonpb.AnyValue{ + Value: &commonpb.AnyValue_BoolValue{ + BoolValue: v.Bool(), + }, + } + } + case reflect.Int, reflect.Int64: + valueFunc = func(v reflect.Value) *commonpb.AnyValue { + return &commonpb.AnyValue{ + Value: &commonpb.AnyValue_IntValue{ + IntValue: v.Int(), + }, + } + } + case reflect.Uintptr: + valueFunc = func(v reflect.Value) *commonpb.AnyValue { + return &commonpb.AnyValue{ + Value: &commonpb.AnyValue_IntValue{ + IntValue: int64(v.Uint()), + }, + } + } + case reflect.Float64: + valueFunc = func(v reflect.Value) *commonpb.AnyValue { + return &commonpb.AnyValue{ + Value: &commonpb.AnyValue_DoubleValue{ + DoubleValue: v.Float(), + }, + } + } + case reflect.String: + valueFunc = func(v reflect.Value) *commonpb.AnyValue { + return &commonpb.AnyValue{ + Value: &commonpb.AnyValue_StringValue{ + StringValue: v.String(), + }, + } } } - return converted -} -func int64SliceValues(vals []int64) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_IntValue{ - IntValue: v, - }, - } + results := make([]*commonpb.AnyValue, aType.Len()) + for i, aValue := 0, reflect.ValueOf(a); i < aValue.Len(); i++ { + results[i] = valueFunc(aValue.Index(i)) } - return converted -} - -func float64SliceValues(vals []float64) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_DoubleValue{ - DoubleValue: v, - }, - } - } - return converted -} - -func stringSliceValues(vals []string) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_StringValue{ - StringValue: v, - }, - } - } - return converted + return results } diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go index adbba7755..d9f083109 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go @@ -60,7 +60,6 @@ func Spans(sdl []tracesdk.ReadOnlySpan) []*tracepb.ResourceSpans { ils = &tracepb.InstrumentationLibrarySpans{ InstrumentationLibrary: InstrumentationLibrary(sd.InstrumentationLibrary()), Spans: []*tracepb.Span{}, - SchemaUrl: sd.InstrumentationLibrary().SchemaURL, } } ils.Spans = append(ils.Spans, span(sd)) @@ -73,7 +72,6 @@ func Spans(sdl []tracesdk.ReadOnlySpan) []*tracepb.ResourceSpans { rs = &tracepb.ResourceSpans{ Resource: Resource(sd.Resource()), InstrumentationLibrarySpans: []*tracepb.InstrumentationLibrarySpans{ils}, - SchemaUrl: sd.Resource().SchemaURL(), } rsm[rKey] = rs continue @@ -116,7 +114,7 @@ func span(sd tracesdk.ReadOnlySpan) *tracepb.Span { Links: links(sd.Links()), Kind: spanKind(sd.SpanKind()), Name: sd.Name(), - Attributes: KeyValues(sd.Attributes()), + Attributes: Attributes(sd.Attributes()), Events: spanEvents(sd.Events()), DroppedAttributesCount: uint32(sd.DroppedAttributes()), DroppedEventsCount: uint32(sd.DroppedEvents()), @@ -165,7 +163,7 @@ func links(links []tracesdk.Link) []*tracepb.Span_Link { sl = append(sl, &tracepb.Span_Link{ TraceId: tid[:], SpanId: sid[:], - Attributes: KeyValues(otLink.Attributes), + Attributes: Attributes(otLink.Attributes), }) } return sl @@ -194,7 +192,7 @@ func spanEvents(es []tracesdk.Event) []*tracepb.Span_Event { &tracepb.Span_Event{ Name: e.Name, TimeUnixNano: uint64(e.Time.UnixNano()), - Attributes: KeyValues(e.Attributes), + Attributes: Attributes(e.Attributes), // TODO (rghetia) : Add Drop Counts when supported. }, ) diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 8654b2b4e..2a93bfd6d 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,11 +4,11 @@ go 1.15 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.0.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0 - go.opentelemetry.io/otel/sdk v1.0.0 + go.opentelemetry.io/otel v1.0.0-RC2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0-RC2 + go.opentelemetry.io/otel/sdk v1.0.0-RC2 go.opentelemetry.io/proto/otlp v0.9.0 - google.golang.org/grpc v1.40.0 + google.golang.org/grpc v1.39.0 ) replace go.opentelemetry.io/otel => ../../../.. @@ -19,6 +19,8 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../ replace go.opentelemetry.io/otel/metric => ../../../../metric +replace go.opentelemetry.io/otel/oteltest => ../../../../oteltest + replace go.opentelemetry.io/otel/trace => ../../../../trace replace go.opentelemetry.io/otel/bridge/opencensus => ../../../../bridge/opencensus @@ -68,7 +70,3 @@ replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../../stdou replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../../stdout/stdouttrace replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../../../example/fib diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 5b952dd70..b366899d9 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -1,12 +1,10 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.1.1 h1:G2HAfAmvm/GcKan2oOQpBXOd2tT2G57ZnZGWa1PxPBQ= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -52,7 +50,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= @@ -109,8 +106,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.39.0 h1:Klz8I9kdtkIN6EpHHUOMLCYhTn/2WAe5a0s1hcBkdTI= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/vendor/go.opentelemetry.io/otel/go.mod b/vendor/go.opentelemetry.io/otel/go.mod index 447addf6b..e2bc6d30a 100644 --- a/vendor/go.opentelemetry.io/otel/go.mod +++ b/vendor/go.opentelemetry.io/otel/go.mod @@ -5,7 +5,7 @@ go 1.15 require ( github.com/google/go-cmp v0.5.6 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel/trace v1.0.0 + go.opentelemetry.io/otel/trace v1.0.0-RC2 ) replace go.opentelemetry.io/otel => ./ @@ -42,6 +42,8 @@ replace go.opentelemetry.io/otel/internal/metric => ./internal/metric replace go.opentelemetry.io/otel/metric => ./metric +replace go.opentelemetry.io/otel/oteltest => ./oteltest + replace go.opentelemetry.io/otel/sdk/export/metric => ./sdk/export/metric replace go.opentelemetry.io/otel/sdk/metric => ./sdk/metric @@ -65,7 +67,3 @@ replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ./exporters/st replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ./exporters/stdout/stdouttrace replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ./exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ./bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ./example/fib diff --git a/vendor/go.opentelemetry.io/otel/handler.go b/vendor/go.opentelemetry.io/otel/handler.go index 238f9de12..27e1caa30 100644 --- a/vendor/go.opentelemetry.io/otel/handler.go +++ b/vendor/go.opentelemetry.io/otel/handler.go @@ -26,42 +26,36 @@ var ( // throughout an OpenTelemetry instrumented project. When a user // specified ErrorHandler is registered (`SetErrorHandler`) all calls to // `Handle` and will be delegated to the registered ErrorHandler. - globalErrorHandler = defaultErrorHandler() + globalErrorHandler = &loggingErrorHandler{ + l: log.New(os.Stderr, "", log.LstdFlags), + } // delegateErrorHandlerOnce ensures that a user provided ErrorHandler is // only ever registered once. delegateErrorHandlerOnce sync.Once - // Compile-time check that delegator implements ErrorHandler. - _ ErrorHandler = (*delegator)(nil) + // Comiple time check that loggingErrorHandler implements ErrorHandler. + _ ErrorHandler = (*loggingErrorHandler)(nil) ) -type holder struct { - eh ErrorHandler -} - -func defaultErrorHandler() *atomic.Value { - v := &atomic.Value{} - v.Store(holder{eh: &delegator{l: log.New(os.Stderr, "", log.LstdFlags)}}) - return v -} - -// delegator logs errors if no delegate is set, otherwise they are delegated. -type delegator struct { +// loggingErrorHandler logs all errors to STDERR. +type loggingErrorHandler struct { delegate atomic.Value l *log.Logger } -// setDelegate sets the ErrorHandler delegate. -func (h *delegator) setDelegate(d ErrorHandler) { - // It is critical this is guarded with delegateErrorHandlerOnce, if it is - // called again with a different concrete type it will panic. +// setDelegate sets the ErrorHandler delegate if one is not already set. +func (h *loggingErrorHandler) setDelegate(d ErrorHandler) { + if h.delegate.Load() != nil { + // Delegate already registered + return + } h.delegate.Store(d) } -// Handle logs err if no delegate is set, otherwise it is delegated. -func (h *delegator) Handle(err error) { +// Handle implements ErrorHandler. +func (h *loggingErrorHandler) Handle(err error) { if d := h.delegate.Load(); d != nil { d.(ErrorHandler).Handle(err) return @@ -69,39 +63,27 @@ func (h *delegator) Handle(err error) { h.l.Print(err) } -// GetErrorHandler returns the global ErrorHandler instance. -// -// The default ErrorHandler instance returned will log all errors to STDERR -// until an override ErrorHandler is set with SetErrorHandler. All -// ErrorHandler returned prior to this will automatically forward errors to -// the set instance instead of logging. -// -// Subsequent calls to SetErrorHandler after the first will not forward errors -// to the new ErrorHandler for prior returned instances. +// GetErrorHandler returns the global ErrorHandler instance. If no ErrorHandler +// instance has been set (`SetErrorHandler`), the default ErrorHandler which +// logs errors to STDERR is returned. func GetErrorHandler() ErrorHandler { - return globalErrorHandler.Load().(holder).eh + return globalErrorHandler } -// SetErrorHandler sets the global ErrorHandler to h. -// -// The first time this is called all ErrorHandler previously returned from -// GetErrorHandler will send errors to h instead of the default logging -// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not -// delegate errors to h. +// SetErrorHandler sets the global ErrorHandler to be h. func SetErrorHandler(h ErrorHandler) { delegateErrorHandlerOnce.Do(func() { current := GetErrorHandler() if current == h { return } - if internalHandler, ok := current.(*delegator); ok { + if internalHandler, ok := current.(*loggingErrorHandler); ok { internalHandler.setDelegate(h) } }) - globalErrorHandler.Store(holder{eh: h}) } -// Handle is a convenience function for ErrorHandler().Handle(err) +// Handle is a convience function for ErrorHandler().Handle(err) func Handle(err error) { GetErrorHandler().Handle(err) } diff --git a/vendor/go.opentelemetry.io/otel/internal/global/trace.go b/vendor/go.opentelemetry.io/otel/internal/global/trace.go index 11c7c5568..24fd2a6e4 100644 --- a/vendor/go.opentelemetry.io/otel/internal/global/trace.go +++ b/vendor/go.opentelemetry.io/otel/internal/global/trace.go @@ -90,10 +90,9 @@ func (p *tracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T // At this moment it is guaranteed that no sdk is installed, save the tracer in the tracers map. - c := trace.NewTracerConfig(opts...) key := il{ name: name, - version: c.InstrumentationVersion(), + version: trace.NewTracerConfig(opts...).InstrumentationVersion(), } if p.tracers == nil { diff --git a/vendor/go.opentelemetry.io/otel/propagation/doc.go b/vendor/go.opentelemetry.io/otel/propagation/doc.go index 9bef5e53d..7d56873a9 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/doc.go +++ b/vendor/go.opentelemetry.io/otel/propagation/doc.go @@ -15,6 +15,9 @@ /* Package propagation contains OpenTelemetry context propagators. +This package is currently in a Release Candidate phase. Backwards incompatible changes +may be introduced prior to v1.0.0, but we believe the current API is ready to stabilize. + OpenTelemetry propagators are used to extract and inject context data from and into messages exchanged by applications. The propagator supported by this package is the W3C Trace Context encoding diff --git a/vendor/go.opentelemetry.io/otel/propagation/propagation.go b/vendor/go.opentelemetry.io/otel/propagation/propagation.go index 2f54532d9..9fb6de66c 100644 --- a/vendor/go.opentelemetry.io/otel/propagation/propagation.go +++ b/vendor/go.opentelemetry.io/otel/propagation/propagation.go @@ -78,7 +78,7 @@ type TextMapPropagator interface { // DO NOT CHANGE: any modification will not be backwards compatible and // must never be done outside of a new major release. - // Fields returns the keys whose values are set with Inject. + // Fields returns the keys who's values are set with Inject. Fields() []string // DO NOT CHANGE: any modification will not be backwards compatible and // must never be done outside of a new major release. diff --git a/vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go index 6f0016169..2c2c9923e 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go +++ b/vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go @@ -16,6 +16,9 @@ Package instrumentation provides an instrumentation library structure to be passed to both the OpenTelemetry Tracer and Meter components. +This package is currently in a Release Candidate phase. Backwards incompatible changes +may be introduced prior to v1.0.0, but we believe the current API is ready to stabilize. + For more information see [this](https://github.com/open-telemetry/oteps/blob/main/text/0083-component.md). */ diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go b/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go index 9aab3d839..846d65bb1 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/doc.go @@ -14,6 +14,9 @@ // Package resource provides detecting and representing resources. // +// This package is currently in a Release Candidate phase. Backwards incompatible changes +// may be introduced prior to v1.0.0, but we believe the current API is ready to stabilize. +// // The fundamental struct is a Resource which holds identifying information // about the entities for which telemetry is exported. // diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/env.go b/vendor/go.opentelemetry.io/otel/sdk/resource/env.go index d08096c9d..dd6d518ba 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/env.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/env.go @@ -76,9 +76,6 @@ func (fromEnv) Detect(context.Context) (*Resource, error) { } func constructOTResources(s string) (*Resource, error) { - if s == "" { - return Empty(), nil - } pairs := strings.Split(s, ",") attrs := []attribute.KeyValue{} var invalid []string diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/process.go b/vendor/go.opentelemetry.io/otel/sdk/resource/process.go index 60f33e5ca..c75c5ef0f 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/process.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/process.go @@ -138,7 +138,7 @@ func (processExecutablePathDetector) Detect(ctx context.Context) (*Resource, err // Detect returns a *Resource that describes all the command arguments as received // by the process. func (processCommandArgsDetector) Detect(ctx context.Context) (*Resource, error) { - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessCommandArgsKey.StringSlice(commandArgs())), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessCommandArgsKey.Array(commandArgs())), nil } // Detect returns a *Resource that describes the username of the user that owns the diff --git a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go index 6bb2a2805..0d442f917 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go +++ b/vendor/go.opentelemetry.io/otel/sdk/resource/resource.go @@ -132,13 +132,10 @@ func (r *Resource) Attributes() []attribute.KeyValue { } func (r *Resource) SchemaURL() string { - if r == nil { - return "" - } return r.schemaURL } -// Iter returns an iterator of the Resource attributes. +// Iter returns an interator of the Resource attributes. // This is ideal to use if you do not want a copy of the attributes. func (r *Resource) Iter() attribute.Iterator { if r == nil { @@ -202,14 +199,14 @@ func Merge(a, b *Resource) (*Resource, error) { return merged, nil } -// Empty returns an instance of Resource with no attributes. It is +// Empty returns an instance of Resource with no attributes. It is // equivalent to a `nil` Resource. func Empty() *Resource { return &emptyResource } // Default returns an instance of Resource with a default -// "service.name" and OpenTelemetrySDK attributes. +// "service.name" and OpenTelemetrySDK attributes func Default() *Resource { return defaultResource } @@ -226,13 +223,13 @@ func Environment() *Resource { } // Equivalent returns an object that can be compared for equality -// between two resources. This value is suitable for use as a key in +// between two resources. This value is suitable for use as a key in // a map. func (r *Resource) Equivalent() attribute.Distinct { return r.Set().Equivalent() } -// Set returns the equivalent *attribute.Set of this resource's attributes. +// Set returns the equivalent *attribute.Set of this resources attributes. func (r *Resource) Set() *attribute.Set { if r == nil { r = Empty() diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/doc.go b/vendor/go.opentelemetry.io/otel/sdk/trace/doc.go index 0285e99be..70212916f 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/doc.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/doc.go @@ -15,6 +15,9 @@ /* Package trace contains support for OpenTelemetry distributed tracing. +This package is currently in a Release Candidate phase. Backwards incompatible changes +may be introduced prior to v1.0.0, but we believe the current API is ready to stabilize. + The following assumes a basic familiarity with OpenTelemetry concepts. See https://opentelemetry.io. */ diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/span.go b/vendor/go.opentelemetry.io/otel/sdk/trace/span.go index cda164440..5200fa59b 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/span.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/span.go @@ -18,8 +18,6 @@ import ( "context" "fmt" "reflect" - "runtime" - rt "runtime/trace" "sync" "time" @@ -99,9 +97,9 @@ type ReadWriteSpan interface { ReadOnlySpan } -// recordingSpan is an implementation of the OpenTelemetry Span API -// representing the individual component of a trace that is sampled. -type recordingSpan struct { +// span is an implementation of the OpenTelemetry Span API representing the +// individual component of a trace. +type span struct { // mu protects the contents of this span. mu sync.Mutex @@ -158,11 +156,10 @@ type recordingSpan struct { spanLimits SpanLimits } -var _ ReadWriteSpan = (*recordingSpan)(nil) -var _ runtimeTracer = (*recordingSpan)(nil) +var _ trace.Span = &span{} // SpanContext returns the SpanContext of this span. -func (s *recordingSpan) SpanContext() trace.SpanContext { +func (s *span) SpanContext() trace.SpanContext { if s == nil { return trace.SpanContext{} } @@ -171,21 +168,21 @@ func (s *recordingSpan) SpanContext() trace.SpanContext { // IsRecording returns if this span is being recorded. If this span has ended // this will return false. -func (s *recordingSpan) IsRecording() bool { +func (s *span) IsRecording() bool { if s == nil { return false } s.mu.Lock() defer s.mu.Unlock() - return s.endTime.IsZero() + return !s.startTime.IsZero() && s.endTime.IsZero() } // SetStatus sets the status of the Span in the form of a code and a // description, overriding previous values set. The description is only // included in the set status when the code is for an error. If this span is // not being recorded than this method does nothing. -func (s *recordingSpan) SetStatus(code codes.Code, description string) { +func (s *span) SetStatus(code codes.Code, description string) { if !s.IsRecording() { return } @@ -206,7 +203,7 @@ func (s *recordingSpan) SetStatus(code codes.Code, description string) { // will be overwritten with the value contained in attributes. // // If this span is not being recorded than this method does nothing. -func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) { +func (s *span) SetAttributes(attributes ...attribute.KeyValue) { if !s.IsRecording() { return } @@ -221,7 +218,7 @@ func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) { // // If this method is called while panicking an error event is added to the // Span before ending it and the panic is continued. -func (s *recordingSpan) End(options ...trace.SpanEndOption) { +func (s *span) End(options ...trace.SpanEndOption) { // Do not start by checking if the span is being recorded which requires // acquiring a lock. Make a minimal check that the span is not nil. if s == nil { @@ -238,30 +235,24 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) { return } - config := trace.NewSpanEndConfig(options...) if recovered := recover(); recovered != nil { // Record but don't stop the panic. defer panic(recovered) - opts := []trace.EventOption{ + s.addEvent( + semconv.ExceptionEventName, trace.WithAttributes( semconv.ExceptionTypeKey.String(typeStr(recovered)), semconv.ExceptionMessageKey.String(fmt.Sprint(recovered)), ), - } - - if config.StackTrace() { - opts = append(opts, trace.WithAttributes( - semconv.ExceptionStacktraceKey.String(recordStackTrace()), - )) - } - - s.addEvent(semconv.ExceptionEventName, opts...) + ) } if s.executionTracerTaskEnd != nil { s.executionTracerTaskEnd() } + config := trace.NewSpanEndConfig(options...) + s.mu.Lock() // Setting endTime to non-zero marks the span as ended and not recording. if config.Timestamp().IsZero() { @@ -286,7 +277,7 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) { // SetStatus is required if the Status of the Span should be set to Error, this method // does not change the Span status. If this span is not being recorded or err is nil // than this method does nothing. -func (s *recordingSpan) RecordError(err error, opts ...trace.EventOption) { +func (s *span) RecordError(err error, opts ...trace.EventOption) { if s == nil || err == nil || !s.IsRecording() { return } @@ -295,14 +286,6 @@ func (s *recordingSpan) RecordError(err error, opts ...trace.EventOption) { semconv.ExceptionTypeKey.String(typeStr(err)), semconv.ExceptionMessageKey.String(err.Error()), )) - - c := trace.NewEventConfig(opts...) - if c.StackTrace() { - opts = append(opts, trace.WithAttributes( - semconv.ExceptionStacktraceKey.String(recordStackTrace()), - )) - } - s.addEvent(semconv.ExceptionEventName, opts...) } @@ -315,23 +298,16 @@ func typeStr(i interface{}) string { return fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()) } -func recordStackTrace() string { - stackTrace := make([]byte, 2048) - n := runtime.Stack(stackTrace, false) - - return string(stackTrace[0:n]) -} - // AddEvent adds an event with the provided name and options. If this span is // not being recorded than this method does nothing. -func (s *recordingSpan) AddEvent(name string, o ...trace.EventOption) { +func (s *span) AddEvent(name string, o ...trace.EventOption) { if !s.IsRecording() { return } s.addEvent(name, o...) } -func (s *recordingSpan) addEvent(name string, o ...trace.EventOption) { +func (s *span) addEvent(name string, o ...trace.EventOption) { c := trace.NewEventConfig(o...) // Discard over limited attributes @@ -353,7 +329,7 @@ func (s *recordingSpan) addEvent(name string, o ...trace.EventOption) { // SetName sets the name of this span. If this span is not being recorded than // this method does nothing. -func (s *recordingSpan) SetName(name string) { +func (s *span) SetName(name string) { if !s.IsRecording() { return } @@ -364,28 +340,28 @@ func (s *recordingSpan) SetName(name string) { } // Name returns the name of this span. -func (s *recordingSpan) Name() string { +func (s *span) Name() string { s.mu.Lock() defer s.mu.Unlock() return s.name } // Name returns the SpanContext of this span's parent span. -func (s *recordingSpan) Parent() trace.SpanContext { +func (s *span) Parent() trace.SpanContext { s.mu.Lock() defer s.mu.Unlock() return s.parent } // SpanKind returns the SpanKind of this span. -func (s *recordingSpan) SpanKind() trace.SpanKind { +func (s *span) SpanKind() trace.SpanKind { s.mu.Lock() defer s.mu.Unlock() return s.spanKind } // StartTime returns the time this span started. -func (s *recordingSpan) StartTime() time.Time { +func (s *span) StartTime() time.Time { s.mu.Lock() defer s.mu.Unlock() return s.startTime @@ -393,14 +369,14 @@ func (s *recordingSpan) StartTime() time.Time { // EndTime returns the time this span ended. For spans that have not yet // ended, the returned value will be the zero value of time.Time. -func (s *recordingSpan) EndTime() time.Time { +func (s *span) EndTime() time.Time { s.mu.Lock() defer s.mu.Unlock() return s.endTime } // Attributes returns the attributes of this span. -func (s *recordingSpan) Attributes() []attribute.KeyValue { +func (s *span) Attributes() []attribute.KeyValue { s.mu.Lock() defer s.mu.Unlock() if s.attributes.evictList.Len() == 0 { @@ -410,7 +386,7 @@ func (s *recordingSpan) Attributes() []attribute.KeyValue { } // Links returns the links of this span. -func (s *recordingSpan) Links() []Link { +func (s *span) Links() []Link { s.mu.Lock() defer s.mu.Unlock() if len(s.links.queue) == 0 { @@ -420,7 +396,7 @@ func (s *recordingSpan) Links() []Link { } // Events returns the events of this span. -func (s *recordingSpan) Events() []Event { +func (s *span) Events() []Event { s.mu.Lock() defer s.mu.Unlock() if len(s.events.queue) == 0 { @@ -430,7 +406,7 @@ func (s *recordingSpan) Events() []Event { } // Status returns the status of this span. -func (s *recordingSpan) Status() Status { +func (s *span) Status() Status { s.mu.Lock() defer s.mu.Unlock() return s.status @@ -438,7 +414,7 @@ func (s *recordingSpan) Status() Status { // InstrumentationLibrary returns the instrumentation.Library associated with // the Tracer that created this span. -func (s *recordingSpan) InstrumentationLibrary() instrumentation.Library { +func (s *span) InstrumentationLibrary() instrumentation.Library { s.mu.Lock() defer s.mu.Unlock() return s.instrumentationLibrary @@ -446,13 +422,13 @@ func (s *recordingSpan) InstrumentationLibrary() instrumentation.Library { // Resource returns the Resource associated with the Tracer that created this // span. -func (s *recordingSpan) Resource() *resource.Resource { +func (s *span) Resource() *resource.Resource { s.mu.Lock() defer s.mu.Unlock() return s.resource } -func (s *recordingSpan) addLink(link trace.Link) { +func (s *span) addLink(link trace.Link) { if !s.IsRecording() { return } @@ -472,7 +448,7 @@ func (s *recordingSpan) addLink(link trace.Link) { // DroppedAttributes returns the number of attributes dropped by the span // due to limits being reached. -func (s *recordingSpan) DroppedAttributes() int { +func (s *span) DroppedAttributes() int { s.mu.Lock() defer s.mu.Unlock() return s.attributes.droppedCount @@ -480,7 +456,7 @@ func (s *recordingSpan) DroppedAttributes() int { // DroppedLinks returns the number of links dropped by the span due to limits // being reached. -func (s *recordingSpan) DroppedLinks() int { +func (s *span) DroppedLinks() int { s.mu.Lock() defer s.mu.Unlock() return s.links.droppedCount @@ -488,7 +464,7 @@ func (s *recordingSpan) DroppedLinks() int { // DroppedEvents returns the number of events dropped by the span due to // limits being reached. -func (s *recordingSpan) DroppedEvents() int { +func (s *span) DroppedEvents() int { s.mu.Lock() defer s.mu.Unlock() return s.events.droppedCount @@ -496,7 +472,7 @@ func (s *recordingSpan) DroppedEvents() int { // ChildSpanCount returns the count of spans that consider the span a // direct parent. -func (s *recordingSpan) ChildSpanCount() int { +func (s *span) ChildSpanCount() int { s.mu.Lock() defer s.mu.Unlock() return s.childSpanCount @@ -504,12 +480,12 @@ func (s *recordingSpan) ChildSpanCount() int { // TracerProvider returns a trace.TracerProvider that can be used to generate // additional Spans on the same telemetry pipeline as the current Span. -func (s *recordingSpan) TracerProvider() trace.TracerProvider { +func (s *span) TracerProvider() trace.TracerProvider { return s.tracer.provider } // snapshot creates a read-only copy of the current state of the span. -func (s *recordingSpan) snapshot() ReadOnlySpan { +func (s *span) snapshot() ReadOnlySpan { var sd snapshot s.mu.Lock() defer s.mu.Unlock() @@ -540,7 +516,7 @@ func (s *recordingSpan) snapshot() ReadOnlySpan { return &sd } -func (s *recordingSpan) interfaceArrayToLinksArray() []Link { +func (s *span) interfaceArrayToLinksArray() []Link { linkArr := make([]Link, 0) for _, value := range s.links.queue { linkArr = append(linkArr, value.(Link)) @@ -548,7 +524,7 @@ func (s *recordingSpan) interfaceArrayToLinksArray() []Link { return linkArr } -func (s *recordingSpan) interfaceArrayToEventArray() []Event { +func (s *span) interfaceArrayToEventArray() []Event { eventArr := make([]Event, 0) for _, value := range s.events.queue { eventArr = append(eventArr, value.(Event)) @@ -556,7 +532,7 @@ func (s *recordingSpan) interfaceArrayToEventArray() []Event { return eventArr } -func (s *recordingSpan) copyToCappedAttributes(attributes ...attribute.KeyValue) { +func (s *span) copyToCappedAttributes(attributes ...attribute.KeyValue) { s.mu.Lock() defer s.mu.Unlock() for _, a := range attributes { @@ -568,7 +544,7 @@ func (s *recordingSpan) copyToCappedAttributes(attributes ...attribute.KeyValue) } } -func (s *recordingSpan) addChild() { +func (s *span) addChild() { if !s.IsRecording() { return } @@ -577,66 +553,82 @@ func (s *recordingSpan) addChild() { s.mu.Unlock() } -func (*recordingSpan) private() {} +func (*span) private() {} -// runtimeTrace starts a "runtime/trace".Task for the span and returns a -// context containing the task. -func (s *recordingSpan) runtimeTrace(ctx context.Context) context.Context { - if !rt.IsEnabled() { - // Avoid additional overhead if runtime/trace is not enabled. - return ctx +func startSpanInternal(ctx context.Context, tr *tracer, name string, o *trace.SpanConfig) *span { + span := &span{} + + provider := tr.provider + + // If told explicitly to make this a new root use a zero value SpanContext + // as a parent which contains an invalid trace ID and is not remote. + var psc trace.SpanContext + if o.NewRoot() { + ctx = trace.ContextWithSpanContext(ctx, psc) + } else { + psc = trace.SpanContextFromContext(ctx) } - nctx, task := rt.NewTask(ctx, s.name) - s.mu.Lock() - s.executionTracerTaskEnd = task.End - s.mu.Unlock() + // If there is a valid parent trace ID, use it to ensure the continuity of + // the trace. Always generate a new span ID so other components can rely + // on a unique span ID, even if the Span is non-recording. + var tid trace.TraceID + var sid trace.SpanID + if !psc.TraceID().IsValid() { + tid, sid = provider.idGenerator.NewIDs(ctx) + } else { + tid = psc.TraceID() + sid = provider.idGenerator.NewSpanID(ctx, tid) + } - return nctx + spanLimits := provider.spanLimits + span.attributes = newAttributesMap(spanLimits.AttributeCountLimit) + span.events = newEvictedQueue(spanLimits.EventCountLimit) + span.links = newEvictedQueue(spanLimits.LinkCountLimit) + span.spanLimits = spanLimits + + samplingResult := provider.sampler.ShouldSample(SamplingParameters{ + ParentContext: ctx, + TraceID: tid, + Name: name, + Kind: o.SpanKind(), + Attributes: o.Attributes(), + Links: o.Links(), + }) + + scc := trace.SpanContextConfig{ + TraceID: tid, + SpanID: sid, + TraceState: samplingResult.Tracestate, + } + if isSampled(samplingResult) { + scc.TraceFlags = psc.TraceFlags() | trace.FlagsSampled + } else { + scc.TraceFlags = psc.TraceFlags() &^ trace.FlagsSampled + } + span.spanContext = trace.NewSpanContext(scc) + + if !isRecording(samplingResult) { + return span + } + + startTime := o.Timestamp() + if startTime.IsZero() { + startTime = time.Now() + } + span.startTime = startTime + + span.spanKind = trace.ValidateSpanKind(o.SpanKind()) + span.name = name + span.parent = psc + span.resource = provider.resource + span.instrumentationLibrary = tr.instrumentationLibrary + + span.SetAttributes(samplingResult.Attributes...) + + return span } -// nonRecordingSpan is a minimal implementation of the OpenTelemetry Span API -// that wraps a SpanContext. It performs no operations other than to return -// the wrapped SpanContext or TracerProvider that created it. -type nonRecordingSpan struct { - // tracer is the SDK tracer that created this span. - tracer *tracer - sc trace.SpanContext -} - -var _ trace.Span = nonRecordingSpan{} - -// SpanContext returns the wrapped SpanContext. -func (s nonRecordingSpan) SpanContext() trace.SpanContext { return s.sc } - -// IsRecording always returns false. -func (nonRecordingSpan) IsRecording() bool { return false } - -// SetStatus does nothing. -func (nonRecordingSpan) SetStatus(codes.Code, string) {} - -// SetError does nothing. -func (nonRecordingSpan) SetError(bool) {} - -// SetAttributes does nothing. -func (nonRecordingSpan) SetAttributes(...attribute.KeyValue) {} - -// End does nothing. -func (nonRecordingSpan) End(...trace.SpanEndOption) {} - -// RecordError does nothing. -func (nonRecordingSpan) RecordError(error, ...trace.EventOption) {} - -// AddEvent does nothing. -func (nonRecordingSpan) AddEvent(string, ...trace.EventOption) {} - -// SetName does nothing. -func (nonRecordingSpan) SetName(string) {} - -// TracerProvider returns the trace.TracerProvider that provided the Tracer -// that created this span. -func (s nonRecordingSpan) TracerProvider() trace.TracerProvider { return s.tracer.provider } - func isRecording(s SamplingResult) bool { return s.Decision == RecordOnly || s.Decision == RecordAndSample } diff --git a/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go b/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go index afd4b5b5d..0c692fc81 100644 --- a/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go +++ b/vendor/go.opentelemetry.io/otel/sdk/trace/tracer.go @@ -16,7 +16,7 @@ package trace // import "go.opentelemetry.io/otel/sdk/trace" import ( "context" - "time" + rt "runtime/trace" "go.opentelemetry.io/otel/trace" @@ -34,120 +34,42 @@ var _ trace.Tracer = &tracer{} // // The Span is created with the provided name and as a child of any existing // span context found in the passed context. The created Span will be -// configured appropriately by any SpanOption passed. +// configured appropriately by any SpanOption passed. Any Timestamp option +// passed will be used as the start time of the Span's life-cycle. func (tr *tracer) Start(ctx context.Context, name string, options ...trace.SpanStartOption) (context.Context, trace.Span) { config := trace.NewSpanStartConfig(options...) // For local spans created by this SDK, track child span count. if p := trace.SpanFromContext(ctx); p != nil { - if sdkSpan, ok := p.(*recordingSpan); ok { + if sdkSpan, ok := p.(*span); ok { sdkSpan.addChild() } } - s := tr.newSpan(ctx, name, &config) - if rw, ok := s.(ReadWriteSpan); ok && s.IsRecording() { + span := startSpanInternal(ctx, tr, name, config) + for _, l := range config.Links() { + span.addLink(l) + } + span.SetAttributes(config.Attributes()...) + + span.tracer = tr + + if span.IsRecording() { sps, _ := tr.provider.spanProcessors.Load().(spanProcessorStates) for _, sp := range sps { - sp.sp.OnStart(ctx, rw) + sp.sp.OnStart(ctx, span) } } - if rtt, ok := s.(runtimeTracer); ok { - ctx = rtt.runtimeTrace(ctx) - } - return trace.ContextWithSpan(ctx, s), s -} - -type runtimeTracer interface { - // runtimeTrace starts a "runtime/trace".Task for the span and - // returns a context containing the task. - runtimeTrace(ctx context.Context) context.Context -} - -// newSpan returns a new configured span. -func (tr *tracer) newSpan(ctx context.Context, name string, config *trace.SpanConfig) trace.Span { - // If told explicitly to make this a new root use a zero value SpanContext - // as a parent which contains an invalid trace ID and is not remote. - var psc trace.SpanContext - if config.NewRoot() { - ctx = trace.ContextWithSpanContext(ctx, psc) - } else { - psc = trace.SpanContextFromContext(ctx) - } - - // If there is a valid parent trace ID, use it to ensure the continuity of - // the trace. Always generate a new span ID so other components can rely - // on a unique span ID, even if the Span is non-recording. - var tid trace.TraceID - var sid trace.SpanID - if !psc.TraceID().IsValid() { - tid, sid = tr.provider.idGenerator.NewIDs(ctx) - } else { - tid = psc.TraceID() - sid = tr.provider.idGenerator.NewSpanID(ctx, tid) - } - - samplingResult := tr.provider.sampler.ShouldSample(SamplingParameters{ - ParentContext: ctx, - TraceID: tid, - Name: name, - Kind: config.SpanKind(), - Attributes: config.Attributes(), - Links: config.Links(), - }) - - scc := trace.SpanContextConfig{ - TraceID: tid, - SpanID: sid, - TraceState: samplingResult.Tracestate, - } - if isSampled(samplingResult) { - scc.TraceFlags = psc.TraceFlags() | trace.FlagsSampled - } else { - scc.TraceFlags = psc.TraceFlags() &^ trace.FlagsSampled - } - sc := trace.NewSpanContext(scc) - - if !isRecording(samplingResult) { - return tr.newNonRecordingSpan(sc) - } - return tr.newRecordingSpan(psc, sc, name, samplingResult, config) -} - -// newRecordingSpan returns a new configured recordingSpan. -func (tr *tracer) newRecordingSpan(psc, sc trace.SpanContext, name string, sr SamplingResult, config *trace.SpanConfig) *recordingSpan { - startTime := config.Timestamp() - if startTime.IsZero() { - startTime = time.Now() - } - - s := &recordingSpan{ - parent: psc, - spanContext: sc, - spanKind: trace.ValidateSpanKind(config.SpanKind()), - name: name, - startTime: startTime, - attributes: newAttributesMap(tr.provider.spanLimits.AttributeCountLimit), - events: newEvictedQueue(tr.provider.spanLimits.EventCountLimit), - links: newEvictedQueue(tr.provider.spanLimits.LinkCountLimit), - tracer: tr, - spanLimits: tr.provider.spanLimits, - resource: tr.provider.resource, - instrumentationLibrary: tr.instrumentationLibrary, - } - - for _, l := range config.Links() { - s.addLink(l) - } - - s.SetAttributes(sr.Attributes...) - s.SetAttributes(config.Attributes()...) - - return s -} - -// newNonRecordingSpan returns a new configured nonRecordingSpan. -func (tr *tracer) newNonRecordingSpan(sc trace.SpanContext) nonRecordingSpan { - return nonRecordingSpan{tracer: tr, sc: sc} + ctx, span.executionTracerTaskEnd = func(ctx context.Context) (context.Context, func()) { + if !rt.IsEnabled() { + // Avoid additional overhead if + // runtime/trace is not enabled. + return ctx, func() {} + } + nctx, task := rt.NewTask(ctx, name) + return nctx, task.End + }(ctx) + + return trace.ContextWithSpan(ctx, span), span } diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.4.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.4.0/doc.go index c0b1723f8..90184a9f3 100644 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.4.0/doc.go +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.4.0/doc.go @@ -14,6 +14,9 @@ // Package semconv implements OpenTelemetry semantic conventions. // +// This package is currently in a Release Candidate phase. Backwards incompatible changes +// may be introduced prior to v1.0.0, but we believe the current API is ready to stabilize. +// // OpenTelemetry semantic conventions are agreed standardized naming // patterns for OpenTelemetry things. This package represents the conventions // as of the v1.4.0 version of the OpenTelemetry specification. diff --git a/vendor/go.opentelemetry.io/otel/trace.go b/vendor/go.opentelemetry.io/otel/trace.go index 28b4f5e4d..b1e8e56bd 100644 --- a/vendor/go.opentelemetry.io/otel/trace.go +++ b/vendor/go.opentelemetry.io/otel/trace.go @@ -31,9 +31,9 @@ func Tracer(name string, opts ...trace.TracerOption) trace.Tracer { // If none is registered then an instance of NoopTracerProvider is returned. // // Use the trace provider to create a named tracer. E.g. -// tracer := otel.GetTracerProvider().Tracer("example.com/foo") +// tracer := global.GetTracerProvider().Tracer("example.com/foo") // or -// tracer := otel.Tracer("example.com/foo") +// tracer := global.Tracer("example.com/foo") func GetTracerProvider() trace.TracerProvider { return global.TracerProvider() } diff --git a/vendor/go.opentelemetry.io/otel/trace/config.go b/vendor/go.opentelemetry.io/otel/trace/config.go index b1b74cb72..0ecb4dcb8 100644 --- a/vendor/go.opentelemetry.io/otel/trace/config.go +++ b/vendor/go.opentelemetry.io/otel/trace/config.go @@ -38,10 +38,10 @@ func (t *TracerConfig) SchemaURL() string { } // NewTracerConfig applies all the options to a returned TracerConfig. -func NewTracerConfig(options ...TracerOption) TracerConfig { - var config TracerConfig +func NewTracerConfig(options ...TracerOption) *TracerConfig { + config := new(TracerConfig) for _, option := range options { - option.apply(&config) + option.apply(config) } return config } @@ -64,7 +64,6 @@ type SpanConfig struct { links []Link newRoot bool spanKind SpanKind - stackTrace bool } // Attributes describe the associated qualities of a Span. @@ -77,11 +76,6 @@ func (cfg *SpanConfig) Timestamp() time.Time { return cfg.timestamp } -// StackTrace checks whether stack trace capturing is enabled. -func (cfg *SpanConfig) StackTrace() bool { - return cfg.stackTrace -} - // Links are the associations a Span has with other Spans. func (cfg *SpanConfig) Links() []Link { return cfg.links @@ -103,10 +97,10 @@ func (cfg *SpanConfig) SpanKind() SpanKind { // No validation is performed on the returned SpanConfig (e.g. no uniqueness // checking or bounding of data), it is left to the SDK to perform this // action. -func NewSpanStartConfig(options ...SpanStartOption) SpanConfig { - var c SpanConfig +func NewSpanStartConfig(options ...SpanStartOption) *SpanConfig { + c := new(SpanConfig) for _, option := range options { - option.applySpanStart(&c) + option.applySpanStart(c) } return c } @@ -115,10 +109,10 @@ func NewSpanStartConfig(options ...SpanStartOption) SpanConfig { // No validation is performed on the returned SpanConfig (e.g. no uniqueness // checking or bounding of data), it is left to the SDK to perform this // action. -func NewSpanEndConfig(options ...SpanEndOption) SpanConfig { - var c SpanConfig +func NewSpanEndConfig(options ...SpanEndOption) *SpanConfig { + c := new(SpanConfig) for _, option := range options { - option.applySpanEnd(&c) + option.applySpanEnd(c) } return c } @@ -145,7 +139,6 @@ type SpanEndOption interface { type EventConfig struct { attributes []attribute.KeyValue timestamp time.Time - stackTrace bool } // Attributes describe the associated qualities of an Event. @@ -158,19 +151,14 @@ func (cfg *EventConfig) Timestamp() time.Time { return cfg.timestamp } -// StackTrace checks whether stack trace capturing is enabled. -func (cfg *EventConfig) StackTrace() bool { - return cfg.stackTrace -} - -// NewEventConfig applies all the EventOptions to a returned EventConfig. If no -// timestamp option is passed, the returned EventConfig will have a Timestamp +// NewEventConfig applies all the EventOptions to a returned SpanConfig. If no +// timestamp option is passed, the returned SpanConfig will have a Timestamp // set to the call time, otherwise no validation is performed on the returned -// EventConfig. -func NewEventConfig(options ...EventOption) EventConfig { - var c EventConfig +// SpanConfig. +func NewEventConfig(options ...EventOption) *EventConfig { + c := new(EventConfig) for _, option := range options { - option.applyEvent(&c) + option.applyEvent(c) } if c.timestamp.IsZero() { c.timestamp = time.Now() @@ -195,12 +183,6 @@ type SpanStartEventOption interface { EventOption } -// SpanEndEventOption are options that can be used at the end of a span, or with an event. -type SpanEndEventOption interface { - SpanEndOption - EventOption -} - type attributeOption []attribute.KeyValue func (o attributeOption) applySpan(c *SpanConfig) { @@ -247,17 +229,6 @@ func WithTimestamp(t time.Time) SpanEventOption { return timestampOption(t) } -type stackTraceOption bool - -func (o stackTraceOption) applyEvent(c *EventConfig) { c.stackTrace = bool(o) } -func (o stackTraceOption) applySpan(c *SpanConfig) { c.stackTrace = bool(o) } -func (o stackTraceOption) applySpanEnd(c *SpanConfig) { o.applySpan(c) } - -// WithStackTrace sets the flag to capture the error with stack trace (e.g. true, false). -func WithStackTrace(b bool) SpanEndEventOption { - return stackTraceOption(b) -} - // WithLinks adds links to a Span. The links are added to the existing Span // links, i.e. this does not overwrite. func WithLinks(links ...Link) SpanStartOption { diff --git a/vendor/go.opentelemetry.io/otel/trace/doc.go b/vendor/go.opentelemetry.io/otel/trace/doc.go index 391417718..5cc505002 100644 --- a/vendor/go.opentelemetry.io/otel/trace/doc.go +++ b/vendor/go.opentelemetry.io/otel/trace/doc.go @@ -16,6 +16,9 @@ Package trace provides an implementation of the tracing part of the OpenTelemetry API. +This package is currently in a Release Candidate phase. Backwards incompatible changes +may be introduced prior to v1.0.0, but we believe the current API is ready to stabilize. + To participate in distributed traces a Span needs to be created for the operation being performed as part of a traced workflow. It its simplest form: diff --git a/vendor/go.opentelemetry.io/otel/trace/go.mod b/vendor/go.opentelemetry.io/otel/trace/go.mod index fac348c9f..1907de16a 100644 --- a/vendor/go.opentelemetry.io/otel/trace/go.mod +++ b/vendor/go.opentelemetry.io/otel/trace/go.mod @@ -32,6 +32,8 @@ replace go.opentelemetry.io/otel/internal/tools => ../internal/tools replace go.opentelemetry.io/otel/metric => ../metric +replace go.opentelemetry.io/otel/oteltest => ../oteltest + replace go.opentelemetry.io/otel/sdk => ../sdk replace go.opentelemetry.io/otel/sdk/export/metric => ../sdk/export/metric @@ -43,7 +45,7 @@ replace go.opentelemetry.io/otel/trace => ./ require ( github.com/google/go-cmp v0.5.6 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.0.0 + go.opentelemetry.io/otel v1.0.0-RC2 ) replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough @@ -65,7 +67,3 @@ replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../exporters/s replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../exporters/stdout/stdouttrace replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../example/fib diff --git a/vendor/go.opentelemetry.io/otel/version.go b/vendor/go.opentelemetry.io/otel/version.go index e99407cac..69bb46731 100644 --- a/vendor/go.opentelemetry.io/otel/version.go +++ b/vendor/go.opentelemetry.io/otel/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.0.0" + return "1.0.0-RC1" } diff --git a/vendor/go.opentelemetry.io/otel/versions.yaml b/vendor/go.opentelemetry.io/otel/versions.yaml index 8ebf02503..4e2d0be97 100644 --- a/vendor/go.opentelemetry.io/otel/versions.yaml +++ b/vendor/go.opentelemetry.io/otel/versions.yaml @@ -14,11 +14,10 @@ module-sets: stable-v1: - version: v1.0.0 + version: v1.0.0-RC2 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing - - go.opentelemetry.io/otel/example/fib - go.opentelemetry.io/otel/example/jaeger - go.opentelemetry.io/otel/example/namedtracer - go.opentelemetry.io/otel/example/otel-collector @@ -30,10 +29,11 @@ module-sets: - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp - go.opentelemetry.io/otel/exporters/stdout/stdouttrace + - go.opentelemetry.io/otel/oteltest - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.23.0 + version: v0.22.0 modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/otlp/otlpmetric @@ -46,10 +46,9 @@ module-sets: - go.opentelemetry.io/otel/sdk/export/metric - go.opentelemetry.io/otel/sdk/metric bridge: - version: v0.23.0 + version: v0.21.0 modules: - go.opentelemetry.io/otel/bridge/opencensus - - go.opentelemetry.io/otel/bridge/opencensus/test - go.opentelemetry.io/otel/example/opencensus excluded-modules: - go.opentelemetry.io/otel/internal/tools diff --git a/vendor/modules.txt b/vendor/modules.txt index 6c504c047..82b2fd6b5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -380,7 +380,7 @@ go.opentelemetry.io/contrib # go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.21.0 ## explicit go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc -# go.opentelemetry.io/otel v1.0.0 +# go.opentelemetry.io/otel v1.0.0-RC2 ## explicit go.opentelemetry.io/otel go.opentelemetry.io/otel/attribute @@ -391,22 +391,22 @@ go.opentelemetry.io/otel/internal/baggage go.opentelemetry.io/otel/internal/global go.opentelemetry.io/otel/propagation go.opentelemetry.io/otel/semconv/v1.4.0 -# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0-RC2 go.opentelemetry.io/otel/exporters/otlp/otlptrace go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/connection go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform -# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0-RC2 ## explicit go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc -# go.opentelemetry.io/otel/sdk v1.0.0 +# go.opentelemetry.io/otel/sdk v1.0.0-RC2 ## explicit go.opentelemetry.io/otel/sdk/instrumentation go.opentelemetry.io/otel/sdk/internal go.opentelemetry.io/otel/sdk/resource go.opentelemetry.io/otel/sdk/trace -# go.opentelemetry.io/otel/trace v1.0.0 +# go.opentelemetry.io/otel/trace v1.0.0-RC2 ## explicit go.opentelemetry.io/otel/trace # go.opentelemetry.io/proto/otlp v0.9.0