Skip to content
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

chore: Metrics set custom FunctionName cold start dimension #785

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from

Conversation

hjgraca
Copy link
Contributor

@hjgraca hjgraca commented Feb 25, 2025

Please provide the issue number

Issue number: #784

Summary

Changes

Support setting FunctionName

Decorator

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

Configure

    Metrics.Configure(options =>
    {
       options.FunctioName = "MyFunctionName";
        options.Namespace = "dotnet-powertools-test";
        options.Service = "testService";
        options.CaptureColdStart = true;
        options.DefaultDimensions = new Dictionary<string, string>
        {
            { "Environment", "Prod" },
            { "Another", "One" }
        };
    });

Builder

_metrics = new MetricsBuilder()
        .WithFunctionName("MyFunctionName")
        .WithCaptureColdStart(true)
        .WithService("testService")
        .WithNamespace("dotnet-powertools-test")
        .WithDefaultDimensions(new Dictionary<string, string>
        {
            { "Environment", "Prod1" },
            { "Another", "One" }
        }).Build();

User experience

Please share what the user experience looks like before and after this change

Checklist

Please leave checklist items unchecked if they do not apply to your change.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

…cs initialization. Adding default dimensions to cold start metrics
… options and enhance default dimensions handling
…ing and middleware support for aspnetcore.

Docs
…imensions' into feature/metrics-single-default-dimensions
@hjgraca hjgraca self-assigned this Feb 25, 2025
@auto-assign auto-assign bot requested review from amirkaws and sliedig February 25, 2025 11:16
@boring-cyborg boring-cyborg bot added area/metrics Core metrics utility documentation Improvements or additions to documentation github-actions Changes in GitHub workflows internal Maintenance changes tests labels Feb 25, 2025
@pull-request-size pull-request-size bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Feb 25, 2025
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

Attention: Patch coverage is 79.78723% with 57 lines in your changes missing coverage. Please review.

Project coverage is 73.55%. Comparing base (67f43a3) to head (75ac8ef).
Report is 24 commits behind head on develop.

Files with missing lines Patch % Lines
...aries/src/AWS.Lambda.Powertools.Metrics/Metrics.cs 73.23% 26 Missing and 12 partials ⚠️
...rc/AWS.Lambda.Powertools.Metrics/MetricsBuilder.cs 77.77% 8 Missing ⚠️
...trics.AspNetCore/Http/MetricsEndpointExtensions.cs 0.00% 4 Missing ⚠️
...ambda.Powertools.Metrics/Internal/MetricsAspect.cs 81.81% 0 Missing and 4 partials ⚠️
...owertools.Metrics.AspNetCore/Http/MetricsFilter.cs 76.92% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #785      +/-   ##
===========================================
+ Coverage    73.51%   73.55%   +0.04%     
===========================================
  Files          203      209       +6     
  Lines         8206     8400     +194     
  Branches       880      909      +29     
===========================================
+ Hits          6033     6179     +146     
- Misses        1882     1916      +34     
- Partials       291      305      +14     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hjgraca hjgraca linked an issue Feb 25, 2025 that may be closed by this pull request
2 tasks
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/metrics Core metrics utility documentation Improvements or additions to documentation github-actions Changes in GitHub workflows internal Maintenance changes size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Metrics support setting functionName
1 participant