Skip to content

fix: emit url.query_params as nested otel attributes#517

Open
Vadman97 wants to merge 1 commit intomainfrom
vkorolik/url-query-params-nested
Open

fix: emit url.query_params as nested otel attributes#517
Vadman97 wants to merge 1 commit intomainfrom
vkorolik/url-query-params-nested

Conversation

@Vadman97
Copy link
Copy Markdown
Contributor

@Vadman97 Vadman97 commented Apr 30, 2026

Summary

  • Emit each URL query param as its own url.query_params.<key> OTel span attribute instead of one JSON-stringified blob, so the backend's hlog.FormatAttributes flattens them natively into a nested attribute map with no JSON parsing required.
  • Repeated keys (?id=1&id=2) now become array-valued attributes; singletons stay as strings. The previous Object.fromEntries path silently dropped duplicates.
  • New helper convertSearchParamsToOtelAttributes mirrors the existing convertHeadersToOtelAttributes pattern.

Test plan

  • yarn turbo run test --filter highlight.run (413 tests pass; 7 new for the helper)
  • yarn turbo run lint --filter highlight.run
  • yarn format-check
  • yarn turbo run build enforce-size --filter highlight.run --filter @launchdarkly/observability (brotli: 166 kB, under 256 kB limit)

🤖 Generated with Claude Code


Note

Low Risk
Low risk: changes only how URL query params are represented on OTEL spans, with added unit tests; primary risk is minor downstream query/attribute-shape expectations.

Overview
Switches HTTP span query-param capture from a single JSON-stringified url.query_params attribute to per-param dotted attributes (e.g. url.query_params.foo), allowing backend attribute formatting to build nested maps without JSON parsing.

Adds convertSearchParamsToOtelAttributes to preserve repeated query keys as ordered arrays while keeping singletons as strings, and introduces a focused test suite covering duplicates, empty values, decoding, and custom prefixes.

Reviewed by Cursor Bugbot for commit ddc1e02. Bugbot is set up for automated code reviews on this repo. Configure here.

Send each URL query param as its own `url.query_params.<key>` attribute
instead of one JSON-stringified blob, so the backend's
hlog.FormatAttributes flattens them natively into a nested attribute map
without needing custom JSON parsing. Repeated keys become array-valued
attributes (the previous Object.fromEntries path silently dropped dupes).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Vadman97 Vadman97 requested a review from a team as a code owner April 30, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants