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

refactor(metrics): move from protocol to ABC; split provider tests #2934

Merged

Conversation

leandrodamascena
Copy link
Contributor

Issue number: #2916

Summary

Changes

This PR addresses the latest issues before we add the Datadog Metrics provider. There are no changes for the customer or even experience, this just fixes internal things.

User experience

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

Checklist

If your change doesn't seem to apply, please leave them unchecked.

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.

@leandrodamascena leandrodamascena requested a review from a team August 7, 2023 23:01
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 7, 2023
@leandrodamascena leandrodamascena linked an issue Aug 7, 2023 that may be closed by this pull request
7 tasks
Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

peer review comments

@codecov-commenter
Copy link

codecov-commenter commented Aug 8, 2023

Codecov Report

Patch coverage: 90.66% and project coverage change: +0.10% 🎉

Comparison is base (b0a3658) 96.34% compared to head (fb2e260) 96.44%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2934      +/-   ##
===========================================
+ Coverage    96.34%   96.44%   +0.10%     
===========================================
  Files          169      171       +2     
  Lines         7678     7685       +7     
  Branches      1451     1452       +1     
===========================================
+ Hits          7397     7412      +15     
+ Misses         222      218       -4     
+ Partials        59       55       -4     
Files Changed Coverage Δ
...s_lambda_powertools/metrics/provider/cold_start.py 100.00% <ø> (ø)
aws_lambda_powertools/metrics/functions.py 73.68% <73.68%> (ø)
aws_lambda_powertools/metrics/provider/base.py 95.23% <88.23%> (-2.06%) ⬇️
aws_lambda_powertools/metrics/base.py 71.23% <100.00%> (ø)
aws_lambda_powertools/metrics/metrics.py 96.36% <100.00%> (+4.69%) ⬆️
aws_lambda_powertools/metrics/provider/__init__.py 100.00% <100.00%> (ø)
...ools/metrics/provider/cloudwatch_emf/cloudwatch.py 94.44% <100.00%> (+2.59%) ⬆️
...owertools/metrics/provider/cloudwatch_emf/types.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

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

@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 8, 2023
@leandrodamascena leandrodamascena changed the title refactor(metrics): removing subclass + cleaning code refactor(metrics): cleaning code and adding ABC class Aug 8, 2023
Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

Almost there, I promise! log_metrics is incorrect, and I think there's some leftover from the Protocol implementation within tests.

@heitorlessa
Copy link
Contributor

Quick patch to type CloudWatch EMF Output, it's an old old tech debt I always wanted to pay ever since we added typing extensions -- this will make asserting on tests easier too (and for customers!).

0001-refactor-type-EMF-output-with-TypedDict.patch

@leandrodamascena
Copy link
Contributor Author

Quick patch to type CloudWatch EMF Output, it's an old old tech debt I always wanted to pay ever since we added typing extensions -- this will make asserting on tests easier too (and for customers!).

0001-refactor-type-EMF-output-with-TypedDict.patch

I applied this patch and addressed all feedback. Can you review it, please?

@heitorlessa
Copy link
Contributor

checking 👀 !

Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

last changes as we luckily don't need those extra bits in testing ;)

@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 11 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@heitorlessa heitorlessa changed the title refactor(metrics): cleaning code and adding ABC class refactor(metrics): move from protocol to ABC; split provider tests Aug 9, 2023
@leandrodamascena leandrodamascena merged commit 08a0a7b into aws-powertools:develop Aug 9, 2023
@leandrodamascena leandrodamascena deleted the techdebt/metrics branch August 9, 2023 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement metrics size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tech debt: Improve Metrics provider to make it more maintainable
3 participants