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

Refactor OTLP Metrics Exporters #3276

Closed
legendecas opened this issue Sep 26, 2022 · 7 comments · Fixed by #5159
Closed

Refactor OTLP Metrics Exporters #3276

legendecas opened this issue Sep 26, 2022 · 7 comments · Fixed by #5159

Comments

@legendecas
Copy link
Member

legendecas commented Sep 26, 2022

Currently, we have OTLP trace exporters to be implemented in an inherited class pattern:

OTLPTraceExporter (grpc) -> OTLPGRPCExporterNodeBase -> OTLPExporterBase
OTLPTraceExporter (HTTP)-> OTLPExporterNodeBase -> OTLPExporterBase
OTLPTraceExporter (proto) -> OTLPProtoExporterNodeBase -> OTLPExporterNodeBase -> OTLPExporterBase

On the other hand, the OTLP metric exporters are not in this pattern. The base OTLP metric exporter, a MetricExporter, has an internal metric exporter, which also implements the MetricExporter interface. This pattern looks abstruse to me.

Can the OTLP metric exporter be implemented without the intermediate exporter?

/cc @pichlermarc

@pichlermarc
Copy link
Member

Yes implementing this way should be possible. I originally introduced this as to not bloat up the PRs (#2871, #2893), as they were already way too large at that time.

The reason for that was that the OTLP Exporter expects a list of objects passed to the export() function. This worked for the Trace exporters as they are expecting a list of spans, but not for the Metrics Exporters, that pass a single ResourceMetrics instance. My solution for that was to introduce this Proxy, which kept the diff manageable, but looks, as you already said, abstruse and is far from the optimal solution. 🙁

My original intention was always to follow up with more refactoring PRs to simplify the exporters (and their tests), but I unfortunately never came around to doing it. If needed, I can prioritize this. 🙂

@legendecas
Copy link
Member Author

My original intention was always to follow up with more refactoring PRs to simplify the exporters (and their tests), but I unfortunately never came around to doing it. If needed, I can prioritize this. 🙂

No, not in a hurry as it is working now. I was opening this issue to see if this is intentional and if not we can track the progress here. Thank you for the clarification.

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Jan 30, 2023
@pichlermarc pichlermarc added this to the OTLP Exporter GA milestone Apr 13, 2023
@pichlermarc pichlermarc changed the title OTLP metric exporters implementation Refactor OTLP Metrics Exporter Apr 19, 2023
@pichlermarc pichlermarc changed the title Refactor OTLP Metrics Exporter Refactor OTLP Metrics Exporters Apr 19, 2023
@pichlermarc
Copy link
Member

With #5031 this now becomes a bit more actionable. I'll refine this issue once the PR is merged to reflect what needs to be done in a bit more detail. 🙂

@pichlermarc
Copy link
Member

Actually, the leftovers from this can be handled in one simple follow-up.

#5031 removes the last of these proxy implementations. Once it is merged, I'll follow up with another PR to removing the array-wrapping inside the exporters, as that can be handled by the json/proto serializers (away from the public API) now.

@pichlermarc
Copy link
Member

Assigning myself since #5159 will fix this 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment