fix: map Python CRITICAL log level to OTel FATAL severity text#5011
Open
Krishnachaitanyakc wants to merge 1 commit intoopen-telemetry:mainfrom
Open
Conversation
|
|
The OTel specification defines the severity text for the highest severity range as "FATAL", but the Python SDK was passing through Python's native "CRITICAL" level name unchanged. This is the same class of bug that was previously fixed for WARNING -> WARN in open-telemetry#3566. Fixes open-telemetry#4984
de0932f to
097898f
Compare
Contributor
|
Thank you for this @Krishnachaitanyakc Would you be interested in making a similar change in the other repo?: https://github.com/open-telemetry/opentelemetry-python-contrib/blob/822cd77b25444f874a1eb289529d0234fe794034/instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/handler.py#L191-L195 As part of stabilizing the Logging SDK, the handler will eventually be housed in contrib (#4330). For this PR, please could you do |
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.
Description
Fixes #4984
The OTel specification defines the severity text for the highest severity range (SeverityNumber 21-24) as
FATAL. However, the Python SDK'sLoggingHandler._translatemethod was passing through Python's nativeCRITICALlevel name unchanged as theseverity_text.This is the same class of bug that was previously fixed for
WARNING->WARNin #3566 (which addressed #3548). The fix extends the existing severity text mapping to also coverCRITICAL->FATAL.Type of change
Changes
LoggingHandler._translate()to map Python'sCRITICALlevel name to OTel'sFATALseverity text, using a dictionary lookup instead of a single conditionaltest_export.py,test_handler.py, andtest_multi_log_processor.pyto expect"FATAL"instead of"CRITICAL"Does This PR Require a Contrib Repo Change?
Test plan
opentelemetry-sdk/tests/logs/)severity_text == "CRITICAL"now correctly assertseverity_text == "FATAL"