Skip to content

fix(authentication-azure): record is_url_valid as True, not pickle's TRUE opcode - #786

Open
Max Azatian (HardMax71) wants to merge 1 commit into
microsoft:mainfrom
HardMax71:fix/azure-is-url-valid-span-attribute
Open

Max Azatian (HardMax71) wants to merge 1 commit into
microsoft:mainfrom
HardMax71:fix/azure-is-url-valid-span-attribute

Conversation

@HardMax71

Copy link
Copy Markdown
Contributor

Overview

AzureIdentityAccessTokenProvider imported TRUE from pickle and set the com.microsoft.kiota.authentication.is_url_valid span attribute to it once the URL passed validation. pickle.TRUE is the protocol 0 opcode b"I01\n", not a boolean, so the attribute never recorded True. It looks like an editor auto-import picked it up when observability was added in 2023.

What tracing backends get depends on the OpenTelemetry SDK version:

The package allows opentelemetry-sdk>=1.27.0, so a fresh install today gets the second case. This sets a real True, which matches the False on the failure paths and what kiota-dotnet and kiota-typescript record.

Related Issue

None filed. I found it while typing this package for #722.

Notes

#785 touches the same file, and the two merge cleanly.

Testing Instructions

  • The new test records spans with an in-memory exporter, the same way the http package's span_exporter fixture does, and checks that the attribute is True. On main it fails with assert b'I01\n' is True.
  • yapf -dr, isort, pylint --disable=W, mypy and pytest pass in packages/authentication/azure.

…TRUE opcode

The module imported TRUE from pickle, which is the bytes b"I01\n", and set the is_url_valid span attribute to it when the URL passed validation. OpenTelemetry SDKs before 1.45.0 decode bytes, so the attribute read "I01\n". Since 1.45.0 they keep the bytes, which ConsoleSpanExporter can't serialize, so the whole get_authorization_token span is dropped. Set a real True, matching the False on the failure paths.
@HardMax71
Max Azatian (HardMax71) requested a review from a team as a code owner October 10, 2026 10:12
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant