-
Notifications
You must be signed in to change notification settings - Fork 4
docs: clarify send/recv msg size comments #75
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
Changes from all commits
ee850f5
7ce60c4
01f2c6a
93e229d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,6 +142,12 @@ func (c *cb) processConfig() { | |
| if c.config.DisableProtoValidate { | ||
| interceptors.SetDisableProtoValidate(true) | ||
| } | ||
| if c.config.DisableDebugLogInterceptor { | ||
| interceptors.SetDisableDebugLogInterceptor(true) | ||
| } | ||
| if c.config.DebugLogHeaderName != "" { | ||
| interceptors.SetDebugLogHeaderName(c.config.DebugLogHeaderName) | ||
| } | ||
| if c.config.EnablePrometheusGRPCHistogram { | ||
| if len(c.config.PrometheusGRPCHistogramBuckets) > 0 { | ||
| interceptors.SetServerMetricsOptions( | ||
|
|
@@ -390,19 +396,26 @@ func spanRouteMiddleware(next runtime.HandlerFunc) runtime.HandlerFunc { | |
| } | ||
| } | ||
|
|
||
| // getCustomHeaderMatcher returns a matcher that matches the given header and prefix | ||
| func getCustomHeaderMatcher(prefixes []string, header string) func(string) (string, bool) { | ||
| header = strings.ToLower(header) | ||
| // getCustomHeaderMatcher returns a matcher that matches the given exact headers and prefixes. | ||
| // Exact-match headers (e.g., trace header, debug log header) are forwarded from HTTP to gRPC metadata. | ||
| func getCustomHeaderMatcher(prefixes []string, headers ...string) func(string) (string, bool) { | ||
| lowerHeaders := make([]string, 0, len(headers)) | ||
| for _, h := range headers { | ||
| if h != "" { | ||
| lowerHeaders = append(lowerHeaders, strings.ToLower(h)) | ||
| } | ||
| } | ||
| return func(key string) (string, bool) { | ||
| key = strings.ToLower(key) | ||
|
|
||
| if key == header { | ||
| return key, true | ||
| } else if len(prefixes) > 0 { | ||
| for _, prefix := range prefixes { | ||
| if len(prefix) > 0 && strings.HasPrefix(key, strings.ToLower(prefix)) { | ||
| return key, true | ||
| } | ||
| for _, h := range lowerHeaders { | ||
| if key == h { | ||
| return key, true | ||
| } | ||
| } | ||
| for _, prefix := range prefixes { | ||
| if len(prefix) > 0 && strings.HasPrefix(key, strings.ToLower(prefix)) { | ||
| return key, true | ||
|
Comment on lines
+416
to
+418
|
||
| } | ||
| } | ||
|
|
||
|
|
@@ -425,7 +438,7 @@ func (c *cb) initHTTP(ctx context.Context) (*http.Server, error) { | |
|
|
||
| muxOpts := []runtime.ServeMuxOption{ | ||
| runtime.WithIncomingHeaderMatcher( | ||
| getCustomHeaderMatcher(allowedHttpHeaderPrefixes, c.config.TraceHeaderName), | ||
| getCustomHeaderMatcher(allowedHttpHeaderPrefixes, c.config.TraceHeaderName, c.config.DebugLogHeaderName), | ||
| ), | ||
| runtime.WithMarshalerOption("application/proto", pMar), | ||
| runtime.WithMarshalerOption("application/protobuf", pMar), | ||
|
|
||
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 PR title/description says this is a docs-only clarification, but this hunk introduces new runtime behavior (new config flags affecting interceptor behavior) and is coupled with other non-doc changes in the PR (goleak TestMain, config validation additions, dependency bumps). Please update the PR title/description to reflect the functional changes, or split the functional changes into a separate PR to keep review scope clear.
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.
Recreated PR as #76 with clean branch from main — only the doc/comment changes. The previous branch had stale commits from the prior PR.