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-exporter-base): don't create blob before sending xhr #5193

Merged
merged 6 commits into from
Nov 25, 2024

Conversation

pichlermarc
Copy link
Member

@pichlermarc pichlermarc commented Nov 22, 2024

Which problem is this PR solving?

Skips creating a blob and passes the Uint8Array directly to request.send(), as it was done before 0.53.0. Both are an acceptable input according to https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send#parameters, but creating Blobs does not seem to work in React Native.

Fixes #5178

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.58%. Comparing base (ef80821) to head (3ec05b0).
Report is 1 commits behind head on main.

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     

see 1 file with indirect coverage changes

---- 🚨 Try these New Features:

Comment on lines +249 to +251
const json = JSON.parse(
new TextDecoder().decode(body)
) as IExportMetricsServiceRequest;
Copy link
Member Author

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 {
Copy link
Member Author

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.

@pichlermarc pichlermarc marked this pull request as ready for review November 22, 2024 13:03
@pichlermarc pichlermarc requested a review from a team as a code owner November 22, 2024 13:03
@pichlermarc pichlermarc added bug Something isn't working pkg:otlp-exporter-base labels Nov 22, 2024
experimental/CHANGELOG.md Outdated Show resolved Hide resolved
@pichlermarc pichlermarc changed the title fix(otlp-exporter-base): don't create blob before sending xhr refactor(otlp-exporter-base): don't create blob before sending xhr Nov 25, 2024
@pichlermarc pichlermarc added this pull request to the merge queue Nov 25, 2024
Merged via the queue into open-telemetry:main with commit 1e312c2 Nov 25, 2024
21 checks passed
@pichlermarc pichlermarc deleted the fix/xhr-blob branch November 25, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:otlp-exporter-base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OTLPTraceExporter from exporter-trace-otlp-http exporting traces Base64 encoded in React Native
3 participants