Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: test

on:
pull_request:
push:
branches:
- "develop"

jobs:
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Test
run: go test ./...
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Clients created with `NewClientConn` (and the `NewInternalClient`/`NewExternalClient` helpers) receive messages up to `dgrpc.MaxResponseSize` (2 GiB − 1 byte, `math.MaxInt32`) instead of 1 GiB. Standard servers send messages up to `dgrpc.MaxResponseSize`, the same as the grpc-go default. Request limits (client send, server receive) are unchanged.
- Add zstd support for connectrpc server
- Remove connectrpc error middleware by default. You need to add it `connectrpc.NewErrorsInterceptor`
- Added abiliy to map connectrpc error
Expand Down
10 changes: 8 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package dgrpc
import (
"crypto/tls"
"fmt"
"math"
"time"

"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
Expand All @@ -31,7 +32,12 @@ var roundrobinDialOption = grpc.WithDefaultServiceConfig(`{"loadBalancingConfig"
var insecureDialOption = grpc.WithTransportCredentials(insecure.NewCredentials())
var tlsClientDialOption = grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, ""))

var largeRecvMsgSizeCallOption = grpc.MaxCallRecvMsgSize(1024 * 1024 * 1024)
// MaxResponseSize is the largest gRPC response message in bytes that clients created by this
// package receive and that servers created by this package send. Requests keep the gRPC
// limits, they are expected to be small.
const MaxResponseSize = math.MaxInt32

var largeRecvMsgSizeCallOption = grpc.MaxCallRecvMsgSize(MaxResponseSize)
var hangOnResolveErrorCallOption = grpc.WaitForReady(true)
var hangOnResolveErrorDialOption = grpc.WithDefaultCallOptions(hangOnResolveErrorCallOption)

Expand Down Expand Up @@ -86,7 +92,7 @@ func NewExternalClientConn(remoteAddr string, extraOpts ...grpc.DialOption) (*gr
}

// NewClientConn creates a default gRPC ClientConn with round robin, keepalive, OpenTelemetry tracing and
// large receive message size (max 1 GiB) configured.
// large receive message size (max [MaxResponseSize]) configured.
//
// If the remoteAddr starts with "xds://", it will use xDS credentials, transport credentials are not
// configured and default gRPC applies which is full TLS.
Expand Down
2 changes: 2 additions & 0 deletions server/standard/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap"
grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/streamingfast/dgrpc"
"github.com/streamingfast/dgrpc/server"
"github.com/streamingfast/dgrpc/server/tracelog"
"github.com/streamingfast/shutter"
Expand Down Expand Up @@ -410,6 +411,7 @@ func newGRPCServer(options *server.Options) *grpc.Server {
s := grpc.NewServer(
append([]grpc.ServerOption{
grpc.StatsHandler(otelgrpc.NewServerHandler(otelgrpc.WithTracerProvider(tracerProvider))),
grpc.MaxSendMsgSize(dgrpc.MaxResponseSize),
grpc.KeepaliveEnforcementPolicy(
keepalive.EnforcementPolicy{
MinTime: 15 * time.Second,
Expand Down
Loading