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

Merged
merged 6 commits into from
Feb 27, 2025

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.

@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 94.44444% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.02%. Comparing base (ce9bf85) to head (75ee06b).
Report is 8 commits behind head on develop.

Files with missing lines Patch % Lines
...aries/src/AWS.Lambda.Powertools.Metrics/Metrics.cs 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #785      +/-   ##
===========================================
+ Coverage    73.96%   74.02%   +0.05%     
===========================================
  Files          210      210              
  Lines         8381     8396      +15     
  Branches       904      907       +3     
===========================================
+ Hits          6199     6215      +16     
+ Misses        1884     1883       -1     
  Partials       298      298              

☔ 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
@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 27, 2025
@hjgraca hjgraca merged commit d5593b3 into aws-powertools:develop Feb 27, 2025
9 checks passed
@hjgraca hjgraca deleted the feature/metrics-function-name branch February 27, 2025 15:11
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/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Metrics support setting functionName
2 participants