-
Notifications
You must be signed in to change notification settings - Fork 163
Closed
Labels
confirmedThe scope is clear, ready for implementationThe scope is clear, ready for implementationfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilityhelp-wantedWe would really appreciate some support from community for this oneWe would really appreciate some support from community for this onemetricsThis item relates to the Metrics UtilityThis item relates to the Metrics Utility
Description
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 theMetrics
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 theMetrics
class is instantiated, then it also becomes disabled - If
POWERTOOLS_METRICS_DISABLED
is set tofalse
, and dev mode is enabled, thenPOWERTOOLS_METRICS_DISABLED
takes precedence and the utility stays enabled.
Alternative solutions
N/A
Acknowledgment
- This feature request meets Powertools for AWS Lambda (TypeScript) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Metadata
Assignees
Labels
confirmedThe scope is clear, ready for implementationThe scope is clear, ready for implementationfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilityhelp-wantedWe would really appreciate some support from community for this oneWe would really appreciate some support from community for this onemetricsThis item relates to the Metrics UtilityThis item relates to the Metrics Utility
Type
Projects
Status
Shipped