Conversation
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
jhalterman
approved these changes
Feb 27, 2026
Signed-off-by: Marco Pracucci <marco@pracucci.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Backends closed before async requests finish draining
- Moved backend Close() calls from Stop() to Await(), after async dispatcher drains in-flight requests, preventing gRPC connections from being closed while still in use.
- ✅ Fixed: Query parameters dropped in gRPC request URL
- Added RawQuery appending to the request URL in createGRPCRequest to preserve query parameters, matching HTTP backend behavior and HTTPgRPC protocol expectations.
Or push these changes by commenting:
@cursor push de6bbf260e
Preview (de6bbf260e)
diff --git a/tools/writetee/proxy.go b/tools/writetee/proxy.go
--- a/tools/writetee/proxy.go
+++ b/tools/writetee/proxy.go
@@ -379,13 +379,6 @@
p.asyncDispatcher.Stop()
}
- // Close all backends (important for gRPC backends to close connections).
- for _, backend := range p.backends {
- if err := backend.Close(); err != nil {
- level.Warn(p.logger).Log("msg", "failed to close backend", "backend", backend.Name(), "err", err)
- }
- }
-
return nil
}
@@ -397,4 +390,13 @@
if p.asyncDispatcher != nil {
p.asyncDispatcher.Await()
}
+
+ // Close all backends (important for gRPC backends to close connections).
+ // This must happen after async dispatcher has drained to avoid closing
+ // connections while in-flight requests are still using them.
+ for _, backend := range p.backends {
+ if err := backend.Close(); err != nil {
+ level.Warn(p.logger).Log("msg", "failed to close backend", "backend", backend.Name(), "err", err)
+ }
+ }
}
diff --git a/tools/writetee/proxy_backend_grpc.go b/tools/writetee/proxy_backend_grpc.go
--- a/tools/writetee/proxy_backend_grpc.go
+++ b/tools/writetee/proxy_backend_grpc.go
@@ -123,6 +123,10 @@
// Build the URL path with endpoint path prefix.
reqPath := path.Join(b.endpoint.Path, orig.URL.Path)
+ // Append query string if present
+ if orig.URL.RawQuery != "" {
+ reqPath = reqPath + "?" + orig.URL.RawQuery
+ }
// Clone headers for the gRPC request.
headers := make(http.Header)There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Shallow header copy shares slices with original request
- Replaced shallow header copy loop with orig.Header.Clone() to ensure independent header value slices, aligning with the HTTP backend's approach.
Or push these changes by commenting:
@cursor push 053b06a86c
Preview (053b06a86c)
diff --git a/tools/writetee/proxy_backend_grpc.go b/tools/writetee/proxy_backend_grpc.go
--- a/tools/writetee/proxy_backend_grpc.go
+++ b/tools/writetee/proxy_backend_grpc.go
@@ -128,10 +128,7 @@
}
// Clone headers for the gRPC request.
- headers := make(http.Header)
- for k, v := range orig.Header {
- headers[k] = v
- }
+ headers := orig.Header.Clone()
// Remove headers that are not relevant for HTTPgRPC backends.
headers.Del("Authorization")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What this PR does
Add HTTPgRPC support.
Which issue(s) this PR fixes or relates to
Fixes #
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]. If changelog entry is not needed, please add thechangelog-not-neededlabel to the PR.about-versioning.mdupdated with experimental features.