From 92d3c6fc4bdb5585804642bfc7a4a72554094f3a Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Tue, 15 Jun 2021 11:40:35 +0300 Subject: [PATCH] Remove usage of ToOtlpProtoBytes, will be removed after Marshaler is released (#3434) Signed-off-by: Bogdan Drutu --- receiver/kafkareceiver/kafka_receiver_test.go | 4 ++-- receiver/otlpreceiver/otlp_test.go | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/receiver/kafkareceiver/kafka_receiver_test.go b/receiver/kafkareceiver/kafka_receiver_test.go index fd73bda72fc..e8db37985df 100644 --- a/receiver/kafkareceiver/kafka_receiver_test.go +++ b/receiver/kafkareceiver/kafka_receiver_test.go @@ -217,7 +217,7 @@ func TestTracesConsumerGroupHandler_error_nextConsumer(t *testing.T) { td := pdata.NewTraces() td.ResourceSpans().AppendEmpty() - bts, err := td.ToOtlpProtoBytes() + bts, err := otlp.NewProtobufTracesMarshaler().Marshal(td) require.NoError(t, err) groupClaim.messageChan <- &sarama.ConsumerMessage{Value: bts} close(groupClaim.messageChan) @@ -401,7 +401,7 @@ func TestLogsConsumerGroupHandler_error_nextConsumer(t *testing.T) { }() ld := testdata.GenerateLogsOneLogRecord() - bts, err := ld.ToOtlpProtoBytes() + bts, err := otlp.NewProtobufLogsMarshaler().Marshal(ld) require.NoError(t, err) groupClaim.messageChan <- &sarama.ConsumerMessage{Value: bts} close(groupClaim.messageChan) diff --git a/receiver/otlpreceiver/otlp_test.go b/receiver/otlpreceiver/otlp_test.go index 665014e7204..3fcb0a8bede 100644 --- a/receiver/otlpreceiver/otlp_test.go +++ b/receiver/otlpreceiver/otlp_test.go @@ -47,6 +47,7 @@ import ( "go.opentelemetry.io/collector/consumer/pdata" collectortrace "go.opentelemetry.io/collector/internal/data/protogen/collector/trace/v1" "go.opentelemetry.io/collector/internal/internalconsumertest" + "go.opentelemetry.io/collector/internal/otlp" "go.opentelemetry.io/collector/internal/pdatagrpc" "go.opentelemetry.io/collector/internal/testdata" "go.opentelemetry.io/collector/obsreport/obsreporttest" @@ -253,8 +254,8 @@ func TestProtoHttp(t *testing.T) { // Wait for the servers to start <-time.After(10 * time.Millisecond) - traceData := testdata.GenerateTracesOneSpan() - traceBytes, err := traceData.ToOtlpProtoBytes() + td := testdata.GenerateTracesOneSpan() + traceBytes, err := otlp.NewProtobufTracesMarshaler().Marshal(td) if err != nil { t.Errorf("Error marshaling protobuf: %v", err) } @@ -270,7 +271,7 @@ func TestProtoHttp(t *testing.T) { t.Run(test.name+targetURLPath, func(t *testing.T) { url := fmt.Sprintf("http://%s%s", addr, targetURLPath) tSink.Reset() - testHTTPProtobufRequest(t, url, tSink, test.encoding, traceBytes, test.err, traceData) + testHTTPProtobufRequest(t, url, tSink, test.encoding, traceBytes, test.err, td) }) } } @@ -682,7 +683,7 @@ func TestShutdown(t *testing.T) { } senderHTTP := func(td pdata.Traces) { // Send request via OTLP/HTTP. - traceBytes, err2 := td.ToOtlpProtoBytes() + traceBytes, err2 := otlp.NewProtobufTracesMarshaler().Marshal(td) if err2 != nil { t.Errorf("Error marshaling protobuf: %v", err2) }