-
Notifications
You must be signed in to change notification settings - Fork 821
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
feat(otlp-proto): pre-compile proto files #3098
Conversation
a46e7b6
to
ee885a4
Compare
Codecov Report
@@ Coverage Diff @@
## main #3098 +/- ##
==========================================
- Coverage 93.06% 92.09% -0.97%
==========================================
Files 188 82 -106
Lines 6248 2405 -3843
Branches 1313 520 -793
==========================================
- Hits 5815 2215 -3600
+ Misses 433 190 -243
|
Can you document how to regenerate the js when we need to update? A script would be even better. |
I believe the script is there: https://github.com/open-telemetry/opentelemetry-js/pull/3098/files#diff-90a1f9aebed9b5b6edbb022c2bb5afb203e3317af67429a27ac9f63fb75bcb13R1 and its run automatically when we run |
Ahh i just missed it |
Yeah, the generation is automatic as registered in the package.json scripts and there is no need to manually run the script to compile it. |
Do we know how this affects final bundle size in browser? |
With a naïve comparison, code generated with this PR reduces the bundle size to ~300kb (bundled and minified with @vercel/ncc) from ~310kb (~220kb JS source code + ~90kb proto files). |
Wow both quite large. Ok thanks for the stats |
This seems ok to merge when you're happy with it. |
Which problem is this PR solving?
Precompile proto files to JS source code and get rid of runtime code generation. Also, this allows exporting traces and metrics in one process simultaneously by not caching the
ExportRequestProto
type.This doesn't change how otlp-grpc-exporter loads proto files as https://github.com/grpc/grpc-node/tree/master/packages/proto-loader requires raw proto files to load service definitions.
Fixes #515
Type of change
How Has This Been Tested?
The existing tests should cover this change.
Checklist: