feat(exporters): implement fetch-later-transport#6217
feat(exporters): implement fetch-later-transport#6217YangJonghun wants to merge 7 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6217 +/- ##
==========================================
- Coverage 95.48% 95.47% -0.02%
==========================================
Files 363 364 +1
Lines 11564 11596 +32
Branches 2669 2677 +8
==========================================
+ Hits 11042 11071 +29
- Misses 522 525 +3
🚀 New features to boost your workflow:
|
9ad31d0 to
7ee5cac
Compare
|
cc @open-telemetry/browser-maintainers - is that something you would like to include at this time? |
|
@overbalance Would you be willing to summarize your thoughts on this from the discussion at the last Browser SIG? |
|
@pichlermarc @trentm I was crafting the response as your comment popped up :) The main issues with |
|
Closing this as won't do for now, we may change our position once |
|
@trentm @overbalance @pichlermarc If there are any records or notes from that discussion, I would appreciate the opportunity to review them. I am also curious whether this PR was closed primarily due to the difficulty of implementing retries. While I understand and agree that the lack of retry support can be inconvenient, this approach can still be used in conjunction with fetch depending on visibility. In the browser environment, key performance metrics such as LCP, CLS, and INP are determined based on the final state at the time of page unload. From this perspective, reducing the risk of data loss during page exit is more critical than supporting retries. Given that fetch can still be chosen as a fallback when retries are required, I believe it is more beneficial not to eliminate this option entirely. Instead, allowing OpenTelemetry users to choose the most appropriate approach for their use case would better serve the community. If users are forced to implement custom solutions whenever they need this behavior, it could reduce the value of offering this as part of the standard. |
|
@YangJonghun can you explain what you mean by "difficulty of implementing retries"? Regarding page unload, can you explain how fetchLater reduces risk over fetch with keepalive? I agree options are good. |
Which problem is this PR solving?
Adds support for fetchLater API as the preferred transport method for browser-based OTLP exporters.
fetchLaterprovides reliability guarantees that the request will be sent even if the page is closed, making it ideal for telemetry data export.Short description of the changes
FetchLaterTransportclass insrc/transport/fetch-later-transport.tscreateOtlpFetchLaterExportDelegateinsrc/otlp-browser-http-export-delegate.tsinferExportDelegateToUseto prioritizefetchLater overother transports when availableType of change
How Has This Been Tested?
npm run test:browser- All tests passFetchLaterTransportcovering success, failure, QuotaExceededError, AbortSignal, and timeout scenariosinferExportDelegateToUseto verify fetchLater is selected when availableChecklist: