@@ -81,7 +81,7 @@ public static void withSingleMetric(final String name,
81
81
final double value ,
82
82
final Unit unit ,
83
83
final Consumer <MetricsLogger > logger ) {
84
- withMetricLogger (metricsLogger -> {
84
+ withMetricsLogger (metricsLogger -> {
85
85
metricsLogger .putMetric (name , value , unit );
86
86
logger .accept (metricsLogger );
87
87
});
@@ -103,7 +103,7 @@ public static void withSingleMetric(final String name,
103
103
final Unit unit ,
104
104
final String namespace ,
105
105
final Consumer <MetricsLogger > logger ) {
106
- withMetricLogger (metricsLogger -> {
106
+ withMetricsLogger (metricsLogger -> {
107
107
metricsLogger .setNamespace (namespace );
108
108
metricsLogger .putMetric (name , value , unit );
109
109
logger .accept (metricsLogger );
@@ -118,7 +118,7 @@ public static void withSingleMetric(final String name,
118
118
*
119
119
* @param logger the MetricsLogger
120
120
*/
121
- public static void withMetricLogger (final Consumer <MetricsLogger > logger ) {
121
+ public static void withMetricsLogger (final Consumer <MetricsLogger > logger ) {
122
122
MetricsLogger metricsLogger = logger ();
123
123
124
124
try {
@@ -130,6 +130,20 @@ public static void withMetricLogger(final Consumer<MetricsLogger> logger) {
130
130
}
131
131
}
132
132
133
+ /**
134
+ * Provide and immediately flush a {@link MetricsLogger}. It uses the default namespace
135
+ * specified either on {@link Metrics} annotation or via POWERTOOLS_METRICS_NAMESPACE env var.
136
+ * It by default captures function_request_id as property if used together with {@link Metrics} annotation. It will also
137
+ * capture xray_trace_id as property if tracing is enabled.
138
+ *
139
+ * @param logger the MetricsLogger
140
+ *
141
+ * @deprecated use {@link MetricsUtils#withMetricsLogger} instead
142
+ */
143
+ public static void withMetricLogger (final Consumer <MetricsLogger > logger ) {
144
+ withMetricLogger (logger );
145
+ }
146
+
133
147
public static DimensionSet [] getDefaultDimensions () {
134
148
return Arrays .copyOf (defaultDimensions , defaultDimensions .length );
135
149
}
0 commit comments