diff --git a/README.md b/README.md
index 688a877..2d43283 100755
--- a/README.md
+++ b/README.md
@@ -137,7 +137,7 @@ func OTELMeterProvider() otelmetric.MeterProvider
OTELMeterProvider returns the global OTel MeterProvider. This is a convenience accessor for code that needs the interface type.
-## func [SetOTELGRPCClientOptions]()
+## func [SetOTELGRPCClientOptions]()
```go
func SetOTELGRPCClientOptions(opts ...otelgrpc.Option)
@@ -146,7 +146,7 @@ func SetOTELGRPCClientOptions(opts ...otelgrpc.Option)
Deprecated: Use SetOTELOptions instead. Only applies when OTEL\_USE\_LEGACY\_INSTRUMENTATION=true.
-## func [SetOTELGRPCServerOptions]()
+## func [SetOTELGRPCServerOptions]()
```go
func SetOTELGRPCServerOptions(opts ...otelgrpc.Option)
@@ -155,7 +155,7 @@ func SetOTELGRPCServerOptions(opts ...otelgrpc.Option)
Deprecated: Use SetOTELOptions instead. Only applies when OTEL\_USE\_LEGACY\_INSTRUMENTATION=true.
-## func [SetOTELOptions]()
+## func [SetOTELOptions]()
```go
func SetOTELOptions(opts grpcotel.Options)
@@ -314,7 +314,7 @@ type CB interface {
```
-### func [New]()
+### func [New]()
```go
func New(c config.Config) CB
diff --git a/config/README.md b/config/README.md
index 3322bb7..9ad893b 100755
--- a/config/README.md
+++ b/config/README.md
@@ -66,7 +66,7 @@ import "github.com/go-coldbrew/core/config"
-## type [Config]()
+## type [Config]()
Config is the configuration for the Coldbrew server It is populated from environment variables and has sensible defaults for all fields so that you can just use it as is without any configuration The following environment variables are supported and can be used to override the defaults for the fields
@@ -174,13 +174,21 @@ type Config struct {
// DisableProtoValidate disables the protovalidate interceptor in the default
// interceptor chain. When disabled, proto validation annotations are ignored.
DisableProtoValidate bool `envconfig:"DISABLE_PROTO_VALIDATE" default:"false"`
+ // DisableDebugLogInterceptor disables the DebugLogInterceptor in the default
+ // interceptor chain. When disabled, proto debug fields and metadata headers
+ // will not trigger per-request debug logging.
+ DisableDebugLogInterceptor bool `envconfig:"DISABLE_DEBUG_LOG_INTERCEPTOR" default:"false"`
+ // DebugLogHeaderName is the gRPC metadata / HTTP header name that triggers
+ // per-request debug logging. The header value should be a valid log level
+ // (e.g., "debug"). Default: "x-debug-log-level".
+ DebugLogHeaderName string `envconfig:"DEBUG_LOG_HEADER_NAME" default:"x-debug-log-level"`
// DisableVTProtobuf disables the use of the vtprotobuf marshaller and unmarshaller for GRPC
// https://github.com/planetscale/vtprotobuf
DisableVTProtobuf bool `envconfig:"DISABLE_VT_PROTOBUF" default:"false"`
- // GRPCMaxSendMsgSize and GRPCMaxRecvMsgSize are the maximum message
- // sizes for sending and receiving messages over GRPC
- GRPCMaxSendMsgSize int `envconfig:"GRPC_MAX_SEND_MSG_SIZE" default:"2147483647"` // Unlimited
- GRPCMaxRecvMsgSize int `envconfig:"GRPC_MAX_RECV_MSG_SIZE" default:"4194304"` // 4MB
+ // GRPCMaxSendMsgSize is the max response size your service can send back to clients.
+ GRPCMaxSendMsgSize int `envconfig:"GRPC_MAX_SEND_MSG_SIZE" default:"2147483647"` // ~2GB (gRPC maximum)
+ // GRPCMaxRecvMsgSize is the max request size your service accepts from clients.
+ GRPCMaxRecvMsgSize int `envconfig:"GRPC_MAX_RECV_MSG_SIZE" default:"4194304"` // 4MB
// GRPCServerDefaultTimeoutInSeconds is the default timeout (in seconds) for
// incoming unary gRPC requests that arrive without a deadline. Set to 0 to
// disable. Does not apply to stream RPCs.
@@ -238,7 +246,7 @@ type Config struct {
```
-### func \(Config\) [Validate]()
+### func \(Config\) [Validate]()
```go
func (c Config) Validate() []string
diff --git a/config/config.go b/config/config.go
index 2ff3ed1..7c55749 100644
--- a/config/config.go
+++ b/config/config.go
@@ -123,10 +123,10 @@ type Config struct {
// DisableVTProtobuf disables the use of the vtprotobuf marshaller and unmarshaller for GRPC
// https://github.com/planetscale/vtprotobuf
DisableVTProtobuf bool `envconfig:"DISABLE_VT_PROTOBUF" default:"false"`
- // GRPCMaxSendMsgSize and GRPCMaxRecvMsgSize are the maximum message
- // sizes for sending and receiving messages over GRPC
- GRPCMaxSendMsgSize int `envconfig:"GRPC_MAX_SEND_MSG_SIZE" default:"2147483647"` // Unlimited
- GRPCMaxRecvMsgSize int `envconfig:"GRPC_MAX_RECV_MSG_SIZE" default:"4194304"` // 4MB
+ // GRPCMaxSendMsgSize is the max response size your service can send back to clients.
+ GRPCMaxSendMsgSize int `envconfig:"GRPC_MAX_SEND_MSG_SIZE" default:"2147483647"` // ~2GB (gRPC maximum)
+ // GRPCMaxRecvMsgSize is the max request size your service accepts from clients.
+ GRPCMaxRecvMsgSize int `envconfig:"GRPC_MAX_RECV_MSG_SIZE" default:"4194304"` // 4MB
// GRPCServerDefaultTimeoutInSeconds is the default timeout (in seconds) for
// incoming unary gRPC requests that arrive without a deadline. Set to 0 to
// disable. Does not apply to stream RPCs.
diff --git a/core.go b/core.go
index 92bee57..47a2805 100644
--- a/core.go
+++ b/core.go
@@ -405,6 +405,12 @@ func getCustomHeaderMatcher(prefixes []string, headers ...string) func(string) (
lowerHeaders = append(lowerHeaders, strings.ToLower(h))
}
}
+ lowerPrefixes := make([]string, 0, len(prefixes))
+ for _, p := range prefixes {
+ if p != "" {
+ lowerPrefixes = append(lowerPrefixes, strings.ToLower(p))
+ }
+ }
return func(key string) (string, bool) {
key = strings.ToLower(key)
@@ -413,8 +419,8 @@ func getCustomHeaderMatcher(prefixes []string, headers ...string) func(string) (
return key, true
}
}
- for _, prefix := range prefixes {
- if len(prefix) > 0 && strings.HasPrefix(key, strings.ToLower(prefix)) {
+ for _, prefix := range lowerPrefixes {
+ if strings.HasPrefix(key, prefix) {
return key, true
}
}