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

gcp/observability: correctly test this module in presubmit tests #5300

Merged
merged 4 commits into from Apr 12, 2022

Conversation

lidizheng
Copy link
Contributor

@lidizheng lidizheng commented Apr 6, 2022

In my manual testing of the plugin, I found I made some mistakes in #5196. I didn't check how the tests are picked by the GitHub presubmit checks, so no gcp/observability tests were run.

After the path changed, I forgot to update some imports, however, my local unit tests continued to pass because I didn't clean the object files.

This PR: 1. added gcp/observability tests to presubmit; 2. fix the import typos; 3. fix the WriteLogEntries path; 4. fix the grpc release version requirement.

RELEASE NOTES: N/A

@lidizheng
Copy link
Contributor Author

@dfawley PTAL.

The failed check looks like a flake.

@menghanl menghanl marked this pull request as ready for review April 7, 2022 00:22
@@ -7,7 +7,7 @@ require (
github.com/golang/protobuf v1.5.2
github.com/google/uuid v1.3.0
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
google.golang.org/grpc v1.43.0
google.golang.org/grpc v1.46.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this fail to compile? Since 1.43.0 doesn't have the exported binarylog structs.
Or this was hidden by the replace below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep... this unfortunately is hidden by the replace.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if we make changes in gcp/observability in the future that rely on changes in the main module, we won't ever catch that? Should we delete the replace directive entirely to catch that? Also does that mean we can't make backward-incompatible changes to our own internal packages now, because a user might be using this version of observability with grpc v1.51.0 one day? Or do we need to make observability a dependency of the main module and keep them perfectly in sync when we do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a TODO to remove the replace.

does that mean we can't make backward-incompatible changes to our own internal packages now.

It would be great to decouple them (to allow internal packages to continue be internal). But I'm not sure what's the best practice here. We can strive to use let it use public API in future (by exposing experimental APIs).

Or do we need to make observability a dependency of the main module and keep them perfectly in sync when we do that?

Does this solution mean gRPC Observability will impact the dependency tree of all gRPC Go users? That doesn't sound good...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Giving this another thought. We could aim to only use public methods for future plugins like the observability one? In this case, we were using the internal methods of binary logging to customize the logger. We didn't public them, because we were uncertain if we will keep using this design (wrap binary logging) or if the plugin will stay for the long run. We could find a middle ground here to publicize some hooks if they help users to extend those modules.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the APIs public doesn't make this situation better, because changing them will still break our own observability module.

From another perspective, maybe this isn't that bad, since at least for now, the observability package is still experimental. And also, we don't make separate releases for the observability module (so that even if it's a separate module, it shared the version of the main module).

.github/workflows/testing.yml Outdated Show resolved Hide resolved
@@ -7,7 +7,7 @@ require (
github.com/golang/protobuf v1.5.2
github.com/google/uuid v1.3.0
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
google.golang.org/grpc v1.43.0
google.golang.org/grpc v1.46.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if we make changes in gcp/observability in the future that rely on changes in the main module, we won't ever catch that? Should we delete the replace directive entirely to catch that? Also does that mean we can't make backward-incompatible changes to our own internal packages now, because a user might be using this version of observability with grpc v1.51.0 one day? Or do we need to make observability a dependency of the main module and keep them perfectly in sync when we do that?

@lidizheng lidizheng requested a review from dfawley April 12, 2022 17:19
@lidizheng
Copy link
Contributor Author

lidizheng commented Apr 12, 2022

@menghanl @dfawley PTALA. Let me know what else can I do.
(This PR would need to be backported to the v1.46.x branch, I will create the backport PR once this is merged.)

@menghanl menghanl added the Type: Internal Cleanup Refactors, etc label Apr 12, 2022
@menghanl menghanl added this to the 1.47 Release milestone Apr 12, 2022
@menghanl menghanl closed this Apr 12, 2022
@menghanl menghanl reopened this Apr 12, 2022
@menghanl menghanl closed this Apr 12, 2022
@menghanl menghanl reopened this Apr 12, 2022
cd ${GITHUB_WORKSPACE}/security/authorization && go test ${{ matrix.testflags }} -timeout 2m google.golang.org/grpc/security/authorization/...

cd "${GITHUB_WORKSPACE}"
for MOD_FILE in $(find . -name 'go.mod' | grep -Ev '^\./go\.mod'); do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will run the top level tests again.
Limit the find?
find . -mindepth 2 -name 'go.mod'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the suggested snippet, the second part is grep -Ev '^\./go\.mod', it excludes the top level tests. Can you double check if current test set works as expected? https://github.com/grpc/grpc-go/runs/5994752478?check_suite_focus=true

(It looks reasonable to me, no duplication found)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. I somehow thought that was to remove the go.mod and keep only the directory name. This should be good then!

@menghanl menghanl merged commit 8d68434 into grpc:master Apr 12, 2022
lidizheng added a commit to lidizheng/grpc-go that referenced this pull request Apr 12, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants