generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Labels
area/metricsCore metrics utilityCore metrics utilityfeature-requestNew or enhancements to existing featuresNew or enhancements to existing features
Description
Use case
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:
{
"_aws": {
"CloudWatchMetrics": [
{
"Metrics": [
{
"Name": "Time",
"Unit": "Milliseconds",
"StorageResolution": 60 // <- new key
}
],
...
}
]
},
"Time": 1
}As part of this issue we should also update the API docs, documentation, and unit/integration tests.
Solution/User Experience
Proposed DX:
using AWS.Lambda.Powertools.Metrics;
public class Function {
[Metrics(Namespace = "ExampleApplication", Service = "Booking")]
public async Task<APIGatewayProxyResponse> FunctionHandler(APIGatewayProxyRequest apigProxyEvent, ILambdaContext context)
{
// Publish a metric with standard resolution i.e. StorageResolution = 60
Metrics.AddMetric("SuccessfulBooking", 1, MetricUnit.COUNT, MetricResolution.HIGH);
// Publish a metric with high resolution i.e. StorageResolution = 1
Metrics.AddMetric("FailedBooking", 1, MetricUnit.COUNT, MetricResolution.HIGH);
// The last parameter (storage resolution) is optional
Metrics.AddMetric("SuccessfulUpgrade", 1, MetricUnit.COUNT);
}
}To support the proposal, a new MetricResolution enum should be added, as well as changes to the Metrics.AddMetric method.
Alternative solutions
No response
Acknowledgment
- This feature request meets Lambda Powertools Tenets
- Should this be considered in other Lambda Powertools languages? i.e. Java, TypeScript
lachriz-awssliedig
Metadata
Metadata
Assignees
Labels
area/metricsCore metrics utilityCore metrics utilityfeature-requestNew or enhancements to existing featuresNew or enhancements to existing features
Type
Projects
Status
👀 In review