Skip to content

chore(migrate): migrate otelgrpc pkg interceptor to stats handler(#18258) #18366

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jack-R-lantern
Copy link
Contributor

@Jack-R-lantern Jack-R-lantern commented May 22, 2024

This PR will migrate the otelgrpc pkg.
It changes server/clientinterceptor in otelgrpc to NewServer/ClientHandler
I think that otelgrpc should be updated to 0.52.0 or higher in the future, in which case grpc should also be updated to 1.64.

Closes #18258

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@Jack-R-lantern Jack-R-lantern changed the title chore(migrate): migrate otelgrpc pkg interceptor to stats handler chore(migrate): migrate otelgrpc pkg interceptor to stats handler(#18258) May 22, 2024
Copy link

codecov bot commented May 22, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 55.76%. Comparing base (683e4e0) to head (b6f81d5).

Files with missing lines Patch % Lines
cmpserver/server.go 0.00% 1 Missing ⚠️
pkg/apiclient/apiclient.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #18366      +/-   ##
==========================================
- Coverage   55.79%   55.76%   -0.04%     
==========================================
  Files         342      341       -1     
  Lines       57213    57196      -17     
==========================================
- Hits        31920    31893      -27     
- Misses      22655    22656       +1     
- Partials     2638     2647       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18258/otelgrpc_package_should_use_interceptors_in_favor_of_stats_handlers branch 12 times, most recently from 464c408 to 37c0f77 Compare May 28, 2024 12:01
@Jack-R-lantern
Copy link
Contributor Author

Jack-R-lantern commented May 28, 2024

[previous CI integratiion tests e2e log]

time="2024-05-28T09:10:36Z" level=error msg="../../dist/argocd app diff test-app-with-secrets --local testdata --server-side-generate --plaintext --server 127.0.0.1:8088 --auth-token *** --insecure failed exit status 20: time="2024-05-28T09:10:36Z" level=fatal msg="rpc error: code = Unimplemented desc = grpc_retry: cannot retry on ClientStreams, set grpc_retry.Disable()"" execID=c6fd7
time="2024-05-28T09:10:36Z" level=fatal msg="../../dist/argocd app diff test-app-with-secrets --local testdata --server-side-generate --plaintext --server 127.0.0.1:8088 --auth-token *** --insecure failed exit status 20: time="2024-05-28T09:10:36Z" level=fatal msg="rpc error: code = Unimplemented desc = grpc_retry: cannot retry on ClientStreams, set grpc_retry.Disable()""

Modified the code based on the logs from the previous E2E test.
I think this was the problem.
It seems that using WithStreamInterceptor without using a chain overwrote an existing Interceptor.

@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18258/otelgrpc_package_should_use_interceptors_in_favor_of_stats_handlers branch from 37c0f77 to c1e018a Compare May 28, 2024 13:08
@Jack-R-lantern Jack-R-lantern marked this pull request as ready for review May 28, 2024 13:15
@Jack-R-lantern Jack-R-lantern requested a review from a team as a code owner May 28, 2024 13:15
@Jack-R-lantern
Copy link
Contributor Author

@blakepettersson Can you check on that PR?

Copy link
Member

@blakepettersson blakepettersson left a comment

Choose a reason for hiding this comment

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

This LGTM @Jack-R-lantern

@blakepettersson
Copy link
Member

For reference: #17790, #17197 and #17103 were previous attempts

@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18258/otelgrpc_package_should_use_interceptors_in_favor_of_stats_handlers branch from c1e018a to 9e03229 Compare July 4, 2024 13:56
@Jack-R-lantern
Copy link
Contributor Author

@blakepettersson
Resolved all conflicts.
Please review this PR

@Jack-R-lantern
Copy link
Contributor Author

@blakepettersson
The corresponding pr has been approved, but when will it be merged?

@crenshaw-dev
Copy link
Member

@Jack-R-lantern looks like there's some duplicate work here: #22098

Would y'all mind cross-reviewing and making sure everything looks right?

@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18258/otelgrpc_package_should_use_interceptors_in_favor_of_stats_handlers branch from 9e03229 to 8ad4295 Compare March 4, 2025 21:39
@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18258/otelgrpc_package_should_use_interceptors_in_favor_of_stats_handlers branch 2 times, most recently from 1a9862c to 3bb5dc4 Compare March 4, 2025 22:07
@Jack-R-lantern
Copy link
Contributor Author

@crenshaw-dev

Of course.
In the server/application, the gRPC client is created using client streaming, and the important part is that the grpc_retry.Disable() option has been added.
It doesn’t seem to cause any major issues in testing, but could you review this part?
Everything else looks fine.

@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18258/otelgrpc_package_should_use_interceptors_in_favor_of_stats_handlers branch from 3bb5dc4 to b6f81d5 Compare March 6, 2025 23:43
@crenshaw-dev
Copy link
Member

@Jack-R-lantern could you rebase?

@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18258/otelgrpc_package_should_use_interceptors_in_favor_of_stats_handlers branch 2 times, most recently from 771d7d2 to 5a2cc73 Compare March 10, 2025 14:15
@Jack-R-lantern
Copy link
Contributor Author

@crenshaw-dev
sure

@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18258/otelgrpc_package_should_use_interceptors_in_favor_of_stats_handlers branch from 5a2cc73 to da29bb0 Compare March 10, 2025 14:18
@crenshaw-dev
Copy link
Member

Hm. Those test failures look very unrelated to these changes.

@Jack-R-lantern
Copy link
Contributor Author

I'll check about that part.

@andrii-korotkov-verkada
Copy link
Contributor

What some failed tests have in common is

		And(func() {
			go startCMPServer(t, "./testdata/cmp-gitsshcreds-disable-provide")
			time.Sleep(100 * time.Millisecond)
			t.Setenv("ARGOCD_BINARY_NAME", "argocd")
		}).

I wonder if the cmp server takes more to initialize with the new changes. Can you try bumping the sleep time to 1 second or more and see if the issue still persists, please?

@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18258/otelgrpc_package_should_use_interceptors_in_favor_of_stats_handlers branch 8 times, most recently from 223c1d9 to de20c41 Compare April 12, 2025 14:28
migrate cmdserver, server, pkg/apiclient, reposerver
- server
  - migrate ServerInterceptor -> NewServerHandler
- client
  - migrate ClientInterceptor -> NewClientHandler

fix server/application
- add ClientStream GenerateManfiestWithFiles retry.Disable()

remove util/grpc/trace
- remvoe util/grpc/trace.go

Signed-off-by: Jack-R-lantern <[email protected]>
@Jack-R-lantern Jack-R-lantern force-pushed the ISSUE-18258/otelgrpc_package_should_use_interceptors_in_favor_of_stats_handlers branch from de20c41 to 419981e Compare April 12, 2025 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready for final review
Development

Successfully merging this pull request may close these issues.

otelgrpc package should use interceptors in favor of stats handlers
5 participants