Skip to content
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

Merged
merged 8 commits into from
Jul 23, 2020
Merged

Conversation

nilebox
Copy link
Member

@nilebox nilebox commented Jul 9, 2020

Description:
Updating Prometheus to v2.19.2 requires updating Protobuf, so I extracted this change to merge it separately.

Link to tracking Issue: #1124

# Exclude some staticcheck messages
- linters:
- staticcheck
# See https://github.com/golang/protobuf/issues/1077
Copy link
Member Author

@nilebox nilebox Jul 9, 2020

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?

Copy link
Member Author

@nilebox nilebox Jul 9, 2020

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)

Copy link
Member

@bogdandrutu bogdandrutu Jul 9, 2020

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

Copy link
Member

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

Copy link
Member

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?

Copy link
Member Author

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:
    .PHONY: lint-static-check
    . To ignore errors which can't be trivially fixed, I added //lint:ignore SA1019
  • We also run staticcheck as part of golangci-lint, see . It requires //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
Copy link

codecov bot commented Jul 9, 2020

Codecov Report

Merging #1308 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
exporter/fileexporter/file_exporter.go 68.64% <ø> (ø)
internal/data/metric.go 100.00% <ø> (ø)
processor/cloningfanoutconnector.go 69.44% <ø> (ø)
...eceiver/opencensusreceiver/ocmetrics/opencensus.go 90.47% <ø> (ø)
receiver/opencensusreceiver/octrace/opencensus.go 83.33% <ø> (ø)
consumer/pdatautil/pdatautil.go 84.61% <100.00%> (ø)
receiver/otlpreceiver/otlp.go 93.65% <0.00%> (+3.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 670245c...df1b3c9. Read the comment docs.

@tigrannajaryan
Copy link
Member

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).

@nilebox

This comment has been minimized.

@nilebox

This comment has been minimized.

@nilebox
Copy link
Member Author

nilebox commented Jul 16, 2020

@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.

@nilebox

This comment has been minimized.

@nilebox

This comment has been minimized.

@nilebox
Copy link
Member Author

nilebox commented Jul 16, 2020

The newMarshaler interface was removed in golang/protobuf@cc376d7 (https://go-review.googlesource.com/c/protobuf/+/213901), which supposedly led to the performance degradation we see.

@nilebox
Copy link
Member Author

nilebox commented Jul 16, 2020

I will try to migrate the auto-generated OpenCensus Protobuf code to v1.4.2, which will allow us to migrate to the google.golang.org/protobuf/proto package and test if that fixes the performance issue.

@nilebox
Copy link
Member Author

nilebox commented Jul 16, 2020

@tigrannajaryan @bogdandrutu Supposedly, the OTLP's performance was not affected because it's using https://github.com/gogo/protobuf ?

@nilebox
Copy link
Member Author

nilebox commented Jul 16, 2020

Just tested with an experimental branch of opencensus-proto with types generated using the new protoc, protoc-gen-go and protoc-gen-go-grpc, and it seems to fix the performance issue.

@nilebox

This comment has been minimized.

@bogdandrutu
Copy link
Member

@nilebox you definitely have a time travel machine :)) Started: Fri, 17 Jul 2020 09:06:22 +1000.

What is the next step? Wait for opencensus-proto to release?

@nilebox
Copy link
Member Author

nilebox commented Jul 17, 2020

@bogdandrutu Yes, I will need to release opencensus-proto with the new generated types, which should unblock this PR.

go.mod Show resolved Hide resolved
Copy link
Member

@lizthegrey lizthegrey left a 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

@nilebox nilebox changed the title Update protobuf from v1.3.5 to v1.4.2 Update protobuf from v1.3.5 to v1.4.2 and opencensus-proto from v0.2.1 to v0.3.0 Jul 21, 2020
@nilebox
Copy link
Member Author

nilebox commented Jul 22, 2020

Added changelog.

@nilebox

This comment has been minimized.

@nilebox
Copy link
Member Author

nilebox commented Jul 22, 2020

@tigrannajaryan please see updated testbed results above.
There doesn't seem to be a noticeable difference anymore, so should be good to merge?

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=
Copy link
Member

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).

@tigrannajaryan
Copy link
Member

@tigrannajaryan please see updated testbed results above.
There doesn't seem to be a noticeable difference anymore, so should be good to merge?

Yes, I cannot see any significant difference (I also checked the CircleCI run - the differences are below our measurement error).

@tigrannajaryan
Copy link
Member

I am OK with merging this once the open comments are addressed/resolved.

@bogdandrutu
Copy link
Member

Would prefer to not disable the check for the entire repo if possible

Copy link
Member Author

@nilebox nilebox left a 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
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

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.

@bogdandrutu bogdandrutu merged commit be4d0cf into open-telemetry:master Jul 23, 2020
MovieStoreGuy pushed a commit to atlassian-forks/opentelemetry-collector that referenced this pull request Nov 11, 2021
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
swiatekm pushed a commit to swiatekm/opentelemetry-collector that referenced this pull request Oct 9, 2024
* bump ci version

* oops

* oop

* Change min version

* use an input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants