-
Notifications
You must be signed in to change notification settings - Fork 156
refactor(metrics): unit tests for Metrics are written to follow similar convention as Logger/Tracer #1414
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
Merged
dreamorosi
merged 98 commits into
aws-powertools:main
from
arnabrahman:163-metrics-unit-tests
Apr 24, 2023
Merged
refactor(metrics): unit tests for Metrics are written to follow similar convention as Logger/Tracer #1414
Changes from all commits
Commits
Show all changes
98 commits
Select commit
Hold shift + click to select a range
6bd7fb1
test: cleanup unit tests
arnabrahman 37adcab
test: store metrics
arnabrahman 655b820
test: create multiple metrics
arnabrahman ebe50f9
test: addMetric default resolution
arnabrahman 1d62a18
test: addMetric will group values for same metric name
arnabrahman b44a983
test: addMetric throws error while adding same metric with different …
arnabrahman 4986d6d
test: addMetric will publish metrics if stored metrics count has reac…
arnabrahman 3ec7e74
test: addMetric will not publish if stored metrics count has not reac…
arnabrahman 1e3845a
test: addDimension storing dimension
arnabrahman 66b9a44
test: addDimension giving error if number of dimensions exceeds the m…
arnabrahman 61b7da9
test: addDimensions should add multiple dimensions
arnabrahman 78705ea
test: addDimensions should update existing dimension value if added a…
arnabrahman 0f08806
test: addDimensions should throw error if maximum dimension count cro…
arnabrahman 649dc5b
test: addMetadata should add metadata
arnabrahman 99c447a
test: clearDimensions should clear dimensions
arnabrahman 6541fba
test: clearMetadata should clear all metadata
arnabrahman d789b4e
test: clearMetrics should clear all stored metrics
arnabrahman f01b6ae
test: setDefaultDimensions should set default dimensions object
arnabrahman 07dd43b
test: setDefaultDimensions should throw error if default dimensions r…
arnabrahman 8b4c92b
test: clearDefaultDimensions should clear all default dimensions
arnabrahman 3e63b19
test: singleMetric should return a single metric object
arnabrahman 0d06a8d
test: throwOnEmptyMetrics will set the throwOnEmptyMetrics flag to true
arnabrahman 30fb771
test: setFunctionName should set the function name
arnabrahman ce11bae
test: logMetrics should log metrics
arnabrahman 4bde67d
test: logMetrics should capture cold start metrics
arnabrahman 32bce7a
test: logMetrics should throw error if no metrics are added and throw…
arnabrahman 20a9e53
test: logMetrics should set default dimensions if passed in the options
arnabrahman 4081793
test: logMetrics should throw error if lambda handler throws any error
arnabrahman 12a3a52
test: serializeMetrics should print warning, if no namespace provided…
arnabrahman 94c0c1a
feat: metrics helper
arnabrahman 94c8a39
test: createMetrics should return appropriate values for no construct…
arnabrahman 1a9ed4c
test: createMetrics should return appropriate instance when construct…
arnabrahman 4d5f987
Merge branch 'main' into 163-metrics-unit-tests
arnabrahman c1175b7
test: serializeMetricscreateMetrics should return right object compli…
arnabrahman eed92bc
Merge branch 'main' into 163-metrics-unit-tests
arnabrahman bed96a9
test: serializeMetricscreateMetrics should log service dimensions cor…
arnabrahman 427637d
test: serializeMetricscreateMetrics should log other dimensions corre…
arnabrahman 61a8c9e
refactor: clearDimensions should not clear default dimensions
arnabrahman 91e5214
test: serializeMetrics should log metadata correctly
arnabrahman 2c83ca9
test: serializeMetrics should throw error on empty metrics when throw…
arnabrahman 83c5972
test: serializeMetrics should log namespaces properly
arnabrahman 13f552f
test: serializeMetrics should log metric values properly
arnabrahman a870474
test: serializeMetrics should log properly
arnabrahman ca7a04b
test: serializeMetrics should show warning if no metrics are added
arnabrahman 1a25d5c
test: serializeMetrics should should call serializeMetrics && log the…
arnabrahman 01596d3
test: serializeMetrics should call clearMetrics function
arnabrahman 8b2abee
test: serializeMetrics should call clearDimensions function
arnabrahman 08af29a
test: serializeMetrics should call clearMetadata function
arnabrahman 66012a5
test: serializeMetrics should call addMetric with correct parameters
arnabrahman d4f7265
test: serializeMetrics should call setDefaultDimensions with correct …
arnabrahman 638ccf4
test: serializeMetrics should call addDimension depending on function…
arnabrahman 28f9388
test: serializeMetrics should not call any function, if there is no c…
arnabrahman 8d91555
refactor: extract reusable constants to a separate file
arnabrahman 80cf6d3
refactor: import default namespace from constants
arnabrahman 67c9cb8
refactor: use MAX_METRICS_SIZE from constants
arnabrahman 327011a
refactor: use MAX_DIMENSION_COUNT from constants
arnabrahman f4553cc
refactor: use MAX_DIMENSION_COUNT in max dimension allowed tests
arnabrahman aea71c8
refactor: extract cold start metric in constants
arnabrahman 46f60d0
refactor: use createMetrics helper function to create Metrics instance
arnabrahman 151f119
refactor: set namespace for all the Metrics instance
arnabrahman dd1f790
style: formatting in test steps
arnabrahman 77923b8
test: cleanup POWERTOOLS_METRICS_NAMESPACE env after test completion …
arnabrahman eedbc0f
test: error messages for various errors
arnabrahman 12d12a3
docs: decorator function comments
arnabrahman f439dc1
refactor: format test metric name
arnabrahman efa136e
style: rearrange tests by name
arnabrahman 995235c
fix: default namespace test for serializeMetrics function
arnabrahman 8f7302b
fix: remove redundant deletion of process env
arnabrahman 62ad51a
test: addDimension should update existing dimension value if same dim…
arnabrahman 8dd3ed9
style: rephrase test description for addDimensions
arnabrahman 940c585
style: rephrase test description for addMetadata
arnabrahman c376a44
style: rephrase test description for addMetric
arnabrahman 3c6ae18
test: addMetric should publish metrics on every call if singleMetric …
arnabrahman a2e4065
style: rephrase test description for captureColdStartMetric
arnabrahman 5de965f
test: clearDefaultDimensions should only clear default dimensions
arnabrahman ad81018
style: rephrase test description of clearDimensions
arnabrahman 880fcc2
style: rephrase test description of clearMetrics
arnabrahman d68e55f
refactor: common functionality inside beforeEach for logMetrics test
arnabrahman c749956
refactor: publish metrics test for logMetrics
arnabrahman 8148b77
refactor: capture cold start test for logMetrics
arnabrahman 5aa15db
refactor: call throwOnEmptyMetrics test for logMetrics
arnabrahman dbd8a47
refactor: set default dimensions test for logMetrics
arnabrahman 35b1727
refactor: separate decorator lambda function generation for logMetric…
arnabrahman 23c474b
refactor: publishStoredMetrics tests
arnabrahman 562f8d5
improv: test return values for serializeMetrics.
arnabrahman 9ea8d04
refactor: tests for setDefaultDimensions
arnabrahman 4026512
Merge branch 'main' into 163-metrics-unit-tests
arnabrahman a402e15
style: spacing in Metrics class
arnabrahman 80e4c3b
refactor: function export for metricsUtils
arnabrahman e71c1fe
refactor: LooseObject interface in metrics tests
arnabrahman 4a9dbc3
refactor: range error tests for max dimension count
arnabrahman 3ef1a7b
refactor: test range error for max dimension in addDimension
arnabrahman 73a69cb
refactor: range error tests for max metric size
arnabrahman ffd14d2
refactor: test namespace value from constant
arnabrahman e6d11e2
style: redundant curly braces
arnabrahman af2a6b8
refactor: replace createMetrics helper with new Metrics(...).
arnabrahman a063546
test: constructor method of Metrics class.
arnabrahman 4037c3c
refactor: remove createMetrics helper function related codes
arnabrahman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const COLD_START_METRIC = 'ColdStart'; | ||
export const DEFAULT_NAMESPACE = 'default_namespace'; | ||
export const MAX_METRICS_SIZE = 100; | ||
export const MAX_DIMENSION_COUNT = 29; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.