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

feat: implement support for structured logging #7126

Merged
merged 5 commits into from
Feb 27, 2024
Merged

Conversation

wochinge
Copy link
Contributor

@wochinge wochinge commented Feb 26, 2024

Related Issues

Proposed Changes:

  • add out-of-the-box support for structlog (console logs + JSON logging)

How did you test it?

  • unit tested it

Notes for the reviewer

Checklist

@github-actions github-actions bot added type:documentation Improvements on the docs topic:tests 2.x Related to Haystack v2.0 labels Feb 26, 2024
# https://www.structlog.org/en/stable/standard-library.html#rendering-using-structlog-based-formatters-within-logging
# This means that we use structlog to format the log entries for entries emitted via `logging` and `structlog`.

shared_processors = [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

will add trace / log correlation in a separate PR

haystack_logging.configure_logging()

logger = logging.getLogger(__name__)
logger.warning("Hello, structured logging!", extra={"key1": "value1", "key2": "value2"})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

will add a new logger class to ease logging extras in a separate PR

@wochinge wochinge force-pushed the feat/structured-logging branch from c5909b5 to 976f375 Compare February 26, 2024 15:03
@wochinge wochinge marked this pull request as ready for review February 26, 2024 15:03
@wochinge wochinge requested review from a team as code owners February 26, 2024 15:03
@wochinge wochinge requested review from dfokina, davidsbatista and masci and removed request for a team February 26, 2024 15:03
@coveralls
Copy link
Collaborator

coveralls commented Feb 26, 2024

Pull Request Test Coverage Report for Build 8052623938

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 12 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.09%) to 89.967%

Files with Coverage Reduction New Missed Lines %
components/generators/openai.py 3 96.59%
components/generators/chat/openai.py 9 79.82%
Totals Coverage Status
Change from base Build 8050672665: 0.09%
Covered Lines: 5237
Relevant Lines: 5821

💛 - Coveralls

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 8050998893

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 89.93%

Totals Coverage Status
Change from base Build 8050672665: 0.05%
Covered Lines: 5242
Relevant Lines: 5829

💛 - Coveralls

Copy link
Contributor

@masci masci left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@wochinge wochinge merged commit 2a59128 into main Feb 27, 2024
24 checks passed
@wochinge wochinge deleted the feat/structured-logging branch February 27, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Related to Haystack v2.0 topic:build/distribution topic:tests type:documentation Improvements on the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants