Skip to content

Commit 97ec6be

Browse files
author
Pankaj Agrawal
committed
Single dimension for Cold start
1 parent 38dee7f commit 97ec6be

File tree

2 files changed

+4
-5
lines changed
  • example/HelloWorldFunction/src/main/java/helloworld
  • powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/internal

2 files changed

+4
-5
lines changed

example/HelloWorldFunction/src/main/java/helloworld/App.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
4747

4848
metricsLogger().putMetric("CustomMetric1", 1, Unit.COUNT);
4949

50-
withSingleMetric("CustomMetrics2", 1, Unit.COUNT, "Another", (logger) -> {
51-
logger.setDimensions(DimensionSet.of("AnotherService", "CustomService"));
52-
logger.setDimensions(DimensionSet.of("AnotherService1", "CustomService1"));
50+
withSingleMetric("CustomMetrics2", 1, Unit.COUNT, "Another", (metric) -> {
51+
metric.setDimensions(DimensionSet.of("AnotherService", "CustomService"));
52+
metric.setDimensions(DimensionSet.of("AnotherService1", "CustomService1"));
5353
});
5454

5555
PowertoolsLogger.appendKey("test", "willBeLogged");

powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/internal/LambdaMetricsAspect.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ && isColdStart()) {
8181
Context context = contextOptional.orElseThrow(() -> new IllegalStateException("Context not found"));
8282

8383
withSingleMetric("ColdStart", 1, Unit.COUNT, namespace(powertoolsMetrics), (logger) ->
84-
logger.setDimensions(DimensionSet.of("service", service(powertoolsMetrics)),
85-
DimensionSet.of("function_name", context.getFunctionName())));
84+
logger.setDimensions(DimensionSet.of("service", service(powertoolsMetrics), "function_name", context.getFunctionName())));
8685
}
8786
}
8887
}

0 commit comments

Comments
 (0)