-
Notifications
You must be signed in to change notification settings - Fork 411
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(metrics): disable metrics flush via environment variables #6046
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #6046 +/- ##
========================================
Coverage 96.25% 96.25%
========================================
Files 234 234
Lines 11057 11068 +11
Branches 803 805 +2
========================================
+ Hits 10643 10654 +11
Misses 327 327
Partials 87 87 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @anafalcao! Super nice PR with a code/design very well written!
I think the only thing missing is the part where you don't flush the metrics when it disabled. 🚀
aws_lambda_powertools/metrics/provider/cloudwatch_emf/cloudwatch.py
Outdated
Show resolved
Hide resolved
3cd593c
to
7a1d389
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
…owertools#6046) * disable metrics env var cloudwatch * add for datadog * add tests * acept none env var * fix is disable metrics * add documentation * fix mypy * add datadog tests * disable when powertools dev * add disable to flush * remove print * Changing metrics flush decision * Changing metrics flush decision --------- Co-authored-by: Leandro Damascena <[email protected]>
Issue number:
#2996
Summary
Add environment variable
POWERTOOLS_METRICS_DISABLED
to control metrics emission, allowing developers to disable metrics during testing and local development.The behavior remains unchanged when
POWERTOOLS_METRICS_DISABLED
is not set or is set to a falsy value.If
POWERTOOLS_DEV
is enabled, it also stops sending metrics.The
POWERTOOLS_METRICS_DISABLED
environment variable takes precedence overPOWERTOOLS_DEV
.Changes
POWERTOOLS_METRICS_DISABLED
environment variable.POWERTOOLS_DEV
includes disabling metrics as default, but can be overwritten byPOWERTOOLS_METRICS_DISABLED
User experience
OR
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change?
RFC issue number:
Checklist:
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.