You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
requireNonNull(dimensionSet, "Null dimension set not allowed");
62
-
63
-
if(dimensionSet.getDimensionKeys().size() > 0) {
64
-
defaultDimensions(dimensionSet);
65
-
}
66
-
}
67
-
68
-
69
53
/**
70
54
* Add and immediately flush a single metric. It will use the default namespace
71
55
* specified either on {@link Metrics} annotation or via POWERTOOLS_METRICS_NAMESPACE env var.
@@ -88,6 +72,10 @@ public static void withSingleMetric(final String name,
88
72
metricsLogger.putMetric(name, value, unit);
89
73
captureRequestAndTraceId(metricsLogger);
90
74
logger.accept(metricsLogger);
75
+
} catch (InvalidNamespaceExceptione) {
76
+
thrownewRuntimeException("A valid namespace is required, either pass it to the @Metrics annotation or set the environment variable POWERTOOLS_METRICS_NAMESPACE", e);
77
+
} catch (InvalidMetricExceptione) {
78
+
thrownewRuntimeException(e);
91
79
} finally {
92
80
metricsLogger.flush();
93
81
}
@@ -116,6 +104,10 @@ public static void withSingleMetric(final String name,
116
104
metricsLogger.putMetric(name, value, unit);
117
105
captureRequestAndTraceId(metricsLogger);
118
106
logger.accept(metricsLogger);
107
+
} catch (InvalidNamespaceExceptione) {
108
+
thrownewRuntimeException("A valid namespace is required, either pass it to the @Metrics annotation or set the environment variable POWERTOOLS_METRICS_NAMESPACE", e);
Copy file name to clipboardExpand all lines: powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/internal/LambdaMetricsAspect.java
thrownewRuntimeException("A valid namespace is required, either pass it to the @Metrics annotation or set the environment variable POWERTOOLS_METRICS_NAMESPACE", e);
thrownewRuntimeException("A valid service is required, either pass it to the @Metrics annotation or set the environment variable POWERTOOLS_SERVICE_NAME", e);
thrownewRuntimeException("A valid service is required, either pass it to the @Metrics annotation or set the environment variable POWERTOOLS_SERVICE_NAME", e);
Copy file name to clipboardExpand all lines: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/handlers/PowertoolsMetricsColdStartEnabledHandler.java
Copy file name to clipboardExpand all lines: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/handlers/PowertoolsMetricsEnabledDefaultDimensionHandler.java
Copy file name to clipboardExpand all lines: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/handlers/PowertoolsMetricsEnabledDefaultNoDimensionHandler.java
Copy file name to clipboardExpand all lines: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/handlers/PowertoolsMetricsEnabledHandler.java
Copy file name to clipboardExpand all lines: powertools-metrics/src/test/java/software/amazon/lambda/powertools/metrics/handlers/PowertoolsMetricsEnabledStreamHandler.java
0 commit comments