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

Feature request: ability to silence / skip publishing metrics via env variable #3329

Closed
2 tasks done
dreamorosi opened this issue Nov 18, 2024 · 1 comment · Fixed by #3351
Closed
2 tasks done

Feature request: ability to silence / skip publishing metrics via env variable #3329

dreamorosi opened this issue Nov 18, 2024 · 1 comment · Fixed by #3351
Assignees
Labels
confirmed The scope is clear, ready for implementation feature-request This item refers to a feature request for an existing or new utility help-wanted We would really appreciate some support from community for this one metrics This item relates to the Metrics Utility

Comments

@dreamorosi
Copy link
Contributor

Use case

Discussed in #3315

Originally posted by zirkelc November 14, 2024
Hi,

I wanted to know if it is possible to silence metrics based on an environment variable in the same way it is possible to silence logs.

Basically, I want to omit publishing metrics if the environment is not production. Ideally, that should be controllable with an env var.

Solution/User Experience

  • by default, Metrics is enabled (current behavior)
  • if the POWERTOOLS_METRICS_DISABLED env variable is present and truthy when the Metrics class is instantiated, then it becomes disabled
  • if dev mode is enabled by means of POWERTOOLS_DEV which can be checked with this method, when the Metrics class is instantiated, then it also becomes disabled
  • If POWERTOOLS_METRICS_DISABLED is set to false, and dev mode is enabled, then POWERTOOLS_METRICS_DISABLED takes precedence and the utility stays enabled.

Alternative solutions

N/A

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

@dreamorosi dreamorosi added confirmed The scope is clear, ready for implementation feature-request This item refers to a feature request for an existing or new utility help-wanted We would really appreciate some support from community for this one metrics This item relates to the Metrics Utility labels Nov 18, 2024
@dreamorosi dreamorosi moved this from Triage to Backlog in Powertools for AWS Lambda (TypeScript) Nov 18, 2024
@zirkelc
Copy link
Contributor

zirkelc commented Nov 19, 2024

I will work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed The scope is clear, ready for implementation feature-request This item refers to a feature request for an existing or new utility help-wanted We would really appreciate some support from community for this one metrics This item relates to the Metrics Utility
Projects
Status: Coming soon
Development

Successfully merging a pull request may close this issue.

2 participants