Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporterhelper] Reconsider the Go interface for the new exporter helper #8950

Open
Tracked by #8122
dmitryax opened this issue Nov 17, 2023 · 1 comment
Open
Tracked by #8122

Comments

@dmitryax
Copy link
Member

I got feedback from a user of the new interface that having Export() function as part of the Request interface is pretty inconvenient if they need to pass a state between the calls like a client etc. Probably, we should consistently move towards functions instead of interfaces so users can provide methods of their custom exporter like myExporter.convert, myExporter.mergeBatches and myExporter.export if needed. The interface would be

func NewLogsRequestExporter(
	_ context.Context,
	set exporter.CreateSettings,
	convertFunc ConvertLogsFunc,
	exportFunc ExportFunc,
	options ...Option,
) (exporter.Logs, error)

cc @bogdandrutu WDYT?

@splunkericl
Copy link
Contributor

+1 on this github issue. The issue we run into with the previous implementation is that:

  • Request.Export is encapsulated by itself, the client used to export data needs to be wrapped inside Request
  • Request needs to be marshalled and unmarshalled, it becomes more expensive as the client needs to be marshalled/unmarshalled. if the client maintains any states(i.e: TCP connection) it is gone.

The suggested pattern is similar to previous implementation, users can provide the function like:

client := newClient()
return NewLogsRequestExporter(ctx, set, converterFunc, client.Exporter)

So the client state is maintained

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants