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

Structlog and Loguru Handlers with Examples #2492

Closed
wants to merge 26 commits into from

Conversation

carolinecgilbert
Copy link

Description

Implemented unit tests for an existing structlog handler PR and implemented a log handler for the Loguru logging library located in the handlers directory. The tests are located in the opentelemetry-instrumentation-logging test_logging.py file to be compatible with the tox testing framework.

Built basic example OTel applications that use the structlog and loguru handlers to provide guidance on how to implement the handlers.

Dependencies Required: structlog, loguru

Fixes # (issue)
#2139

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

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

  • Implemented handler unit tests in existing test_logging.py file in the tox framework
  • tox -e test-instrumentation-logging

Does This PR Require a Core Repo Change?

  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@carolinecgilbert carolinecgilbert requested a review from a team May 3, 2024 06:20
Copy link

linux-foundation-easycla bot commented May 3, 2024

CLA Signed


The committers listed above are authorized under a signed CLA.

@github-actions github-actions bot requested a review from ocelotl May 3, 2024 06:20
Comment on lines +141 to +142
4. Make sure you have `tox` installed. `pip install tox==4.13.0`.
5. Change Python version to 3.11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look generic enough

@xrmx
Copy link
Contributor

xrmx commented May 3, 2024

Thanks for contributing but all 3 of you need to sign he CLA in order to get the code accepted

)

logger_provider.add_log_record_processor(
BatchLogRecordProcessor(exporter, max_export_batch_size=1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we should allow users to pass in whatever record processor they want to use

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to include that in this PR? It doesn't look like this is a feature in the logging handler

@pmcollins
Copy link
Member

Thanks for the change. I might be missing some context, but perhaps consider splitting this into two PRs, one for loguru and the other for structlog. Multiple, smaller PRs tend to get through the review process faster than fewer larger ones.

@giulioindev
Copy link

Can this be merged if everything is ok?

)
set_logger_provider(logger_provider)

# Replace the standard logging configuration with Loguru

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a typo

Replace the standard logging configuration with Loguru -> Replace the standard logging configuration with StructLog

@xrmx
Copy link
Contributor

xrmx commented Sep 17, 2024

Can this be merged if everything is ok?

This should be splitted per #2492 (comment)

@lzchen
Copy link
Contributor

lzchen commented Sep 18, 2024

PR has been abandoned: open-telemetry/opentelemetry-python#2993 (comment)

Anyone can feel free to pick up this work :)

@lzchen lzchen closed this Sep 18, 2024
@leonard-henriquez
Copy link

If the PR is ready to merge, why not merge it as it is ? @xrmx

This was referenced Oct 15, 2024
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.