diff --git a/exporter/jaegerexporter/exporter.go b/exporter/jaegerexporter/exporter.go index 01b5cafc5f5..7c4efa28b58 100644 --- a/exporter/jaegerexporter/exporter.go +++ b/exporter/jaegerexporter/exporter.go @@ -19,6 +19,7 @@ import ( "fmt" jaegerproto "github.com/jaegertracing/jaeger/proto-gen/api_v2" + "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/metadata" @@ -32,7 +33,7 @@ import ( // newTraceExporter returns a new Jaeger gRPC exporter. // The exporter name is the name to be used in the observability of the exporter. // The collectorEndpoint should be of the form "hostname:14250" (a gRPC target). -func newTraceExporter(cfg *Config) (component.TraceExporter, error) { +func newTraceExporter(cfg *Config, logger *zap.Logger) (component.TraceExporter, error) { opts, err := cfg.GRPCClientSettings.ToDialOptions() if err != nil { @@ -46,6 +47,7 @@ func newTraceExporter(cfg *Config) (component.TraceExporter, error) { collectorServiceClient := jaegerproto.NewCollectorServiceClient(client) s := &protoGRPCSender{ + logger: logger, client: collectorServiceClient, metadata: metadata.New(cfg.GRPCClientSettings.Headers), waitForReady: cfg.WaitForReady, @@ -64,6 +66,7 @@ func newTraceExporter(cfg *Config) (component.TraceExporter, error) { // protoGRPCSender forwards spans encoded in the jaeger proto // format, to a grpc server. type protoGRPCSender struct { + logger *zap.Logger client jaegerproto.CollectorServiceClient metadata metadata.MD waitForReady bool @@ -89,6 +92,7 @@ func (s *protoGRPCSender) pushTraceData( ctx, &jaegerproto.PostSpansRequest{Batch: *batch}, grpc.WaitForReady(s.waitForReady)) if err != nil { + s.logger.Debug("failed to push trace data to Jaeger", zap.Error(err)) return td.SpanCount() - sentSpans, fmt.Errorf("failed to push trace data via Jaeger exporter: %w", err) } sentSpans += len(batch.Spans) diff --git a/exporter/jaegerexporter/exporter_test.go b/exporter/jaegerexporter/exporter_test.go index a2dbb1ef330..eec49650a46 100644 --- a/exporter/jaegerexporter/exporter_test.go +++ b/exporter/jaegerexporter/exporter_test.go @@ -25,6 +25,7 @@ import ( "github.com/jaegertracing/jaeger/proto-gen/api_v2" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/credentials" @@ -154,7 +155,7 @@ func TestNew(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := newTraceExporter(&tt.args.config) + got, err := newTraceExporter(&tt.args.config, zap.NewNop()) if (err != nil) != tt.wantErr { t.Errorf("newTraceExporter() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/exporter/jaegerexporter/factory.go b/exporter/jaegerexporter/factory.go index 0169b47a664..16fa2b36127 100644 --- a/exporter/jaegerexporter/factory.go +++ b/exporter/jaegerexporter/factory.go @@ -55,7 +55,7 @@ func createDefaultConfig() configmodels.Exporter { func createTraceExporter( _ context.Context, - _ component.ExporterCreateParams, + params component.ExporterCreateParams, config configmodels.Exporter, ) (component.TraceExporter, error) { @@ -68,7 +68,7 @@ func createTraceExporter( return nil, err } - exp, err := newTraceExporter(expCfg) + exp, err := newTraceExporter(expCfg, params.Logger) if err != nil { return nil, err }