feat(node): emit os.name and os.version on spans - #4679
Open
turnipdabeets wants to merge 5 commits into
Open
Conversation
Contributor
Contributor
|
Size Change: +5.88 kB (+0.03%) Total Size: 20.9 MB 📦 View Changed
ℹ️ View Unchanged
|
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
August 31, 2026 13:58
cc7b6d8 to
ce6e01a
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 13:59
674620f to
fe90009
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
August 31, 2026 14:12
ce6e01a to
a4e6d3f
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 14:14
fe90009 to
5a441e3
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
August 31, 2026 18:01
a4e6d3f to
dcd14c4
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 18:01
5a441e3 to
47c18a9
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
August 31, 2026 18:18
dcd14c4 to
b946de6
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 18:18
47c18a9 to
f65c674
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
August 31, 2026 18:23
b946de6 to
ab4048c
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 18:24
f65c674 to
ae8d3f5
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
August 31, 2026 18:45
ab4048c to
caf83b0
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 18:45
ae8d3f5 to
00e6934
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
2 times, most recently
from
August 31, 2026 19:40
075298b to
bd09c7c
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 19:40
00e6934 to
0735573
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
3 times, most recently
from
August 31, 2026 20:14
59b5591 to
f079a21
Compare
23 tasks
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 20:22
0735573 to
435ebdd
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 20:24
435ebdd to
f19e7c3
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
August 31, 2026 20:32
f079a21 to
adc6e4e
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 20:33
f19e7c3 to
62f4f4f
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
August 31, 2026 20:52
adc6e4e to
87d0a92
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 20:53
62f4f4f to
6d43016
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
2 times, most recently
from
August 31, 2026 21:15
f4f6fa8 to
09d7ac1
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 21:15
6d43016 to
b5b012c
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
August 31, 2026 21:40
09d7ac1 to
4826408
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 21:41
b5b012c to
e5603dc
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
August 31, 2026 21:45
4826408 to
b91a37b
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 21:45
e5603dc to
7899685
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
2 times, most recently
from
August 31, 2026 22:51
3554295 to
bc7a0ba
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
August 31, 2026 22:52
7899685 to
f188165
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
September 1, 2026 01:32
bc7a0ba to
e1458e9
Compare
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
September 1, 2026 01:33
f188165 to
37796a5
Compare
turnipdabeets
force-pushed
the
feat/traces-node-mvp
branch
from
September 1, 2026 01:40
e1458e9 to
e5e089e
Compare
Logs, metrics and spans build resource attributes through one function instead of three copies. Node and browser now contribute the host OS, matching what react-native already sends.
turnipdabeets
force-pushed
the
feat/otlp-shared-resource-attributes
branch
from
September 1, 2026 01:40
37796a5 to
b21d67d
Compare
…tributes # Conflicts: # packages/browser/src/__tests__/logs-defaults.test.ts # packages/browser/src/logs-defaults.ts # packages/core/src/utils/otlp-resource.spec.ts # packages/core/src/utils/otlp-resource.ts
…tributes # Conflicts: # packages/node/src/client.ts
turnipdabeets
marked this pull request as ready for review
September 1, 2026 18:47
Contributor
|
Reviews (1): Last reviewed commit: "fix(node): normalize os.name and guard t..." | Re-trigger Greptile |
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.
Problem
Stacked on #4579 — review that first.
The spec asks for
os.nameandos.versionon the OTLP resource, andposthog-nodedoesn't send them. The traces spec lists both among the resource attributes the envelope SHALL carry.posthog-react-native,posthog-iosandposthog-androidall send them. Without them you can't answer "which OS is this latency coming from" — the OS is simply absent from every traces payload the Node SDK produces.The shared-resource-builder half of this PR — which touched the already-shipped logs and metrics pipelines, and needed none of the traces work — was split out to #4710, which targets
maindirectly. This PR is now just the Node side, and depends on nothing but #4579.Changes
The OS attributes are contributed by the Node entrypoint's config resolver and merged before user
resourceAttributes, so a user-supplied value still wins. Either key is omitted rather than emitted empty when it can't be determined, and the path cannot throw out of client construction.os.nameis normalized, not raw.platform()returnsdarwin/win32, which are OpenTelemetryos.typeidentifiers —os.nameis defined as the human-readable name, andposthog-iosandposthog-androidalready sendmacOS/Windows/Android. Emitting the raw identifiers would have made oneos.namefilter unable to span the SDKs. An unmapped platform passes through rather than being dropped.os.versionis the kernel release (25.6.0on macOS 26,6.1.0-27-amd64on Debian 12), not the marketing version. Node exposes no product-version API —os.version()returns a full banner string rather than a version — so this is the honest ceiling, and it is now called out in a comment so nobody "fixes" it later.Reviewer notes
The
node:osread lives inhost-os.node.ts, not intraces-defaults.ts. This is the part worth a look.traces-defaults.tsis reachable fromindex.edge.ts, andpackage.jsonmapsedge-lightandworkerdto that entrypoint. Withbundle: falsethe import survives verbatim intodist/, so putting the read there would have shippednode:osinto every Vercel Edge build — tracing enabled or not, and failing at build time rather than at runtime.So it follows the seam
client.tsalready uses forinitializeSpanContextManager: aprotected hostResourceAttributes()returning{}on the base class, overridden inindex.node.ts. Verified after the change by walking the built edge entrypoint's transitive imports: 22 modules, zeronode:builtins,host-osunreachable.test:edge-compatwould not have caught the naive version:@edge-runtime/jest-environmentswaps globals but still resolves modules through Node, which is whygzip.node.spec.tspasses under it.Node metrics don't get the attributes.
posthog-nodehas no logs pipeline, and its metrics resolve through core's runtime-agnosticresolveMetricsConfig, which has no host to ask. Only the traces resolver is in scope here.resolveTracesConfiggained an optional second parameter. It isn't re-exported from the package, and the new client member isprotectedand additive, so there's no public surface change.The end-to-end test compares against the resolver, not
platform(). Asserting the raw platform would only restate the mapping table; the property under test is that the entrypoint's override reaches the wire.Verification
packages/nodetraces + host-os suites: 57 pass. Edge safety confirmed by walking the built edge entrypoint's transitive imports — 22 modules, zeronode:builtins,host-osunreachable.eslintclean acrosspackages/node/src.Release info Sub-libraries affected
Libraries affected
Checklist
Two new resource attributes appear on every traces batch from the Node SDK — new behavior on a payload that has not shipped yet (#4579 is unreleased). Both keys are overridable and both are omitted when undetectable. Nothing is removed or renamed.
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Built with Claude Code, directed by @turnipdabeets.
The
node:osedge-bundle problem was caught during implementation, not review — the original plan put the read intraces-defaults.ts, and the import graph disagreed.A later pre-PR review pass made two changes: the shared-builder half was split out to #4710 (it needed no traces code and touched already-shipped pipelines), and
os.namewas normalized after comparing the emitted values againstposthog-ios,posthog-androidandposthog-react-nativesource — the original would have shipped a fourth spelling for macOS.