Skip to content

fix(http): set url.uri_template only when the request has a template - #752

Merged
Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
HardMax71:fix/uri-template-attribute-none
Sep 25, 2026
Merged

Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
HardMax71:fix/uri-template-attribute-none

Conversation

@HardMax71

Copy link
Copy Markdown
Contributor

Overview

get_request_from_request_information now adds url.uri_template to the span attributes only when the request has a template, the same guard http.port got for #430. A RequestInformation whose URL is set directly (msgraph-core's PageIterator, LargeFileUploadTask, any raw-URL request) has url_template None, and that None went onto both spans: opentelemetry-sdk up to 1.44 logged Invalid type NoneType for attribute 'url.uri_template' twice per request, and 1.45 exports url.uri_template: None.

Related Issue

Fixes #751

Notes

The span name above it already falls back to UNKNOWN for the same case; the attribute is left out rather than set to UNKNOWN, since the semantic convention treats it as optional.

Testing Instructions

  • cd packages/http/httpx && pytest tests/test_httpx_request_adapter.py -k uri_template: a raw-URL request leaves no url.uri_template on any span and logs no OpenTelemetry warning (fails on main), and a templated request still carries its template.
  • Full package: 158 passed. yapf, isort, mypy and pylint (10/10) clean on kiota_http.
  • The repro in url.uri_template span attribute is set to None on requests without a URL template #751 against this branch with opentelemetry-sdk 1.45.0: url.uri_template absent on both spans, no warning.

A RequestInformation whose URL is set directly (PageIterator, LargeFileUploadTask) has no url_template, and the None went into the span attributes: opentelemetry-sdk up to 1.44 logged a warning for it twice per request, 1.45 exports url.uri_template: None. Fixes microsoft#751.
@HardMax71
Max Azatian (HardMax71) requested a review from a team as a code owner September 25, 2026 14:32
Copilot AI lite review requested due to automatic review settings September 25, 2026 14:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Empty-string templates may still emit url.uri_template despite being treated as absent.

Review effort: Lite
Findings: None

@baywet
Vincent Biret (baywet) merged commit b442a5c into microsoft:main Sep 25, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

url.uri_template span attribute is set to None on requests without a URL template

3 participants