diff --git a/processor/batchprocessor/batch_processor.go b/processor/batchprocessor/batch_processor.go index 40896dbb9a2..6a43d064216 100644 --- a/processor/batchprocessor/batch_processor.go +++ b/processor/batchprocessor/batch_processor.go @@ -227,7 +227,7 @@ type batchTraces struct { } func newBatchTraces(nextConsumer consumer.Traces) *batchTraces { - return &batchTraces{nextConsumer: nextConsumer, traceData: ptrace.NewTraces(), sizer: ptrace.NewProtoMarshaler().(ptrace.Sizer)} + return &batchTraces{nextConsumer: nextConsumer, traceData: ptrace.NewTraces(), sizer: ptrace.NewProtoMarshaler()} } // add updates current batchTraces by adding new TraceData object @@ -274,7 +274,7 @@ type batchMetrics struct { } func newBatchMetrics(nextConsumer consumer.Metrics) *batchMetrics { - return &batchMetrics{nextConsumer: nextConsumer, metricData: pmetric.NewMetrics(), sizer: pmetric.NewProtoMarshaler().(pmetric.Sizer)} + return &batchMetrics{nextConsumer: nextConsumer, metricData: pmetric.NewMetrics(), sizer: pmetric.NewProtoMarshaler()} } func (bm *batchMetrics) export(ctx context.Context, sendBatchMaxSize int, returnBytes bool) (int, int, error) { @@ -320,7 +320,7 @@ type batchLogs struct { } func newBatchLogs(nextConsumer consumer.Logs) *batchLogs { - return &batchLogs{nextConsumer: nextConsumer, logData: plog.NewLogs(), sizer: plog.NewProtoMarshaler().(plog.Sizer)} + return &batchLogs{nextConsumer: nextConsumer, logData: plog.NewLogs(), sizer: plog.NewProtoMarshaler()} } func (bl *batchLogs) export(ctx context.Context, sendBatchMaxSize int, returnBytes bool) (int, int, error) { diff --git a/processor/batchprocessor/batch_processor_test.go b/processor/batchprocessor/batch_processor_test.go index c5ccb57afbc..15df36328a2 100644 --- a/processor/batchprocessor/batch_processor_test.go +++ b/processor/batchprocessor/batch_processor_test.go @@ -122,7 +122,7 @@ func TestBatchProcessorSpansDeliveredEnforceBatchSize(t *testing.T) { } func TestBatchProcessorSentBySize(t *testing.T) { - sizer := ptrace.NewProtoMarshaler().(ptrace.Sizer) + sizer := ptrace.NewProtoMarshaler() views := MetricViews() require.NoError(t, view.Register(views...)) defer view.Unregister(views...) @@ -359,7 +359,7 @@ func TestBatchMetricProcessor_ReceivingData(t *testing.T) { } func TestBatchMetricProcessor_BatchSize(t *testing.T) { - sizer := pmetric.NewProtoMarshaler().(pmetric.Sizer) + sizer := pmetric.NewProtoMarshaler() views := MetricViews() require.NoError(t, view.Register(views...)) defer view.Unregister(views...) @@ -564,7 +564,7 @@ func getTestMetricName(requestNum, index int) string { } func BenchmarkTraceSizeBytes(b *testing.B) { - sizer := ptrace.NewProtoMarshaler().(ptrace.Sizer) + sizer := ptrace.NewProtoMarshaler() td := testdata.GenerateTraces(8192) for n := 0; n < b.N; n++ { fmt.Println(sizer.TracesSize(td)) @@ -677,7 +677,7 @@ func TestBatchLogProcessor_ReceivingData(t *testing.T) { } func TestBatchLogProcessor_BatchSize(t *testing.T) { - sizer := plog.NewProtoMarshaler().(plog.Sizer) + sizer := plog.NewProtoMarshaler() views := MetricViews() require.NoError(t, view.Register(views...)) defer view.Unregister(views...)