File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/internal Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public class EmfMetricsLogger implements Metrics {
5050
5151 private final software .amazon .cloudwatchlogs .emf .logger .MetricsLogger emfLogger ;
5252 private final EnvironmentProvider environmentProvider ;
53- private boolean raiseOnEmptyMetrics = false ;
53+ private AtomicBoolean raiseOnEmptyMetrics = new AtomicBoolean ( false ) ;
5454 private String namespace ;
5555 private Map <String , String > defaultDimensions = new HashMap <>();
5656 private final AtomicBoolean hasMetrics = new AtomicBoolean (false );
@@ -133,7 +133,7 @@ public void setNamespace(String namespace) {
133133
134134 @ Override
135135 public void setRaiseOnEmptyMetrics (boolean raiseOnEmptyMetrics ) {
136- this .raiseOnEmptyMetrics = raiseOnEmptyMetrics ;
136+ this .raiseOnEmptyMetrics . set ( raiseOnEmptyMetrics ) ;
137137 }
138138
139139 @ Override
@@ -159,7 +159,7 @@ public void flush() {
159159 Validator .validateNamespace (namespace );
160160
161161 if (!hasMetrics .get ()) {
162- if (raiseOnEmptyMetrics ) {
162+ if (raiseOnEmptyMetrics . get () ) {
163163 throw new IllegalStateException ("No metrics were emitted" );
164164 } else {
165165 LOGGER .warn ("No metrics were emitted" );
You can’t perform that action at this time.
0 commit comments