Repository navigation
refactor(otlp-transformer, resources): route platform-specific code through #platform - #7173
Merged
overbalance merged 3 commits intoOct 9, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7173 +/- ##
=======================================
Coverage 95.02% 95.02%
=======================================
Files 382 385 +3
Lines 13532 13539 +7
Branches 3126 3125 -1
=======================================
+ Hits 12859 12866 +7
Misses 673 673
🚀 New features to boost your workflow:
|
6 tasks done
Pull request dashboard statusMerged · refreshed 2026-10-09 15:47 UTC Status above doesn't look right?
|
david-luna
approved these changes
Oct 9, 2026
pacocartones
added a commit
to pacocartones/opentelemetry-js
that referenced
this pull request
Oct 13, 2026
Port the factories to the #platform layout from open-telemetry#7141, open-telemetry#7170 and open-telemetry#7173: the package entry points export createOtlp*Exporter from '#platform', the removed src/platform/index.ts files stay removed, convertLegacyHttpOptionsWithoutEnv moves with its module to platform/node/configuration, and the metrics proto browser factory takes the browser configuration type. Signed-off-by: pacocartones <pacocartones@users.noreply.github.com> Assisted-by: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
Two universal packages still chose platform behavior at runtime inside shared code:
@opentelemetry/otlp-transformercheckedtypeof Bufferto pick a base64 encoder, and@opentelemetry/resourcesreadglobalThis.process.argv0inside a try/catch to build the default service name. Both patterns need Node.js types in browser-reachable code.A follow-up PR (#7142) adds
npm run typecheck:browser, which checks every browser build with DOM types and no@types/node. This PR is one of the changes that make that check passable.Short description of the changes
otlp-transformeradopts#platformwith the same layout as the other universal packages: animports["#platform"]map,src/platform/node/index.tsandsrc/platform/browser/index.tsas tsdown entries. The Node.js barrel encodes base64 withBuffer; the browser barrel keeps the existingbtoaloop.JSON_ENCODER.encodeUint8Arraycalls it. The 3.x migration guide lists the package.resourcesmakesdefaultServiceNamea#platformunit. The Node.js implementation keeps the cache, theprocess.argv0read and its guard for runtimes that stubprocess; the browser implementation returnsunknown_serviceand never touchesglobalThis.process.defaultServiceNamewith an emptyargv0, and in the browser build.Type of change
How Has This Been Tested?
npm run compile,npm run lint,npm run test,npm run test:browser,npm run test:webworkerfrom the root.npm run verify-pack, which loads every#platformbranch ofotlp-transformerfrom the packed tarball and checks that the published declarations do not reference#platform.Checklist: