Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pkg/stanza] Fix bug where original severity text was not preserved #13265

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

djaglowski
Copy link
Member

@djaglowski djaglowski commented Aug 12, 2022

When converting from entry.Entry to plog.Logs, the severity text
was not copied over. Instead, it was automatically assigned based
on the severity number.

This change does two things:

  1. If the severity text is not empty, it is preserved
  2. If the severity text is empty, it is assigned based on the severity
    number. However, the values assigned were also incorrect, in that they
    did not match the case defined in the data model. Previously, a
    capitalized style (eg "Info") was used. Now, an all caps style is used.
    It is rare that severity number is specified while severity text is not,
    but the data model explicitly calls for this handling, so it is implemented
    as such.

Resolves #13263
Resolves #10278

When converting from entry.Entry to plog.Logs, the severity text
was not copied over. Instead, it was automatically assigned based
on the severity number.

This change does two things:
1. If the severity text is not empty, it is preserved
2. If the severity text is empty, it is assigned based on the severity
number. However, the values assigned were also incorrect, in that they
did not match the case defined in the data model. Previously, a
capitalized style (eg "Info") was used. Now, an all caps style is used.
It is rare that severity number is specified while severity text is not,
but the data model explicitly calls for this handling, so it is implemented
as such.
@djaglowski djaglowski marked this pull request as ready for review August 12, 2022 19:23
@djaglowski djaglowski requested review from a team and bogdandrutu August 12, 2022 19:23
@djaglowski djaglowski requested a review from zenmoto August 15, 2022 16:55
@djaglowski
Copy link
Member Author

@open-telemetry/collector-contrib-approvers, please take a look.

@dashpole dashpole added pkg/stanza bug Something isn't working labels Aug 22, 2022
@dashpole
Copy link
Contributor

cc @damemi

@djaglowski djaglowski merged commit 2793d7d into open-telemetry:main Aug 22, 2022
@djaglowski djaglowski deleted the pkg-stanza-sevtext-conv branch August 22, 2022 14:29
@damemi
Copy link
Contributor

damemi commented Aug 22, 2022

@dashpole I think we added a fix for a version of this issue downstream in GoogleCloudPlatform/opentelemetry-operations-go#446. There, we tried reverse-mapping the severity text if it was present to the matching severity number. I think we'll still need that fix though since it's mapping the otel text to a gcp number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg/stanza
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pkg/stanza] SeverityText is not properly preserved [pkg/stanza] Logger uses wrong case for severity
4 participants