From e063b81a937f3cb2adbd1f1ea6c5dbcadac7eafc Mon Sep 17 00:00:00 2001 From: Michal Fiedorowicz Date: Tue, 27 Aug 2024 09:59:33 +0200 Subject: [PATCH] use generated types for ingester Signed-off-by: Michal Fiedorowicz --- diode/client.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/diode/client.go b/diode/client.go index 674ae5d..74be37a 100644 --- a/diode/client.go +++ b/diode/client.go @@ -93,7 +93,7 @@ type Client interface { Close() error // Ingest sends an ingest request to the ingester service - Ingest(context.Context, []*diodepb.Entity) (*diodepb.IngestResponse, error) + Ingest(context.Context, []Entity) (*diodepb.IngestResponse, error) } // GRPCClient is a gRPC implementation of the ingester service @@ -227,12 +227,17 @@ func (g *GRPCClient) Close() error { } // Ingest sends an ingest request to the ingester service -func (g *GRPCClient) Ingest(ctx context.Context, entities []*diodepb.Entity) (*diodepb.IngestResponse, error) { +func (g *GRPCClient) Ingest(ctx context.Context, entities []Entity) (*diodepb.IngestResponse, error) { stream := defaultStreamName + protoEntities := make([]*diodepb.Entity, 0) + for _, entity := range entities { + protoEntities = append(protoEntities, entity.ConvertToProtoEntity()) + } + req := &diodepb.IngestRequest{ Id: uuid.NewString(), - Entities: entities, + Entities: protoEntities, Stream: stream, ProducerAppName: g.appName, ProducerAppVersion: g.appVersion,