Repository navigation
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
Open
Max Azatian (HardMax71) wants to merge 1 commit into
Max Azatian (HardMax71) wants to merge 1 commit into
Conversation
…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.
|
This branch has not been deployed
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.



Overview
AzureIdentityAccessTokenProviderimportedTRUEfrompickleand set thecom.microsoft.kiota.authentication.is_url_validspan attribute to it once the URL passed validation.pickle.TRUEis the protocol 0 opcodeb"I01\n", not a boolean, so the attribute never recordedTrue. 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:
"I01\n".attributevalue type to support complex values everywhere and cleanup surrounding code open-telemetry/opentelemetry-python#5266) the SDK keeps bytes as they are. OTLP exports them asbytes_value, andConsoleSpanExporterfails inspan.to_json()with "Object of type bytes is not JSON serializable". The wholeget_authorization_tokenspan is dropped and only "Exception while exporting Span." gets logged.The package allows
opentelemetry-sdk>=1.27.0, so a fresh install today gets the second case. This sets a realTrue, which matches theFalseon 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
span_exporterfixture does, and checks that the attribute isTrue. On main it fails withassert b'I01\n' is True.yapf -dr,isort,pylint --disable=W,mypyandpytestpass inpackages/authentication/azure.