Skip to content

chore: Feature/metrics default dimensions coldstart #771

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

Conversation

hjgraca
Copy link
Contributor

@hjgraca hjgraca commented Feb 20, 2025

Please provide the issue number

Issue number: #654

Summary

Changes

This pull request includes significant changes to the AWS.Lambda.Powertools.Metrics library, focusing on improving the interface and functionality of the Metrics class and related components. The primary changes involve refactoring the IMetrics interface, enhancing the Metrics class, and updating the MetricsAspect class to support the new configuration approach.

Metrics.Configure

You can now configure Metrics in the constructor, this allows to configure default dimensions and other properties

image

Testing with dependency injection

With this new model you can finally test Metrics with dependency injection

image

Builder pattern

You can also create a Metrics instance with Builder pattern. As you can see in the example bellow all properties can be set in the constructor and will be used on the decorated handler.

image

Interface and Documentation Improvements:

Configuration and Initialization Enhancements:

Metrics Aspect Refactoring:

Minor Code Cleanups:

These changes collectively improve the flexibility, readability, and maintainability of the AWS.Lambda.Powertools.Metrics library.

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
@hjgraca hjgraca added area/metrics Core metrics utility v2 v2 release labels Feb 20, 2025
@hjgraca hjgraca self-assigned this Feb 20, 2025
@auto-assign auto-assign bot requested review from amirkaws and sliedig February 20, 2025 16:42
@boring-cyborg boring-cyborg bot added the tests label Feb 20, 2025
@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Feb 20, 2025
@github-actions github-actions bot added the internal Maintenance changes label Feb 20, 2025
Copy link

codecov bot commented Feb 20, 2025

Codecov Report

Attention: Patch coverage is 86.93467% with 26 lines in your changes missing coverage. Please review.

Project coverage is 73.82%. Comparing base (c99d76b) to head (518b874).
Report is 14 commits behind head on develop.

Files with missing lines Patch % Lines
...aries/src/AWS.Lambda.Powertools.Metrics/Metrics.cs 80.91% 18 Missing and 7 partials ⚠️
...ambda.Powertools.Metrics/Internal/MetricsAspect.cs 92.85% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #771      +/-   ##
===========================================
+ Coverage    73.43%   73.82%   +0.38%     
===========================================
  Files          205      205              
  Lines         8323     8324       +1     
  Branches       901      901              
===========================================
+ Hits          6112     6145      +33     
+ Misses        1908     1884      -24     
+ Partials       303      295       -8     
Flag Coverage Δ
unittests 73.82% <86.93%> (+0.38%) ⬆️

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 20, 2025 that may be closed by this pull request
2 tasks
@pull-request-size pull-request-size bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 25, 2025
Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @hjgraca! Super nice work! I just left a small comment to make the code more clear.

@hjgraca hjgraca merged commit b0d8807 into aws-powertools:develop Feb 26, 2025
7 checks passed
@hjgraca hjgraca deleted the feature/metrics-default-dimensions-coldstart branch February 26, 2025 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/metrics Core metrics utility internal Maintenance changes size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tests v2 v2 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Add support for default dimensions on ColdStart metric
2 participants