-
Notifications
You must be signed in to change notification settings - Fork 835
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-exporter-base): don't create blob before sending xhr #5193
refactor(otlp-exporter-base): don't create blob before sending xhr #5193
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5193 +/- ##
==========================================
- Coverage 94.59% 94.58% -0.02%
==========================================
Files 314 314
Lines 7993 7993
Branches 1611 1611
==========================================
- Hits 7561 7560 -1
- Misses 432 433 +1
|
const json = JSON.parse( | ||
new TextDecoder().decode(body) | ||
) as IExportMetricsServiceRequest; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: this is the only thing that really changed here, since we're not passing a Blob
this test needed to be adapted.
json.resourceMetrics[0].scopeMetrics[0].metrics[observableIndex]; | ||
const metric3 = | ||
json.resourceMetrics[0].scopeMetrics[0].metrics[histogramIndex]; | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: I wrapped this in a try/catch to ensure done is called - otherwise if the tests fails it will just say that the test timed out.
Which problem is this PR solving?
Skips creating a blob and passes the
Uint8Array
directly torequest.send()
, as it was done before0.53.0
. Both are an acceptable input according to https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send#parameters, but creatingBlob
s does not seem to work in React Native.Fixes #5178
Type of change
How Has This Been Tested?
examples/opentelemetry-web
(passing empty headers to force XHR instead of sendBeacon)