census: update opencensus library to 0.28.1 #7787
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update OpenCensus to 0.28.1
Problem
The most recent update of OpenCensus contains a breaking change, namely making ContextUtils package private: census-instrumentation/opencensus-java@f8ea9bb#diff-3e846235e5a45651f4f79c6c7b4a325fe1b33a8e75ace3c188dd6104bd3e6dfa
Our project depends on opencensus as well as on grpc-java.
Unfortunately, we cannot update opencensus in our build as it would update the transitive dependency causing runtime errors due to that breaking change.
Solution
Updating OpenCensus to recent version, fixing the issue with the breaking change.
The call to ContextUtils.getValue can be replaced by
Tracing.getTracer().getCurrentSpan(), as it callsContextUtils.getValue(Context.current());under the hood yielding the same behaviorFixes