From 75ebb88e22988d6b73f5325f0c47118c21c1f5d5 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Mon, 28 Jun 2021 14:59:02 -0700 Subject: [PATCH] Move internal/pdatagrpc to model/otlpgrpc (#3507) Signed-off-by: Bogdan Drutu --- config/configgrpc/configgrpc_test.go | 14 ++++++------- exporter/otlpexporter/otlp.go | 14 ++++++------- exporter/otlpexporter/otlp_test.go | 20 +++++++++---------- .../pdatagrpc => model/otlpgrpc}/logs.go | 2 +- .../pdatagrpc => model/otlpgrpc}/metrics.go | 2 +- .../pdatagrpc => model/otlpgrpc}/traces.go | 2 +- receiver/otlpreceiver/internal/logs/otlp.go | 8 ++++---- .../otlpreceiver/internal/logs/otlp_test.go | 10 +++++----- .../otlpreceiver/internal/metrics/otlp.go | 8 ++++---- .../internal/metrics/otlp_test.go | 10 +++++----- receiver/otlpreceiver/internal/trace/otlp.go | 8 ++++---- .../otlpreceiver/internal/trace/otlp_test.go | 10 +++++----- receiver/otlpreceiver/otlp.go | 8 ++++---- receiver/otlpreceiver/otlp_test.go | 4 ++-- receiver/otlpreceiver/otlphttp.go | 6 +++--- 15 files changed, 63 insertions(+), 63 deletions(-) rename {internal/pdatagrpc => model/otlpgrpc}/logs.go (99%) rename {internal/pdatagrpc => model/otlpgrpc}/metrics.go (99%) rename {internal/pdatagrpc => model/otlpgrpc}/traces.go (99%) diff --git a/config/configgrpc/configgrpc_test.go b/config/configgrpc/configgrpc_test.go index b474190f186..993eb70c9b2 100644 --- a/config/configgrpc/configgrpc_test.go +++ b/config/configgrpc/configgrpc_test.go @@ -32,7 +32,7 @@ import ( "go.opentelemetry.io/collector/config/configauth" "go.opentelemetry.io/collector/config/confignet" "go.opentelemetry.io/collector/config/configtls" - "go.opentelemetry.io/collector/internal/pdatagrpc" + "go.opentelemetry.io/collector/model/otlpgrpc" "go.opentelemetry.io/collector/model/pdata" ) @@ -453,7 +453,7 @@ func TestHttpReception(t *testing.T) { opts, err := gss.ToServerOption(map[config.ComponentID]component.Extension{}) assert.NoError(t, err) s := grpc.NewServer(opts...) - pdatagrpc.RegisterTracesServer(s, &grpcTraceServer{}) + otlpgrpc.RegisterTracesServer(s, &grpcTraceServer{}) go func() { _ = s.Serve(ln) @@ -467,7 +467,7 @@ func TestHttpReception(t *testing.T) { assert.NoError(t, errClient) grpcClientConn, errDial := grpc.Dial(gcs.Endpoint, clientOpts...) assert.NoError(t, errDial) - client := pdatagrpc.NewTracesClient(grpcClientConn) + client := otlpgrpc.NewTracesClient(grpcClientConn) ctx, cancelFunc := context.WithTimeout(context.Background(), 2*time.Second) resp, errResp := client.Export(ctx, pdata.NewTraces(), grpc.WaitForReady(true)) if tt.hasError { @@ -498,7 +498,7 @@ func TestReceiveOnUnixDomainSocket(t *testing.T) { opts, err := gss.ToServerOption(map[config.ComponentID]component.Extension{}) assert.NoError(t, err) s := grpc.NewServer(opts...) - pdatagrpc.RegisterTracesServer(s, &grpcTraceServer{}) + otlpgrpc.RegisterTracesServer(s, &grpcTraceServer{}) go func() { _ = s.Serve(ln) @@ -514,7 +514,7 @@ func TestReceiveOnUnixDomainSocket(t *testing.T) { assert.NoError(t, errClient) grpcClientConn, errDial := grpc.Dial(gcs.Endpoint, clientOpts...) assert.NoError(t, errDial) - client := pdatagrpc.NewTracesClient(grpcClientConn) + client := otlpgrpc.NewTracesClient(grpcClientConn) ctx, cancelFunc := context.WithTimeout(context.Background(), 2*time.Second) resp, errResp := client.Export(ctx, pdata.NewTraces(), grpc.WaitForReady(true)) assert.NoError(t, errResp) @@ -525,8 +525,8 @@ func TestReceiveOnUnixDomainSocket(t *testing.T) { type grpcTraceServer struct{} -func (gts *grpcTraceServer) Export(context.Context, pdata.Traces) (pdatagrpc.TracesResponse, error) { - return pdatagrpc.NewTracesResponse(), nil +func (gts *grpcTraceServer) Export(context.Context, pdata.Traces) (otlpgrpc.TracesResponse, error) { + return otlpgrpc.NewTracesResponse(), nil } // tempSocketName provides a temporary Unix socket name for testing. diff --git a/exporter/otlpexporter/otlp.go b/exporter/otlpexporter/otlp.go index aa13028d845..b592d790ceb 100644 --- a/exporter/otlpexporter/otlp.go +++ b/exporter/otlpexporter/otlp.go @@ -30,7 +30,7 @@ import ( "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/consumer/consumererror" "go.opentelemetry.io/collector/exporter/exporterhelper" - "go.opentelemetry.io/collector/internal/pdatagrpc" + "go.opentelemetry.io/collector/model/otlpgrpc" "go.opentelemetry.io/collector/model/pdata" ) @@ -86,9 +86,9 @@ func (e *exporter) pushLogs(ctx context.Context, ld pdata.Logs) error { type grpcSender struct { // gRPC clients and connection. - traceExporter pdatagrpc.TracesClient - metricExporter pdatagrpc.MetricsClient - logExporter pdatagrpc.LogsClient + traceExporter otlpgrpc.TracesClient + metricExporter otlpgrpc.MetricsClient + logExporter otlpgrpc.LogsClient clientConn *grpc.ClientConn metadata metadata.MD callOptions []grpc.CallOption @@ -106,9 +106,9 @@ func newGrpcSender(config *Config, ext map[config.ComponentID]component.Extensio } gs := &grpcSender{ - traceExporter: pdatagrpc.NewTracesClient(clientConn), - metricExporter: pdatagrpc.NewMetricsClient(clientConn), - logExporter: pdatagrpc.NewLogsClient(clientConn), + traceExporter: otlpgrpc.NewTracesClient(clientConn), + metricExporter: otlpgrpc.NewMetricsClient(clientConn), + logExporter: otlpgrpc.NewLogsClient(clientConn), clientConn: clientConn, metadata: metadata.New(config.GRPCClientSettings.Headers), callOptions: []grpc.CallOption{ diff --git a/exporter/otlpexporter/otlp_test.go b/exporter/otlpexporter/otlp_test.go index 4ee6612cf3d..1249f6d3182 100644 --- a/exporter/otlpexporter/otlp_test.go +++ b/exporter/otlpexporter/otlp_test.go @@ -31,8 +31,8 @@ import ( "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/config/configtls" - "go.opentelemetry.io/collector/internal/pdatagrpc" "go.opentelemetry.io/collector/internal/testdata" + "go.opentelemetry.io/collector/model/otlpgrpc" "go.opentelemetry.io/collector/model/pdata" ) @@ -55,14 +55,14 @@ type mockTracesReceiver struct { lastRequest pdata.Traces } -func (r *mockTracesReceiver) Export(ctx context.Context, td pdata.Traces) (pdatagrpc.TracesResponse, error) { +func (r *mockTracesReceiver) Export(ctx context.Context, td pdata.Traces) (otlpgrpc.TracesResponse, error) { atomic.AddInt32(&r.requestCount, 1) atomic.AddInt32(&r.totalItems, int32(td.SpanCount())) r.mux.Lock() defer r.mux.Unlock() r.lastRequest = td r.metadata, _ = metadata.FromIncomingContext(ctx) - return pdatagrpc.NewTracesResponse(), nil + return otlpgrpc.NewTracesResponse(), nil } func (r *mockTracesReceiver) GetLastRequest() pdata.Traces { @@ -79,7 +79,7 @@ func otlpTracesReceiverOnGRPCServer(ln net.Listener) *mockTracesReceiver { } // Now run it as a gRPC server - pdatagrpc.RegisterTracesServer(rcv.srv, rcv) + otlpgrpc.RegisterTracesServer(rcv.srv, rcv) go func() { _ = rcv.srv.Serve(ln) }() @@ -92,14 +92,14 @@ type mockLogsReceiver struct { lastRequest pdata.Logs } -func (r *mockLogsReceiver) Export(ctx context.Context, ld pdata.Logs) (pdatagrpc.LogsResponse, error) { +func (r *mockLogsReceiver) Export(ctx context.Context, ld pdata.Logs) (otlpgrpc.LogsResponse, error) { atomic.AddInt32(&r.requestCount, 1) atomic.AddInt32(&r.totalItems, int32(ld.LogRecordCount())) r.mux.Lock() defer r.mux.Unlock() r.lastRequest = ld r.metadata, _ = metadata.FromIncomingContext(ctx) - return pdatagrpc.NewLogsResponse(), nil + return otlpgrpc.NewLogsResponse(), nil } func (r *mockLogsReceiver) GetLastRequest() pdata.Logs { @@ -116,7 +116,7 @@ func otlpLogsReceiverOnGRPCServer(ln net.Listener) *mockLogsReceiver { } // Now run it as a gRPC server - pdatagrpc.RegisterLogsServer(rcv.srv, rcv) + otlpgrpc.RegisterLogsServer(rcv.srv, rcv) go func() { _ = rcv.srv.Serve(ln) }() @@ -129,7 +129,7 @@ type mockMetricsReceiver struct { lastRequest pdata.Metrics } -func (r *mockMetricsReceiver) Export(ctx context.Context, md pdata.Metrics) (pdatagrpc.MetricsResponse, error) { +func (r *mockMetricsReceiver) Export(ctx context.Context, md pdata.Metrics) (otlpgrpc.MetricsResponse, error) { atomic.AddInt32(&r.requestCount, 1) _, recordCount := md.MetricAndDataPointCount() atomic.AddInt32(&r.totalItems, int32(recordCount)) @@ -137,7 +137,7 @@ func (r *mockMetricsReceiver) Export(ctx context.Context, md pdata.Metrics) (pda defer r.mux.Unlock() r.lastRequest = md r.metadata, _ = metadata.FromIncomingContext(ctx) - return pdatagrpc.NewMetricsResponse(), nil + return otlpgrpc.NewMetricsResponse(), nil } func (r *mockMetricsReceiver) GetLastRequest() pdata.Metrics { @@ -154,7 +154,7 @@ func otlpMetricsReceiverOnGRPCServer(ln net.Listener) *mockMetricsReceiver { } // Now run it as a gRPC server - pdatagrpc.RegisterMetricsServer(rcv.srv, rcv) + otlpgrpc.RegisterMetricsServer(rcv.srv, rcv) go func() { _ = rcv.srv.Serve(ln) }() diff --git a/internal/pdatagrpc/logs.go b/model/otlpgrpc/logs.go similarity index 99% rename from internal/pdatagrpc/logs.go rename to model/otlpgrpc/logs.go index 6b2009f9dab..2822c2de3f5 100644 --- a/internal/pdatagrpc/logs.go +++ b/model/otlpgrpc/logs.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package pdatagrpc +package otlpgrpc import ( "context" diff --git a/internal/pdatagrpc/metrics.go b/model/otlpgrpc/metrics.go similarity index 99% rename from internal/pdatagrpc/metrics.go rename to model/otlpgrpc/metrics.go index 46c212810b3..d9d7798ca4b 100644 --- a/internal/pdatagrpc/metrics.go +++ b/model/otlpgrpc/metrics.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package pdatagrpc +package otlpgrpc import ( "context" diff --git a/internal/pdatagrpc/traces.go b/model/otlpgrpc/traces.go similarity index 99% rename from internal/pdatagrpc/traces.go rename to model/otlpgrpc/traces.go index c581073aa79..a793f7b8a47 100644 --- a/internal/pdatagrpc/traces.go +++ b/model/otlpgrpc/traces.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package pdatagrpc +package otlpgrpc import ( "context" diff --git a/receiver/otlpreceiver/internal/logs/otlp.go b/receiver/otlpreceiver/internal/logs/otlp.go index 33d87ff653d..fcdb95643d3 100644 --- a/receiver/otlpreceiver/internal/logs/otlp.go +++ b/receiver/otlpreceiver/internal/logs/otlp.go @@ -20,7 +20,7 @@ import ( "go.opentelemetry.io/collector/client" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/internal/pdatagrpc" + "go.opentelemetry.io/collector/model/otlpgrpc" "go.opentelemetry.io/collector/model/pdata" "go.opentelemetry.io/collector/obsreport" ) @@ -54,15 +54,15 @@ const ( var receiverID = config.NewIDWithName("otlp", "log") // Export implements the service Export logs func. -func (r *Receiver) Export(ctx context.Context, ld pdata.Logs) (pdatagrpc.LogsResponse, error) { +func (r *Receiver) Export(ctx context.Context, ld pdata.Logs) (otlpgrpc.LogsResponse, error) { // We need to ensure that it propagates the receiver name as a tag ctxWithReceiverName := obsreport.ReceiverContext(ctx, r.id, receiverTransport) err := r.sendToNextConsumer(ctxWithReceiverName, ld) if err != nil { - return pdatagrpc.LogsResponse{}, err + return otlpgrpc.LogsResponse{}, err } - return pdatagrpc.NewLogsResponse(), nil + return otlpgrpc.NewLogsResponse(), nil } func (r *Receiver) sendToNextConsumer(ctx context.Context, ld pdata.Logs) error { diff --git a/receiver/otlpreceiver/internal/logs/otlp_test.go b/receiver/otlpreceiver/internal/logs/otlp_test.go index d0979320def..941fda0a51b 100644 --- a/receiver/otlpreceiver/internal/logs/otlp_test.go +++ b/receiver/otlpreceiver/internal/logs/otlp_test.go @@ -26,8 +26,8 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" - "go.opentelemetry.io/collector/internal/pdatagrpc" "go.opentelemetry.io/collector/internal/testdata" + "go.opentelemetry.io/collector/model/otlpgrpc" "go.opentelemetry.io/collector/model/pdata" ) @@ -84,16 +84,16 @@ func TestExport_ErrorConsumer(t *testing.T) { resp, err := logClient.Export(context.Background(), req) assert.EqualError(t, err, "rpc error: code = Unknown desc = my error") - assert.Equal(t, pdatagrpc.LogsResponse{}, resp) + assert.Equal(t, otlpgrpc.LogsResponse{}, resp) } -func makeLogsServiceClient(addr net.Addr) (pdatagrpc.LogsClient, func(), error) { +func makeLogsServiceClient(addr net.Addr) (otlpgrpc.LogsClient, func(), error) { cc, err := grpc.Dial(addr.String(), grpc.WithInsecure(), grpc.WithBlock()) if err != nil { return nil, nil, err } - logClient := pdatagrpc.NewLogsClient(cc) + logClient := otlpgrpc.NewLogsClient(cc) doneFn := func() { _ = cc.Close() } return logClient, doneFn, nil @@ -115,7 +115,7 @@ func otlpReceiverOnGRPCServer(t *testing.T, tc consumer.Logs) (net.Addr, func()) // Now run it as a gRPC server srv := grpc.NewServer() - pdatagrpc.RegisterLogsServer(srv, r) + otlpgrpc.RegisterLogsServer(srv, r) go func() { _ = srv.Serve(ln) }() diff --git a/receiver/otlpreceiver/internal/metrics/otlp.go b/receiver/otlpreceiver/internal/metrics/otlp.go index 78427a039af..3b4fc2d1a08 100644 --- a/receiver/otlpreceiver/internal/metrics/otlp.go +++ b/receiver/otlpreceiver/internal/metrics/otlp.go @@ -20,7 +20,7 @@ import ( "go.opentelemetry.io/collector/client" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/internal/pdatagrpc" + "go.opentelemetry.io/collector/model/otlpgrpc" "go.opentelemetry.io/collector/model/pdata" "go.opentelemetry.io/collector/obsreport" ) @@ -53,14 +53,14 @@ const ( var receiverID = config.NewIDWithName("otlp", "metrics") // Export implements the service Export metrics func. -func (r *Receiver) Export(ctx context.Context, md pdata.Metrics) (pdatagrpc.MetricsResponse, error) { +func (r *Receiver) Export(ctx context.Context, md pdata.Metrics) (otlpgrpc.MetricsResponse, error) { receiverCtx := obsreport.ReceiverContext(ctx, r.id, receiverTransport) err := r.sendToNextConsumer(receiverCtx, md) if err != nil { - return pdatagrpc.MetricsResponse{}, err + return otlpgrpc.MetricsResponse{}, err } - return pdatagrpc.NewMetricsResponse(), nil + return otlpgrpc.NewMetricsResponse(), nil } func (r *Receiver) sendToNextConsumer(ctx context.Context, md pdata.Metrics) error { diff --git a/receiver/otlpreceiver/internal/metrics/otlp_test.go b/receiver/otlpreceiver/internal/metrics/otlp_test.go index e3a6e40bd15..54b66c23d71 100644 --- a/receiver/otlpreceiver/internal/metrics/otlp_test.go +++ b/receiver/otlpreceiver/internal/metrics/otlp_test.go @@ -26,8 +26,8 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" - "go.opentelemetry.io/collector/internal/pdatagrpc" "go.opentelemetry.io/collector/internal/testdata" + "go.opentelemetry.io/collector/model/otlpgrpc" "go.opentelemetry.io/collector/model/pdata" ) @@ -93,16 +93,16 @@ func TestExport_ErrorConsumer(t *testing.T) { resp, err := metricsClient.Export(context.Background(), req) assert.EqualError(t, err, "rpc error: code = Unknown desc = my error") - assert.Equal(t, pdatagrpc.MetricsResponse{}, resp) + assert.Equal(t, otlpgrpc.MetricsResponse{}, resp) } -func makeMetricsServiceClient(addr net.Addr) (pdatagrpc.MetricsClient, func(), error) { +func makeMetricsServiceClient(addr net.Addr) (otlpgrpc.MetricsClient, func(), error) { cc, err := grpc.Dial(addr.String(), grpc.WithInsecure(), grpc.WithBlock()) if err != nil { return nil, nil, err } - metricsClient := pdatagrpc.NewMetricsClient(cc) + metricsClient := otlpgrpc.NewMetricsClient(cc) doneFn := func() { _ = cc.Close() } return metricsClient, doneFn, nil @@ -122,7 +122,7 @@ func otlpReceiverOnGRPCServer(t *testing.T, mc consumer.Metrics) (net.Addr, func r := New(receiverID, mc) // Now run it as a gRPC server srv := grpc.NewServer() - pdatagrpc.RegisterMetricsServer(srv, r) + otlpgrpc.RegisterMetricsServer(srv, r) go func() { _ = srv.Serve(ln) }() diff --git a/receiver/otlpreceiver/internal/trace/otlp.go b/receiver/otlpreceiver/internal/trace/otlp.go index 9c015291336..bff0e92fa9e 100644 --- a/receiver/otlpreceiver/internal/trace/otlp.go +++ b/receiver/otlpreceiver/internal/trace/otlp.go @@ -20,7 +20,7 @@ import ( "go.opentelemetry.io/collector/client" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/consumer" - "go.opentelemetry.io/collector/internal/pdatagrpc" + "go.opentelemetry.io/collector/model/otlpgrpc" "go.opentelemetry.io/collector/model/pdata" "go.opentelemetry.io/collector/obsreport" ) @@ -54,15 +54,15 @@ const ( var receiverID = config.NewIDWithName("otlp", "trace") // Export implements the service Export traces func. -func (r *Receiver) Export(ctx context.Context, td pdata.Traces) (pdatagrpc.TracesResponse, error) { +func (r *Receiver) Export(ctx context.Context, td pdata.Traces) (otlpgrpc.TracesResponse, error) { // We need to ensure that it propagates the receiver name as a tag ctxWithReceiverName := obsreport.ReceiverContext(ctx, r.id, receiverTransport) err := r.sendToNextConsumer(ctxWithReceiverName, td) if err != nil { - return pdatagrpc.TracesResponse{}, err + return otlpgrpc.TracesResponse{}, err } - return pdatagrpc.NewTracesResponse(), nil + return otlpgrpc.NewTracesResponse(), nil } func (r *Receiver) sendToNextConsumer(ctx context.Context, td pdata.Traces) error { diff --git a/receiver/otlpreceiver/internal/trace/otlp_test.go b/receiver/otlpreceiver/internal/trace/otlp_test.go index 0c455d43cc2..7b2599ac1bd 100644 --- a/receiver/otlpreceiver/internal/trace/otlp_test.go +++ b/receiver/otlpreceiver/internal/trace/otlp_test.go @@ -26,8 +26,8 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/consumer/consumertest" - "go.opentelemetry.io/collector/internal/pdatagrpc" "go.opentelemetry.io/collector/internal/testdata" + "go.opentelemetry.io/collector/model/otlpgrpc" "go.opentelemetry.io/collector/model/pdata" ) @@ -86,16 +86,16 @@ func TestExport_ErrorConsumer(t *testing.T) { req := testdata.GenerateTracesOneSpan() resp, err := traceClient.Export(context.Background(), req) assert.EqualError(t, err, "rpc error: code = Unknown desc = my error") - assert.Equal(t, pdatagrpc.TracesResponse{}, resp) + assert.Equal(t, otlpgrpc.TracesResponse{}, resp) } -func makeTraceServiceClient(addr net.Addr) (pdatagrpc.TracesClient, func(), error) { +func makeTraceServiceClient(addr net.Addr) (otlpgrpc.TracesClient, func(), error) { cc, err := grpc.Dial(addr.String(), grpc.WithInsecure(), grpc.WithBlock()) if err != nil { return nil, nil, err } - metricsClient := pdatagrpc.NewTracesClient(cc) + metricsClient := otlpgrpc.NewTracesClient(cc) doneFn := func() { _ = cc.Close() } return metricsClient, doneFn, nil @@ -117,7 +117,7 @@ func otlpReceiverOnGRPCServer(t *testing.T, tc consumer.Traces) (net.Addr, func( // Now run it as a gRPC server srv := grpc.NewServer() - pdatagrpc.RegisterTracesServer(srv, r) + otlpgrpc.RegisterTracesServer(srv, r) go func() { _ = srv.Serve(ln) }() diff --git a/receiver/otlpreceiver/otlp.go b/receiver/otlpreceiver/otlp.go index d3cade21fe1..0796021d770 100644 --- a/receiver/otlpreceiver/otlp.go +++ b/receiver/otlpreceiver/otlp.go @@ -30,7 +30,7 @@ import ( "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/internal/otlp" - "go.opentelemetry.io/collector/internal/pdatagrpc" + "go.opentelemetry.io/collector/model/otlpgrpc" "go.opentelemetry.io/collector/receiver/otlpreceiver/internal/logs" "go.opentelemetry.io/collector/receiver/otlpreceiver/internal/metrics" "go.opentelemetry.io/collector/receiver/otlpreceiver/internal/trace" @@ -118,15 +118,15 @@ func (r *otlpReceiver) startProtocolServers(host component.Host) error { r.serverGRPC = grpc.NewServer(opts...) if r.traceReceiver != nil { - pdatagrpc.RegisterTracesServer(r.serverGRPC, r.traceReceiver) + otlpgrpc.RegisterTracesServer(r.serverGRPC, r.traceReceiver) } if r.metricsReceiver != nil { - pdatagrpc.RegisterMetricsServer(r.serverGRPC, r.metricsReceiver) + otlpgrpc.RegisterMetricsServer(r.serverGRPC, r.metricsReceiver) } if r.logReceiver != nil { - pdatagrpc.RegisterLogsServer(r.serverGRPC, r.logReceiver) + otlpgrpc.RegisterLogsServer(r.serverGRPC, r.logReceiver) } err = r.startGRPCServer(r.cfg.GRPC, host) diff --git a/receiver/otlpreceiver/otlp_test.go b/receiver/otlpreceiver/otlp_test.go index 56c41093ef0..d2b3d72e9b4 100644 --- a/receiver/otlpreceiver/otlp_test.go +++ b/receiver/otlpreceiver/otlp_test.go @@ -47,8 +47,8 @@ import ( 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/model/otlpgrpc" "go.opentelemetry.io/collector/model/pdata" "go.opentelemetry.io/collector/obsreport/obsreporttest" "go.opentelemetry.io/collector/testutil" @@ -752,7 +752,7 @@ loop: } func exportTraces(cc *grpc.ClientConn, td pdata.Traces) error { - acc := pdatagrpc.NewTracesClient(cc) + acc := otlpgrpc.NewTracesClient(cc) _, err := acc.Export(context.Background(), td) return err diff --git a/receiver/otlpreceiver/otlphttp.go b/receiver/otlpreceiver/otlphttp.go index efcaf146e47..16ad9b25d26 100644 --- a/receiver/otlpreceiver/otlphttp.go +++ b/receiver/otlpreceiver/otlphttp.go @@ -56,7 +56,7 @@ func handleTraces( return } - // TODO: Pass response from grpc handler when pdatagrpc returns concrete type. + // TODO: Pass response from grpc handler when otlpgrpc returns concrete type. writeResponse(resp, contentType, http.StatusOK, &types.Empty{}) } @@ -83,7 +83,7 @@ func handleMetrics( return } - // TODO: Pass response from grpc handler when pdatagrpc returns concrete type. + // TODO: Pass response from grpc handler when otlpgrpc returns concrete type. writeResponse(resp, contentType, http.StatusOK, &types.Empty{}) } @@ -110,7 +110,7 @@ func handleLogs( return } - // TODO: Pass response from grpc handler when pdatagrpc returns concrete type. + // TODO: Pass response from grpc handler when otlpgrpc returns concrete type. writeResponse(resp, contentType, http.StatusOK, &types.Empty{}) }