File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/internal Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 591
591
<plugin >
592
592
<groupId >com.github.spotbugs</groupId >
593
593
<artifactId >spotbugs-maven-plugin</artifactId >
594
- <version >4.8.4.0 </version >
594
+ <version >4.9.3.2 </version >
595
595
<executions >
596
596
<execution >
597
597
<id >test</id >
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public class EmfMetricsLogger implements Metrics {
50
50
51
51
private final software .amazon .cloudwatchlogs .emf .logger .MetricsLogger emfLogger ;
52
52
private final EnvironmentProvider environmentProvider ;
53
- private boolean raiseOnEmptyMetrics = false ;
53
+ private AtomicBoolean raiseOnEmptyMetrics = new AtomicBoolean ( false ) ;
54
54
private String namespace ;
55
55
private Map <String , String > defaultDimensions = new HashMap <>();
56
56
private final AtomicBoolean hasMetrics = new AtomicBoolean (false );
@@ -133,7 +133,7 @@ public void setNamespace(String namespace) {
133
133
134
134
@ Override
135
135
public void setRaiseOnEmptyMetrics (boolean raiseOnEmptyMetrics ) {
136
- this .raiseOnEmptyMetrics = raiseOnEmptyMetrics ;
136
+ this .raiseOnEmptyMetrics . set ( raiseOnEmptyMetrics ) ;
137
137
}
138
138
139
139
@ Override
@@ -159,7 +159,7 @@ public void flush() {
159
159
Validator .validateNamespace (namespace );
160
160
161
161
if (!hasMetrics .get ()) {
162
- if (raiseOnEmptyMetrics ) {
162
+ if (raiseOnEmptyMetrics . get () ) {
163
163
throw new IllegalStateException ("No metrics were emitted" );
164
164
} else {
165
165
LOGGER .warn ("No metrics were emitted" );
You can’t perform that action at this time.
0 commit comments