-
Notifications
You must be signed in to change notification settings - Fork 20
chore(test): add grcp integration test #135
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
Conversation
kakkoyun
left a comment
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.
Looking good 🚀
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.
Pull Request Overview
This PR adds gRPC server instrumentation support to the OpenTelemetry compile-time instrumentation project. It enables hooking into gRPC server initialization to add telemetry capabilities.
Key changes:
- Adds gRPC server hook configuration and implementation
- Implements a Shutdown RPC method for graceful server termination in tests
- Adds end-to-end test coverage for the gRPC instrumentation hook
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tool/data/grpc.yaml | Defines hook configuration for gRPC server's Serve method |
| test/e2e/grpc_test.go | Adds e2e test to verify gRPC server hook invocation |
| pkg/instrumentation/grpc/server_hook.go | Implements the BeforeServe hook for gRPC server instrumentation |
| pkg/instrumentation/grpc/go.mod | Adds Go module definition for the gRPC instrumentation package |
| demo/grpc/server/pb/greeter_grpc.pb.go | Generated gRPC code including new Shutdown RPC method |
| demo/grpc/server/pb/greeter.pb.go | Generated protobuf code for Shutdown request/reply messages |
| demo/grpc/server/main.go | Implements Shutdown RPC handler and adds startup logging |
| demo/grpc/server/greeter.proto | Adds Shutdown RPC definition to the service |
| demo/grpc/server/go.sum | Updates dependency checksums |
| demo/grpc/client/main.go | Adds shutdown flag to invoke server shutdown |
| demo/grpc/README.md | Documents the new Shutdown RPC method and usage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if strings.Contains(line, readyMsg) { | ||
| close(readyChan) | ||
| } |
Copilot
AI
Nov 7, 2025
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.
The readyChan channel could be closed multiple times if the "server started" message appears more than once in the server output, which would cause a panic. Consider using a sync.Once or checking if the channel is already closed before attempting to close it again.
Example fix:
var readyOnce sync.Once
// ... in the goroutine:
if strings.Contains(line, readyMsg) {
readyOnce.Do(func() { close(readyChan) })
}|
Right now, the example rule isn’t working, and |
|
According to But it's not applied, e.g code is not injected. Below place where we return with an error |
|
Going deeper, it seems that there is signature mismatch Hi @y1yang0 — there’s a gap in my understanding here. I’m trying to hook into grpc.(*Server).Serve My current hook is: According to my understanding the first two parameters in this case should be |
|
@pdelewski I see. The issue was that |
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func waitUntilGrpcReady(t *testing.T, serverApp *exec.Cmd, outputPipe io.ReadCloser) func() string { |
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.
This looks almost identical to waitUntilReady in http_test.go. Perhaps we could extract this into a shared app.go, like app.WaitUntilReady (or app.WaitReady)?
|
It seems that still, there is some problem |
|
It's better now, as it seems that instrumentation is there: However tests is failing. I need to investigate further. |
@y1yang0 Thanks for the fix. I was not sure if that was due to wrong rule or bug in the instrumentation itself. |
|
@pdelewski Do you need any help with this? |
@kakkoyun I haven’t had much time on this yet. I’ll take a closer look today. If I don’t find the root cause, I’d appreciate a hand. |


No description provided.