File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
src/main/java/software/amazon/cloudwatchlogs/emf Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public class MetricsContext {
34
34
@ Getter private final RootNode rootNode ;
35
35
36
36
private MetricDirective metricDirective ;
37
- private final Map <String , String > metricNameAndResolutionMap = new HashMap <>();
37
+ private final Map <String , StorageResolution > metricNameAndResolutionMap = new HashMap <>();
38
38
39
39
public MetricsContext () {
40
40
this (new RootNode ());
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ public static void validateMetric(
100
100
double value ,
101
101
Unit unit ,
102
102
StorageResolution storageResolution ,
103
- Map <String , String > metricNameAndResolutionMap )
103
+ Map <String , StorageResolution > metricNameAndResolutionMap )
104
104
throws InvalidMetricException {
105
105
106
106
if (name == null || name .trim ().isEmpty ()) {
@@ -129,14 +129,14 @@ public static void validateMetric(
129
129
}
130
130
131
131
if (metricNameAndResolutionMap .containsKey (name )) {
132
- if (!metricNameAndResolutionMap .get (name ).equals (storageResolution . toString () )) {
132
+ if (!metricNameAndResolutionMap .get (name ).equals (storageResolution )) {
133
133
throw new InvalidMetricException (
134
134
"Resolution for metrics "
135
135
+ name
136
136
+ " is already set. A single log event cannot have a metric with two different resolutions." );
137
137
}
138
138
} else {
139
- metricNameAndResolutionMap .put (name , storageResolution . toString () );
139
+ metricNameAndResolutionMap .put (name , storageResolution );
140
140
}
141
141
}
142
142
You can’t perform that action at this time.
0 commit comments