Skip to content

Bug: Prevent a single metric have more than 100 data points #311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hjgraca opened this issue Jun 22, 2023 · 1 comment · Fixed by #312
Closed

Bug: Prevent a single metric have more than 100 data points #311

hjgraca opened this issue Jun 22, 2023 · 1 comment · Fixed by #312
Assignees
Labels
area/metrics Core metrics utility bug Unexpected, reproducible and unintended software behaviour status/confirmed The scope is clear, ready for implementation

Comments

@hjgraca
Copy link
Contributor

hjgraca commented Jun 22, 2023

Expected Behaviour

Flush metric set when data point is reached to prevent potential data loss, where 100+ data points are added thus being ignored silently by CloudWatch EMF when processed in the background.

docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Specification.html#CloudWatch_Embedded_Metric_Format_Specification_structure_target

Current Behaviour

More than 100 metric data points can be added.

Code snippet

using AWS.Lambda.Powertools.Metrics;

public class Function
{
    [Metrics(CaptureColdStart = true)]
    public async Task<APIGatewayProxyResponse> FunctionHandler(APIGatewayProxyRequest apigwProxyEvent,
        ILambdaContext context)
    {

        Metrics.AddMetric("SuccessfulLocations", 1, MetricUnit.Count);
        Metrics.AddMetric("SuccessfulLocations", 1, MetricUnit.Count);
        // add other 100 values to the same metric
    }
}

Possible Solution

Serialize and flush metric data set when a single metric reaches 100 data points.
Throw exception when adding a metric with 100 data points.
Dimensions etc should be kept intact.

Steps to Reproduce

Run the code added in code snippet

Powertools for AWS Lambda (.NET) version

latest

AWS Lambda function runtime

dotnet6

Debugging logs

No response

@hjgraca hjgraca added bug Unexpected, reproducible and unintended software behaviour area/metrics Core metrics utility status/confirmed The scope is clear, ready for implementation labels Jun 22, 2023
@hjgraca hjgraca self-assigned this Jun 22, 2023
@hjgraca
Copy link
Contributor Author

hjgraca commented Jun 22, 2023

cc @leandrodamascena copy of aws-powertools/powertools-lambda-typescript#1529

@hjgraca hjgraca moved this to 🏗 In progress in Powertools for AWS Lambda (.NET) Jun 22, 2023
@hjgraca hjgraca linked a pull request Jun 22, 2023 that will close this issue
7 tasks
@hjgraca hjgraca moved this from 🏗 In progress to 👀 In review in Powertools for AWS Lambda (.NET) Jun 22, 2023
@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Jun 27, 2023
@hjgraca hjgraca removed the pending-release Fix or implementation already in dev waiting to be released label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/metrics Core metrics utility bug Unexpected, reproducible and unintended software behaviour status/confirmed The scope is clear, ready for implementation
Projects
Status: 👀 In review
Development

Successfully merging a pull request may close this issue.

1 participant