Skip to content

NH-152875 Re-add URL_QUERY check to sampler attributes collection; remove dead helper - #919

Merged
tammy-baylis-swi merged 2 commits into
mainfrom
NH-152875-url-attrs-fix
Nov 5, 2026
Merged

tammy-baylis-swi merged 2 commits into
mainfrom
NH-152875-url-attrs-fix

Conversation

@tammy-baylis-swi

@tammy-baylis-swi tammy-baylis-swi commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

This PR "re-adds" a check for the URL_QUERY attribute that is similar to what was originally added in #377 and used by the sampler, but correctly according to the current HTTP semconv and what the modernized instrumentors are doing:

Attribute Description Example Deprecated?
URL_PATH The URI path component. /search No
URL_QUERY The URI query component, without the ? delimiter. page=2 No
HTTP_TARGET Combined HTTP request target. /search?page=2 Yes

We then remove the dead helper get_url_attrs that was introduced in #377 but no longer used with implementation of pure Python sampling and export.

We still need the HTTP_TARGET fallback because not all upstream instrumentors are supporting URL_* yet (WSGI and Tornado).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The sampler’s query-string handling update has no active review issues.

No open issues 🎉

What changed in this PR

Restores query-string handling in the sampler’s HTTP URL construction using current OpenTelemetry semantic conventions, while retaining the legacy HTTP_TARGET fallback.

Changes:

  • Combines URL_PATH and URL_QUERY, adding the ? delimiter when needed.
  • Adds sampler tests for query-only and path-plus-query attributes.
  • Removes the unused get_url_attrs helper, its tests, and obsolete package entries.
File Description
tests/​unit/​test_semconv/​test_trace.py Removes tests for the retired helper.
tests/​unit/​test_semconv/​__init__.py Removes the obsolete test package marker.
tests/​unit/​test_oboe/​test_sampler.py Tests query-only and path-plus-query URL construction.
solarwinds_apm/​semconv/​trace/​__init__.py Removes the unused get_url_attrs helper.
solarwinds_apm/​semconv/​__init__.py Removes the obsolete package marker.
solarwinds_apm/​oboe/​sampler.py Adds query handling while preserving the legacy fallback.
pyproject.toml Removes retired semantic-convention packages from packaging.

Review effort: Balanced

@tammy-baylis-swi
tammy-baylis-swi marked this pull request as ready for review November 5, 2026 00:40
@tammy-baylis-swi
tammy-baylis-swi requested review from a team as code owners November 5, 2026 00:40

@jerrytfleung jerrytfleung left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tammy-baylis-swi
tammy-baylis-swi merged commit cd1fea7 into main Nov 5, 2026
60 checks passed
@tammy-baylis-swi
tammy-baylis-swi deleted the NH-152875-url-attrs-fix branch November 5, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants