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

SimpleSpanProcessor.forceFlush doesn't wait for pending exports #1841

Open
anuraaga opened this issue Jan 18, 2021 · 4 comments · May be fixed by #5303
Open

SimpleSpanProcessor.forceFlush doesn't wait for pending exports #1841

anuraaga opened this issue Jan 18, 2021 · 4 comments · May be fixed by #5303
Labels
priority:p4 Bugs and spec inconsistencies which do not fall into a higher prioritization spec-noncompliant An existing feature incorrectly or incompletely implements the OTel spec. May or may not be a bug stale

Comments

@anuraaga
Copy link
Contributor

While examining aws-observability/aws-otel-community#17, I noticed that SimpleSpanProcessor.forceFlush doesn't allow blocking on pending exports.

// do nothing as all spans are being exported without waiting

Presumably, onEnd needs to store the Promise for the call to export in some Set-like object which is removed from when the export completes, so that forceFlush can block on the promises in that set.

@anuraaga anuraaga added the bug Something isn't working label Jan 18, 2021
@dyladan dyladan added spec-noncompliant An existing feature incorrectly or incompletely implements the OTel spec. May or may not be a bug and removed bug Something isn't working labels Jul 20, 2022
@dyladan
Copy link
Member

dyladan commented Jul 20, 2022

Related to #3067. This is not a bug but a spec inconsistency. This can't be fixed until #3067 is resolved.

@dyladan dyladan added the priority:p4 Bugs and spec inconsistencies which do not fall into a higher prioritization label Jul 20, 2022
Copy link

github-actions bot commented Jan 6, 2025

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 6, 2025
@anuraaga
Copy link
Contributor Author

anuraaga commented Jan 6, 2025

@dyladan I ran into this again and noticed some things have changed yet this issue is still unresolved.

https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-sdk-trace-base/src/export/SimpleSpanProcessor.ts#L86

But it's only when there are async resource attributes. Given export is always asynchronous (internal.export returns a promise), there still isn't a way to reliably flush when using simplespanprocessor.

Would it be fine to change that to set exportPromise to doExport without async attributes and always track it in unresolved? I am finding I need to use BatchSpanProcessor(InMemoryExporter) in unit tests still since SimpleSpanProcessor does not provide a way to be sure the spans were exported

@anuraaga
Copy link
Contributor Author

anuraaga commented Jan 7, 2025

Went ahead and sent #5303 with the proposed fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p4 Bugs and spec inconsistencies which do not fall into a higher prioritization spec-noncompliant An existing feature incorrectly or incompletely implements the OTel spec. May or may not be a bug stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants