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(logger): add DatadogLogFormatter and observability provider #2183

Merged

Conversation

heitorlessa
Copy link
Contributor

Issue number: #2014

Summary

This PR add a new DatadogLogFormatter and documents the idea of Observability Provider.

Changes

Please provide a summary of what's being changed

User experience

Please share what the user experience looks like before and after this change

image

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@heitorlessa heitorlessa requested a review from a team as a code owner May 1, 2023 13:03
@heitorlessa heitorlessa requested review from leandrodamascena and removed request for a team May 1, 2023 13:03
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation logger tests labels May 1, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 1, 2023
@heitorlessa heitorlessa requested review from rubenfonseca and removed request for leandrodamascena May 1, 2023 13:03
@github-actions github-actions bot added the feature New feature or functionality label May 1, 2023
use_datetime_directive: bool = False,
log_record_order: list[str] | None = None,
utc: bool = False,
use_rfc3339: bool = True,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not change required, just a question: the only difference between this constructor and the base LambdaPowertoolsFormatter is this use_rfc3399 boolean that defaults to true, right?

Copy link

@jplock jplock May 1, 2023

Choose a reason for hiding this comment

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

Would there be any downsides to making use_rfc3339 default to true if it were communicated well enough in release notes or the next major version?

@heitorlessa
Copy link
Contributor Author

heitorlessa commented May 1, 2023 via email

Copy link
Contributor

@rubenfonseca rubenfonseca left a comment

Choose a reason for hiding this comment

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

just some small changes, good stuff!



class DatadogLogFormatter(LambdaPowertoolsFormatter):
def __init__(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add some docstring explaining why this exist and what the small difference is to the base class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're the best! Doing that now!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Added a specific list so we can easily append if future changes are required - lemme know if that addresses it.

use_datetime_directive: bool = False,
log_record_order: list[str] | None = None,
utc: bool = False,
use_rfc3339: bool = True,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
use_rfc3339: bool = True,
use_rfc3339: bool = True, // This is the only change from the base class

or something similar :) it helps future readers to spot the difference

@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 1, 2023
Copy link
Contributor

@rubenfonseca rubenfonseca left a comment

Choose a reason for hiding this comment

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

Looks great!

@heitorlessa
Copy link
Contributor Author

we shall wait until GitHub or PyPi behaves well again ;)

@hscheib
Copy link

hscheib commented May 1, 2023

Figure I would give a community member thumbs up. I copied the DatadogLogFormatter into my lambda to test and logs started showing in Datadog as expected. 🚀 Thanks for the change!

@leandrodamascena leandrodamascena merged commit 280e6ef into aws-powertools:develop May 1, 2023
@leandrodamascena leandrodamascena linked an issue May 1, 2023 that may be closed by this pull request
2 tasks
@heitorlessa
Copy link
Contributor Author

Figure I would give a community member thumbs up. I copied the DatadogLogFormatter into my lambda to test and logs started showing in Datadog as expected. 🚀 Thanks for the change!

Wonderful to hear, please keep up shouting out more :)

@heitorlessa heitorlessa deleted the logger/datadog-formatter branch May 2, 2023 07:12
@leandrodamascena leandrodamascena linked an issue May 3, 2023 that may be closed by this pull request
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature New feature or functionality logger size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests
Projects
None yet
5 participants