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

Update OTLP exporter to send different signals to different endpoints #1121

Closed
MrAlias opened this issue Sep 3, 2020 · 6 comments · Fixed by #1418
Closed

Update OTLP exporter to send different signals to different endpoints #1121

MrAlias opened this issue Sep 3, 2020 · 6 comments · Fixed by #1418
Assignees
Milestone

Comments

@MrAlias
Copy link
Contributor

MrAlias commented Sep 3, 2020

The OTLP exporter specification states the exporter needs to be able to send different signals (traces and metric events) to different endpoints. The current exporter design only supports sending to a single endpoint for both signals.

@stefanprisca
Copy link
Contributor

@MrAlias I would like to work on this.

Maybe a clean approach to this would be to separate the exporter logic (from otlp.go in two: MetricsExporter and TracesExporter. These are both internal structures, will have specific connection and export methods and can be configured separately. The existing OTLP Exporter then maintains the same client interface (together with the added options for configuring traces and metrics separately), and under the hood it delegates the actions to the two different exporters.

What do you think? Is there another design that you have in mind for this?

@MrAlias
Copy link
Contributor Author

MrAlias commented Sep 17, 2020

Maybe a clean approach to this would be to separate the exporter logic (from otlp.go in two: MetricsExporter and TracesExporter. These are both internal structures, will have specific connection and export methods and can be configured separately. The existing OTLP Exporter then maintains the same client interface (together with the added options for configuring traces and metrics separately), and under the hood it delegates the actions to the two different exporters.

I think I would need to see a prototype to really follow this, or if you are able to join the SIG meeting in an hour we could talk about this.

The important thing I would look for in a design would be the reusability of connection handling logic. The connections to the collector need to support things like back-off, retries, and likely more features in the future. It is important that this logic doesn't need to be duplicated in every signal that is configured.

@stefanprisca
Copy link
Contributor

stefanprisca commented Sep 20, 2020

I pushed a prototype on my own repo: https://github.com/stefanprisca/opentelemetry-go/tree/otlp-exporters-1121/exporters/otlp/1121
Here are some flow diagrams, and notes, showing the start logic for the connections: https://github.com/stefanprisca/opentelemetry-go/blob/otlp-exporters-1121/exporters/otlp/1121/OtlpExporterDesign-Page-1.png
There is also a functional example here, configuring two separate connections for traces and metrics: https://github.com/stefanprisca/opentelemetry-go/blob/otlp-exporters-1121/exporters/otlp/1121/example_test.go

The idea of the design is to have a configurable connection, which can be used by both metrics and traces.
By moving all the connection logic into a new otlpConnection object, the Exporter can make use of this to configure different connections for traces and metrics. Moreover, by using a newConnectionHandler callback, the Exporter can create specific metric/traces clients from the corresponding otlpConnections. These clients are then used to export the metrics and traces.
For example, creating the metrics connection is done as such:

e.metricsConnection = newOtlpConnection(e.handleNewMetricsConnection, config.metrics)
The handleNewMetricsConnection is the newConnectionHandler for metrics, which will create a colmetricpb.NewMetricsServiceClient grpc client for sending metrics. The second argument is the metrics specific configuration.

This design is a bit simpler than the initial one I proposed, as there are no separate metrics/traces exporters. Looking forward to hearing what you think!

@stefanprisca
Copy link
Contributor

@MrAlias should I continue with this design, and put together a pull request?

@MrAlias
Copy link
Contributor Author

MrAlias commented Sep 22, 2020

@stefanprisca sorry about the delay. Thank you for digging into this, your design docs are great! This looks like the approach I was thinking about and I think with your prototype it's clear that it is viable.

The only feedback I have on a potential change would the the options might be better abstracted. We could collapse the With*Address, With*Insecure, and With*GRPCDialOption options into something like WithMetricsConnectionConfig(c ConnectionConfig) and WithTracesConnectionConfig(c ConnectionConfig). But this is minor. I think your changes are definitely ready for a PR.

@stefanprisca
Copy link
Contributor

@MrAlias no worries, just wanted to check if you got a chance to look over the design :)

I submitted a PR, but it still needs a bit of polishing (build failing and CHANGELOG.md update) so it's in progress for now.

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

Successfully merging a pull request may close this issue.

3 participants