Closed dashpole closed 4 years ago
@dashpole there is some nil pointer dereference
panic in the CI tests.
go.opencensus.io/plugin/ochttp.(*trackingResponseWriter).end.func1()
/home/travis/gopath/src/go.opencensus.io/plugin/ochttp/server.go:190 +0x134
Tests were failing because the evaluation of nil changed on the interface. I had to make some updates. I added a section to the description on the change in behavior for evaluation against nil.
Is this good to merge? I don't have any power here
@dashpole merged! I'd recommend trying with a pinned commit dependency first if that works well for the OpenTelemetry shim first before tagging a release.
What this PR does:
DefaultTracer
variable that can be set by users, and defaults to the existing Tracer implementation.Attribute
sMotivation for the PR:
We would like to be able to assist users in their migration to OpenTelemetry. One way to do this is by writing an implementation of OpenCensus APIs which uses OpenTelemetry under the hood. This way, OpenCensus spans with an OpenTelemetry parent (or vice-versa) would be linked, and all telemetry would be exported through the same exporters (OpenTelemetry exporters in this case).
Rationale for the PR:
This adopts a similar model to OpenTelemetry, in which the SDK can be swapped out for a different implementation.
User Impact:
For users using the "typical" workflow, there should be no changes. For example,
still functions the same way. Even though the Span struct was changed to an interface, the same methods still exist. Only users that pass
Span
s would need to change when updating:notice the
*Span
was changed toSpan
This change also impacts the evaluation of Span against nil. For example,
The above will no longer function as expected. This is because
nil
, when assigned to an interface, makes the interface non-nil: https://play.golang.org/p/BWutROXBt5y. Users should change to the following:Example Usage:
See https://github.com/dashpole/opencensus-migration-go/tree/replace_oc_sdk#opencensus-migration-go for an overview, and https://github.com/dashpole/opencensus-migration-go/tree/replace_oc_sdk/migration for an implementation of the new Tracer and Span APIs.
@nilebox @jsuereth @james-bebbington