Is your feature request related to a problem? Please describe.
Amazon CloudWatch announced support for high resolution metric extraction from structured logs (EMF). Customers can now provide an optional StorageResolution parameter within the EMF specification with a value of 1 or 60 (default) to indicate the desired resolution (in seconds) of the metric.
We should consider adding support for this new optional parameter to Metrics.
As part of this issue we should also update the API docs, documentation, and unit/integration tests.
Describe the solution you'd like
import software.amazon.lambda.powertools.metrics.Metrics;
import software.amazon.cloudwatchlogs.emf.logger.MetricsLogger;
public class MetricsEnabledHandler implements RequestHandler<Object, Object> {
MetricsLogger metricsLogger = MetricsUtils.metricsLogger();
@Override
@Metrics(namespace = "ExampleApplication", service = "booking")
public Object handleRequest(Object input, Context context) {
// Publish a metric with standard resolution i.e. StorageResolution = 60
metricsLogger.putMetric("SuccessfulBooking", 1, Unit.COUNT, Resolution.STANDARD);
// Publish a metric with high resolution i.e. StorageResolution = 1
metricsLogger.putMetric("SuccessfulBooking", 1, Unit.COUNT, Resolution.HIGH);
// The last parameter (storage resolution) is optional
metricsLogger.putMetric("SuccessfulBooking", 1, Unit.COUNT);
}
}
Is your feature request related to a problem? Please describe.
Amazon CloudWatch announced support for high resolution metric extraction from structured logs (EMF). Customers can now provide an optional
StorageResolution
parameter within the EMF specification with a value of 1 or 60 (default) to indicate the desired resolution (in seconds) of the metric.We should consider adding support for this new optional parameter to Metrics.
The EMF log should have this format:
As part of this issue we should also update the API docs, documentation, and unit/integration tests.
Describe the solution you'd like
Describe alternatives you've considered
Additional context