Skip to content

Bug: Metrics failing to serialize LambdaContext on AOT runtime #612

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 Jul 11, 2024 · 0 comments
Closed

Bug: Metrics failing to serialize LambdaContext on AOT runtime #612

hjgraca opened this issue Jul 11, 2024 · 0 comments
Assignees
Labels
aot bug Unexpected, reproducible and unintended software behaviour
Milestone

Comments

@hjgraca
Copy link
Contributor

hjgraca commented Jul 11, 2024

Expected Behaviour

When capturing cold starts Metrics write FunctionName to the EMF output, the FunctionName is retrieves from the LambdaContext passed to the handler.

StorageResolution should be the int representation of the enum and not the string representation, ie: Instead of"High" should be 1

Current Behaviour

In an AOT published Lambda when you have the following code

    [Metrics(Namespace = "ns", Service = "svc", CaptureColdStart = true)]
    public void HandleWithParamAndLambdaContext(string input, ILambdaContext context)
    {
        
    }

Should output

{
    "_aws": {
        "Timestamp": 1720714102216,
        "CloudWatchMetrics": [
            {
                "Namespace": "ns",
                "Metrics": [
                    {
                        "Name": "ColdStart",
                        "Unit": "Count"
                    }
                ],
                "Dimensions": [
                    [
                        "FunctionName"
                    ],
                    [
                        "Service"
                    ]
                ]
            }
        ]
    },
    "FunctionName": "pt-8",
    "Service": "svc",
    "ColdStart": 1
}

But instead was outputing

{
    "_aws": {
        "Timestamp": 1720714102216,
        "CloudWatchMetrics": [
            {
                "Namespace": "ns",
                "Metrics": [
                    {
                        "Name": "ColdStart",
                        "Unit": "Count"
                    }
                ],
                "Dimensions": [
                    [
                        "FunctionName"
                    ],
                    [
                        "Service"
                    ]
                ]
            }
        ]
    },
    "FunctionName": null, <--- should not be null
    "Service": "svc",
    "ColdStart": 1
}

Code snippet

In an AOT published Lambda have the following code

    [Metrics(Namespace = "ns", Service = "svc", CaptureColdStart = true)]
    public void HandleWithParamAndLambdaContext(string input, ILambdaContext context)
    {
        
    }

Possible Solution

No response

Steps to Reproduce

In an AOT published Lambda have the following code

    [Metrics(Namespace = "ns", Service = "svc", CaptureColdStart = true)]
    public void HandleWithParamAndLambdaContext(string input, ILambdaContext context)
    {
        
    }

Powertools for AWS Lambda (.NET) version

1.7.0

AWS Lambda function runtime

dotnet6

Debugging logs

No response

@hjgraca hjgraca added bug Unexpected, reproducible and unintended software behaviour triage Pending triage from maintainers labels Jul 11, 2024
@hjgraca hjgraca self-assigned this Jul 11, 2024
@hjgraca hjgraca added aot and removed triage Pending triage from maintainers labels Jul 11, 2024
@hjgraca hjgraca moved this to 🏗 In progress in Powertools for AWS Lambda (.NET) Jul 11, 2024
@hjgraca hjgraca added this to the .NET AOT milestone Jul 11, 2024
@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Jul 12, 2024
@hjgraca hjgraca removed the pending-release Fix or implementation already in dev waiting to be released label Jul 12, 2024
@hjgraca hjgraca closed this as completed Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aot bug Unexpected, reproducible and unintended software behaviour
Projects
Status: 🏗 In progress
Development

No branches or pull requests

1 participant