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

Use BoundedAttributes instead of raw dict to extract attributes from LogRecord #3114 #3310

Conversation

nstawski
Copy link
Contributor

@nstawski nstawski commented May 15, 2023

Description

Using BoundedAttributes instead of a simple dict in LogRecord; Updated the _to_json function so attributes behave the same way as before the conversion, and tests pass.

I made a change in LogRecord itself and not in _get_attributes so that if someone instantiates it directly, BoundedAttributes would still be used.

This ticket also incorporates changes for Support dropped_attributes_count in LogRecord (#3201)

Fixes #3114 and #3201

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Changeling updated

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Core Repo Tests touching this functionality are passing
  • Added a test for LogRecord to check if attributes is an instance of BoundedAttributes
  • Updated a test for _get_attributes for LoggingHandler to check if attributes is an instance of BoundedAttributes
  • Added tests for LogRecord to test the attribute limits

Does This PR Require a Contrib Repo Change?

Answer the following question based on these examples of changes that would require a Contrib Repo Change:

  • The OTel specification has changed which prompted this PR to update the method interfaces of opentelemetry-api/ or opentelemetry-sdk/

  • The method interfaces of test/util have changed

  • Scripts in scripts/ that were copied over to the Contrib repo have changed

  • Configuration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in

    • pyproject.toml
    • isort.cfg
    • .flake8
  • When a new .github/CODEOWNER is added

  • Major changes to project information, such as in:

    • README.md
    • CONTRIBUTING.md
  • [] Yes. - Link to PR:

  • No.

Checklist:

  • Followed the style guidelines of this project

@nstawski nstawski marked this pull request as ready for review May 15, 2023 21:10
@nstawski nstawski requested a review from a team May 15, 2023 21:10
@ocelotl
Copy link
Contributor

ocelotl commented May 15, 2023

Looks good, please add a test case ✌️

@nstawski
Copy link
Contributor Author

@ocelotl done.

@nstawski nstawski force-pushed the ns-3114-bounded-attributes-insteadof-dict-LogRecord branch from 417b300 to 93beb55 Compare May 23, 2023 04:31
@nstawski nstawski requested a review from ocelotl May 23, 2023 23:15
@ocelotl ocelotl merged commit 46757ff into open-telemetry:main May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use BoundedAttributes instead of raw dict to extract attributes from LogRecord
5 participants