fix(core): skip OTLP attributes with an empty key - #4727
Merged
Conversation
OTLP requires a non-empty key, and the server stored one verbatim, so it surfaced as a nameless attribute in filters. Shared by logs, metrics and spans, which all go through this encoder.
Contributor
|
Reviews (1): Last reviewed commit: "fix(core): skip OTLP attributes with an ..." | Re-trigger Greptile |
dustinbyrne
approved these changes
Sep 1, 2026
turnipdabeets
enabled auto-merge (squash)
September 1, 2026 16:52
Contributor
posthog-node Compliance ReportDate: 2026-09-01 16:53:46 UTC ✅ All Tests Passed!111/111 tests passed Capture_V1 Tests✅ 94/94 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
Contributor
Contributor
posthog-js Compliance ReportDate: 2026-09-01 17:00:28 UTC ✅ All Tests Passed!26/26 tests passed Capture Tests✅ 26/26 tests passed View Details
|
Contributor
|
Size Change: +1.16 kB (+0.01%) Total Size: 20.8 MB 📦 View Changed
ℹ️ View Unchanged
|
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
An attribute whose key is the empty string ships to OTLP as
{ "key": "" }. The OTel spec requires a non-empty key, and the ingestion service stores it verbatim, so it lands in the product as a nameless attribute that no filter can match — the value is there but unreachable.Raised by @jonmcwest reviewing #4579. It is not specific to spans: logs, metrics and (once #4579 lands) traces all encode their attributes through the same
toOtlpKeyValueList, so the hole is already shipped in the logs and metrics pipelines today. That is why this branches offmainrather than off the traces stack.Changes
encodeKeyValueListskips an entry whose key is empty, with a debug log, in the same place it already skips non-enumerable keys and nullish values. Nested keys inside akvlistValuego through the same function, so an empty key one level down is dropped too.Two tests: a top-level empty key, and one nested inside an object value.
Release info Sub-libraries affected
Libraries affected
@posthog/coreis bumped (patch); it has no checkbox above. Every SDK that sends logs or metrics picks it up.Checklist
An empty-keyed attribute was unusable in the product, so dropping it removes no working behaviour.
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Built with Claude Code, directed by @turnipdabeets, from review feedback on #4579.
The fix deliberately lives in the shared encoder rather than in the traces encoder: all three signals produce their attributes there, and fixing it once means logs and metrics — both already shipped — stop emitting nameless attributes as well.
packages/core1113 pass (56 suites), lint clean.