From 419cd555b822277d6fada4bb7d64198cbbcde928 Mon Sep 17 00:00:00 2001 From: Bence Csati Date: Wed, 4 Dec 2024 12:42:06 +0100 Subject: [PATCH] chore Signed-off-by: Bence Csati --- exporter.go | 13 ++++++------- factory.go | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/exporter.go b/exporter.go index a11cb84..06b5b7c 100644 --- a/exporter.go +++ b/exporter.go @@ -11,7 +11,6 @@ import ( fclient "github.com/IBM/fluent-forward-go/fluent/client" "github.com/IBM/fluent-forward-go/fluent/protocol" - fproto "github.com/IBM/fluent-forward-go/fluent/protocol" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/plog" @@ -87,7 +86,7 @@ func (f *fluentforwardExporter) connectForward() { func (f *fluentforwardExporter) pushLogData(ctx context.Context, ld plog.Logs) error { // move for loops into a translator - entries := []fproto.EntryExt{} + entries := []protocol.EntryExt{} rls := ld.ResourceLogs() for i := 0; i < rls.Len(); i++ { ills := rls.At(i).ScopeLogs() @@ -96,8 +95,8 @@ func (f *fluentforwardExporter) pushLogData(ctx context.Context, ld plog.Logs) e logs := ills.At(j).LogRecords() for k := 0; k < logs.Len(); k++ { log := logs.At(k) - entry := fproto.EntryExt{ - Timestamp: fproto.EventTimeNow(), + entry := protocol.EntryExt{ + Timestamp: protocol.EventTimeNow(), Record: f.convertLogToMap(log, rls.At(i)), } entries = append(entries, entry) @@ -176,7 +175,7 @@ func (f *fluentforwardExporter) convertLogToMap(lr plog.LogRecord, res plog.Reso type sendFunc func(string, protocol.EntryList) error -func (f *fluentforwardExporter) send(sendMethod sendFunc, entries []fproto.EntryExt) error { +func (f *fluentforwardExporter) send(sendMethod sendFunc, entries []protocol.EntryExt) error { err := sendMethod(f.config.Tag, entries) // sometimes the connection is lost, we try to reconnect and send the data again if err != nil { @@ -193,10 +192,10 @@ func (f *fluentforwardExporter) send(sendMethod sendFunc, entries []fproto.Entry return nil } -func (f *fluentforwardExporter) sendCompressed(entries []fproto.EntryExt) error { +func (f *fluentforwardExporter) sendCompressed(entries []protocol.EntryExt) error { return f.send(f.client.SendCompressed, entries) } -func (f *fluentforwardExporter) sendForward(entries []fproto.EntryExt) error { +func (f *fluentforwardExporter) sendForward(entries []protocol.EntryExt) error { return f.send(f.client.SendForward, entries) } diff --git a/factory.go b/factory.go index 44f6b37..32da6f2 100644 --- a/factory.go +++ b/factory.go @@ -62,7 +62,7 @@ func createLogsExporter(ctx context.Context, set exporter.Settings, config compo exporterConfig := config.(*Config) exp := newExporter(exporterConfig, set.TelemetrySettings) - return exporterhelper.NewLogsExporter( + return exporterhelper.NewLogs( ctx, set, config,