Skip to content

Commit

Permalink
Enable gzip compression for collector grpc endpoint.
Browse files Browse the repository at this point in the history
Signed-off-by: Fedor Korotkiy <dartslon@gmail.com>
  • Loading branch information
slon committed Sep 6, 2021
1 parent 8427e01 commit 0375e50
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/collector/app/handler/grpc_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 17 additions & 0 deletions cmd/collector/app/handler/grpc_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 0375e50

Please sign in to comment.