Skip to content

Commit

Permalink
Remove usage of ToOtlpProtoBytes, will be removed after Marshaler is …
Browse files Browse the repository at this point in the history
…released (open-telemetry#3434)

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Jun 15, 2021
1 parent 4c503dd commit 92d3c6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions receiver/kafkareceiver/kafka_receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions receiver/otlpreceiver/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
})
}
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 92d3c6f

Please sign in to comment.