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

adds a CompositeSpanExporter #376

Closed

Conversation

nelsitoPuglisi
Copy link
Contributor

@nelsitoPuglisi nelsitoPuglisi commented Feb 7, 2024

Goal

Creates a CompositeSpanExporter to add new instances of SpanExporter at runtime.

I considered using the io.opentelemetry.SpanExporter.composite() method (link here). Still, it can't be modified at runtime, so it's not helpful to the purpose of allowing a client app to add a SpanExporter.

Copy link
Contributor Author

nelsitoPuglisi commented Feb 7, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@nelsitoPuglisi
Copy link
Contributor Author

I have considered moving the exporter instance inside our OpenTelemetrySDK wrapper, but the injection of the EmbraceSpanProcessor didn't allow me to.

@nelsitoPuglisi
Copy link
Contributor Author

CompositeSpanExporterTest was added in the #377 😬

Copy link
Collaborator

@bidetofevil bidetofevil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine for the demo, but ideally we can get rid of our own composite. Creating it before we start the SDK would mean that we never have a gap between when the SDK is created and when the customer adds the exporter.

import io.opentelemetry.sdk.trace.data.SpanData
import io.opentelemetry.sdk.trace.export.SpanExporter

public class CompositeSpanExporter : SpanExporter {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be internal

OpenTelemetrySdk(
openTelemetryClock = openTelemetryClock,
spanProcessor = EmbraceSpanProcessor(EmbraceSpanExporter(spansSink))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. The reason you can't use the default composite one is because we are initializing this too early, before the app can add the exporter instance? If this were happening later, I can imagine a list of exporters passed into InitModuleImpl and we just call SpanExporter.composite() here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. We are exporting the emb-startup-moment span, though.

Copy link
Contributor

@fractalwrench fractalwrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending resolution of Hanson's comments

@nelsitoPuglisi nelsitoPuglisi deleted the nelson/otel-exporter-composite branch February 8, 2024 17:55
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 this pull request may close these issues.

None yet

3 participants