-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update protobuf from v1.3.5 to v1.4.2 and opencensus-proto from v0.2.1 to v0.3.0 #1308
Conversation
# Exclude some staticcheck messages | ||
- linters: | ||
- staticcheck | ||
# See https://github.com/golang/protobuf/issues/1077 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protobuf v1.4.2 has // Deprecated
comment in
https://github.com/golang/protobuf/blob/v1.4.2/proto/proto.go#L12
which was introduced in https://go-review.googlesource.com/c/protobuf/+/213901
The change below completely disables the following check:
SA1019 | Using a deprecated function, variable, constant or field
Is there any better workaround?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIU migrating to the package google.golang.org/protobuf/proto
will require re-generating protobuf types, some of which live outside of this repo (e.g. Zipkin, OpenCensus)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can change OpenCensus. We need to also see if Zipkin has a new release which uses the new library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to do a line based ignore on the import statement? https://staticcheck.io/docs/#line-based-linter-directives
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted the blanket ignore rule in the STATICCHECK
Makefile rule, but left this one.
It seems that for some reason we run staticcheck
twice and they conflict with each other when I try to add ignore rules:
- We have a separate target for
staticcheck
:opentelemetry-collector/Makefile
Line 111 in c4a97db
.PHONY: lint-static-check //lint:ignore SA1019
- We also run
staticcheck
as part ofgolangci-lint
, seeopentelemetry-collector/.golangci.yml
Line 100 in c4a97db
- staticcheck //nolint:staticcheck
comment which conflicts with the one above (only left-most comment disables linter)
@bogdandrutu Why do we run staticcheck
twice?
For now I kept the SA1019
check in the lint-static-check
, but excluded it from golangci-lint
.
We can deduplicate running staticcheck
in a separate PR if needed.
Codecov Report
@@ Coverage Diff @@
## master #1308 +/- ##
==========================================
+ Coverage 90.23% 90.24% +0.01%
==========================================
Files 233 233
Lines 16396 16396
==========================================
+ Hits 14795 14797 +2
+ Misses 1141 1140 -1
+ Partials 460 459 -1
Continue to review full report at Codecov.
|
I remember last time we tried to update protobuf we saw a performance degradation. Please confirm that this does not cause changes in the performance (best to post before/after numbers from testbed execution performed on the same machine). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@tigrannajaryan there seems to be a significant performance degradation in OpenCensus test cases, while OTLP seems fine, and Zipkin seems to actually perform even better. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The |
I will try to migrate the auto-generated OpenCensus Protobuf code to v1.4.2, which will allow us to migrate to the |
@tigrannajaryan @bogdandrutu Supposedly, the OTLP's performance was not affected because it's using https://github.com/gogo/protobuf ? |
Just tested with an experimental branch of |
This comment has been minimized.
This comment has been minimized.
@nilebox you definitely have a time travel machine :)) What is the next step? Wait for opencensus-proto to release? |
@bogdandrutu Yes, I will need to release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Please also update the description to indicate you changed opencensus-proto versions.
Also please add to CHANGELOG.md
Added changelog. |
This comment has been minimized.
This comment has been minimized.
@tigrannajaryan please see updated testbed results above. |
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= | ||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run go mod tidy
(if not already).
Yes, I cannot see any significant difference (I also checked the CircleCI run - the differences are below our measurement error). |
I am OK with merging this once the open comments are addressed/resolved. |
Would prefer to not disable the check for the entire repo if possible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bogdandrutu I have cleaned up the ignore rules, and migrated to new protobuf package where it was trivial.
Also see comment about running staticcheck
twice for some reason.
@@ -18,7 +18,7 @@ import ( | |||
"testing" | |||
|
|||
gogoproto "github.com/gogo/protobuf/proto" | |||
goproto "github.com/golang/protobuf/proto" | |||
goproto "github.com/golang/protobuf/proto" //lint:ignore SA1019 golang/protobuf/proto is deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't replace it with "google.golang.org/protobuf/proto"
because the OTLP types generated by gogo/protobuf
don't implement ProtoReflect()
function of ProtoMessage
interface:
@@ -18,7 +18,7 @@ import ( | |||
"testing" | |||
|
|||
gogoproto "github.com/gogo/protobuf/proto" | |||
goproto "github.com/golang/protobuf/proto" | |||
goproto "github.com/golang/protobuf/proto" //lint:ignore SA1019 golang/protobuf/proto is deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't replace it with "google.golang.org/protobuf/proto"
because the OTLP types generated by gogo/protobuf
don't implement ProtoReflect()
function of ProtoMessage
interface:
"github.com/golang/protobuf/jsonpb" | ||
"github.com/golang/protobuf/proto" | ||
"github.com/golang/protobuf/jsonpb" //lint:ignore SA1019 golang/protobuf/jsonpb is deprecated | ||
"github.com/golang/protobuf/proto" //lint:ignore SA1019 golang/protobuf/proto is deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't replace it with "google.golang.org/protobuf/proto"
because the OTLP types generated by gogo/protobuf
don't implement ProtoReflect()
function of ProtoMessage
interface:
@@ -21,10 +21,11 @@ import ( | |||
|
|||
commonpb "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1" | |||
tracepb "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1" | |||
"github.com/golang/protobuf/proto" | |||
"github.com/golang/protobuf/proto" //lint:ignore SA1019 golang/protobuf/proto is deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zipkin still has types generated by older version of protoc-gen-go
, and doesn't implement new ProtoMessage
interface. The release we are using is the latest.
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* bump ci version * oops * oop * Change min version * use an input
Description:
Updating Prometheus to v2.19.2 requires updating Protobuf, so I extracted this change to merge it separately.
Link to tracking Issue: #1124