File tree 2 files changed +13
-6
lines changed
aws_lambda_powertools/metrics/provider
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -90,11 +90,15 @@ def __init__(
90
90
91
91
@staticmethod
92
92
def is_metrics_disabled () -> bool :
93
- """Checks if metrics have been disabled via POWERTOOLS_METRICS_DISABLE"""
94
- is_disabled = resolve_truthy_env_var_choice (env = os .getenv (constants .METRICS_DISABLED_ENV , "false" ))
93
+ """Checks if metrics have been disabled via POWERTOOLS_METRICS_DISABLED"""
94
+ if constants .METRICS_DISABLED_ENV not in os .environ :
95
+ return False
96
+
97
+ is_disabled = resolve_truthy_env_var_choice (env = os .getenv (constants .METRICS_DISABLED_ENV ))
95
98
if is_disabled :
96
99
logger .debug ("Metrics have been disabled via env var POWERTOOLS_METRICS_DISABLED" )
97
- return is_disabled
100
+ return bool (is_disabled )
101
+
98
102
99
103
def add_metric (
100
104
self ,
Original file line number Diff line number Diff line change @@ -69,11 +69,14 @@ def __init__(
69
69
70
70
@staticmethod
71
71
def is_metrics_disabled () -> bool :
72
- """Checks if metrics have been disabled via POWERTOOLS_METRICS_DISABLE"""
73
- is_disabled = resolve_truthy_env_var_choice (env = os .getenv (constants .METRICS_DISABLED_ENV , "false" ))
72
+ """Checks if metrics have been disabled via POWERTOOLS_METRICS_DISABLED"""
73
+ if constants .METRICS_DISABLED_ENV not in os .environ :
74
+ return False
75
+
76
+ is_disabled = resolve_truthy_env_var_choice (env = os .getenv (constants .METRICS_DISABLED_ENV ))
74
77
if is_disabled :
75
78
logger .debug ("Metrics have been disabled via env var POWERTOOLS_METRICS_DISABLED" )
76
- return is_disabled
79
+ return bool ( is_disabled )
77
80
78
81
# adding name,value,timestamp,tags
79
82
def add_metric (
You can’t perform that action at this time.
0 commit comments