diff --git a/cmd/collector/app/handler/grpc_handler.go b/cmd/collector/app/handler/grpc_handler.go index af9fdf49812..995fa141ed4 100644 --- a/cmd/collector/app/handler/grpc_handler.go +++ b/cmd/collector/app/handler/grpc_handler.go @@ -19,6 +19,7 @@ import ( "go.uber.org/zap" "google.golang.org/grpc/codes" + _ "google.golang.org/grpc/encoding/gzip" "google.golang.org/grpc/status" "github.com/jaegertracing/jaeger/cmd/collector/app/processor" diff --git a/cmd/collector/app/handler/grpc_handler_test.go b/cmd/collector/app/handler/grpc_handler_test.go index 83a3dcb0100..bcb30117d74 100644 --- a/cmd/collector/app/handler/grpc_handler_test.go +++ b/cmd/collector/app/handler/grpc_handler_test.go @@ -110,6 +110,23 @@ func TestPostSpans(t *testing.T) { } } +func TestGRPCCompressionEnabled(t *testing.T) { + processor := &mockSpanProcessor{} + server, addr := initializeGRPCTestServer(t, func(s *grpc.Server) { + handler := NewGRPCHandler(zap.NewNop(), processor) + api_v2.RegisterCollectorServiceServer(s, handler) + }) + defer server.Stop() + + client, conn := newClient(t, addr) + defer conn.Close() + + // Do not use string constant imported from grpc, since we are actually testing that package is imported by the handler. + _, err := client.PostSpans(context.Background(), &api_v2.PostSpansRequest{}, + grpc.UseCompressor("gzip")) + require.NoError(t, err) +} + func TestPostSpansWithError(t *testing.T) { expectedError := errors.New("test-error") processor := &mockSpanProcessor{expectedError: expectedError}