opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

feat: browser support for exporter-trace-otlp-proto

Open pkanal opened this issue 3 years ago • 7 comments
trafficstars

Which problem is this PR solving?

Provide the option of exporting traces using protobuf from the browser. Previously this package only supported Node, since this package now uses protobuf-js it is possible to send protobuf from the browser.

Fixes #3118

TODOs

  • [ ] Compression options
  • [x] Add karma config for tests
  • [ ] Add unit tests
  • [x] Add example of using the proto exporter in the browser
  • [x] Finish up tests listed below

Short description of the changes

  • Added browser exporter for the proto exporter package
  • Added browser exporter for trace proto exporter package
  • Added example using the trace proto exporter package

Type of change

Please delete options that are not relevant.

  • [x] New feature (non-breaking change which adds functionality)
  • [x] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [x] Send traces in the browser using the proto exporter
  • [x] Node proto exporter still works as expected
  • [x] Env variables are supported
  • [x] Existing config is supported

Checklist:

  • [ ] Followed the style guidelines of this project
  • [ ] Unit tests have been added
  • [ ] Documentation has been updated

pkanal avatar Aug 26 '22 19:08 pkanal

Codecov Report

Merging #3208 (426f321) into main (5127371) will decrease coverage by 0.02%. The diff coverage is n/a.

:exclamation: Current head 426f321 differs from pull request most recent head 9429864. Consider uploading reports for the commit 9429864 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3208      +/-   ##
==========================================
- Coverage   93.80%   93.79%   -0.02%     
==========================================
  Files         249      249              
  Lines        7640     7640              
  Branches     1589     1589              
==========================================
- Hits         7167     7166       -1     
- Misses        473      474       +1     
Impacted Files Coverage Δ
...-otlp-proto/src/platform/node/OTLPTraceExporter.ts 100.00% <ø> (ø)
packages/opentelemetry-resources/src/Resource.ts 100.00% <ø> (ø)
...-trace-base/src/platform/node/RandomIdGenerator.ts 87.50% <0.00%> (-6.25%) :arrow_down:

codecov[bot] avatar Nov 08 '22 20:11 codecov[bot]

@pichlermarc @legendecas @dyladan could one of you help check what the unit tests are failing for? I only see "Error: Process completed with exit code 3." at the end of each tests run, but it's not clear what error the process encountered. In my local setup I see failure in api/test/tree-shaking/tree-shaking.test.ts (even though this PR has made no changes to the api), but it's not clear if the unit tests in github CI are failing for the same reason. Thanks for looking into this.

scheler avatar Nov 12 '22 06:11 scheler

@scheler I'll take a look at the CI problem.

legendecas avatar Nov 14 '22 08:11 legendecas

@open-telemetry/javascript-approvers can you please review this PR?

scheler avatar Nov 16 '22 04:11 scheler

I think it is fine to move the util function as a member method for the web, as the send function is accessing many members of the collector and not depends on external modules.

@legendecas I made this change.

scheler avatar Nov 30 '22 04:11 scheler

@legendecas I made the suggested changes, please take a look.

scheler avatar Dec 05 '22 17:12 scheler

@legendecas all the suggested changes are now complete, can you see if anything else is needed or approve? Thanks.

scheler avatar Dec 14 '22 06:12 scheler

Thank you for working on this!

legendecas avatar Jan 17 '23 08:01 legendecas

@open-telemetry/javascript-maintainers can you review and merge this PR? It has a few approvals already.

scheler avatar Jan 19 '23 19:01 scheler