From 102b6f545bb9eff256b9ecd8faf1bad29c7e1e7d Mon Sep 17 00:00:00 2001 From: jen-w <10570219+jen-w@users.noreply.github.com> Date: Wed, 19 Aug 2020 22:23:55 -0700 Subject: [PATCH 1/3] Add publicly accessible units to constants.py https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html --- aws_embedded_metrics/constants.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/aws_embedded_metrics/constants.py b/aws_embedded_metrics/constants.py index 756e9cd..dc76bf7 100644 --- a/aws_embedded_metrics/constants.py +++ b/aws_embedded_metrics/constants.py @@ -14,3 +14,31 @@ DEFAULT_NAMESPACE = "aws-embedded-metrics" MAX_DIMENSIONS = 9 MAX_METRICS_PER_EVENT = 100 + +# Units +SECONDS = "Seconds" +MICROSECONDS = "Microseconds" +MILLISECONDS = "Milliseconds" +BYTES = "Bytes" +KILOBYTES = "Kilobytes" +MEGABYTES = "Megabytes" +GIGABYTES = "Gigabytes" +TERABYTES = "Terabytes" +BITS = "Bits" +KILOBITS = "Kilobits" +MEGABITS = "Megabits" +GIGABITS = "Gigabits" +TERABITS = "Terabits" +PERCENT = "Percent" +COUNT = "Count" +BYTES_PER_SECOND = "Bytes/Second" +KILOBYTES_PER_SECOND = "Kilobytes/Second" +MEGABYTES_PER_SECOND = "Megabytes/Second" +GIGABYTES_PER_SECOND = "Gigabytes/Second" +TERABYTES_PER_SECOND = "Terabytes/Second" +BITS_PER_SECOND = "Bits/Second" +KILOBITS_PER_SECOND = "Kilobits/Second" +MEGABITS_PER_SECOND = "Megabits/Second" +GIGABITS_PER_SECOND = "Gigabits/Second" +TERABITS_PER_SECOND = "Terabits/Second" +COUNT_PER_SECOND = "Count/Second" From 40e25e268c9223f9baa9aa3f0dffdd717bedde34 Mon Sep 17 00:00:00 2001 From: Jenny <10570219+jen-w@users.noreply.github.com> Date: Thu, 27 Aug 2020 12:37:50 -0700 Subject: [PATCH 2/3] Move constants to enum class --- aws_embedded_metrics/constants.py | 28 ---------------------------- aws_embedded_metrics/unit.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 aws_embedded_metrics/unit.py diff --git a/aws_embedded_metrics/constants.py b/aws_embedded_metrics/constants.py index dc76bf7..756e9cd 100644 --- a/aws_embedded_metrics/constants.py +++ b/aws_embedded_metrics/constants.py @@ -14,31 +14,3 @@ DEFAULT_NAMESPACE = "aws-embedded-metrics" MAX_DIMENSIONS = 9 MAX_METRICS_PER_EVENT = 100 - -# Units -SECONDS = "Seconds" -MICROSECONDS = "Microseconds" -MILLISECONDS = "Milliseconds" -BYTES = "Bytes" -KILOBYTES = "Kilobytes" -MEGABYTES = "Megabytes" -GIGABYTES = "Gigabytes" -TERABYTES = "Terabytes" -BITS = "Bits" -KILOBITS = "Kilobits" -MEGABITS = "Megabits" -GIGABITS = "Gigabits" -TERABITS = "Terabits" -PERCENT = "Percent" -COUNT = "Count" -BYTES_PER_SECOND = "Bytes/Second" -KILOBYTES_PER_SECOND = "Kilobytes/Second" -MEGABYTES_PER_SECOND = "Megabytes/Second" -GIGABYTES_PER_SECOND = "Gigabytes/Second" -TERABYTES_PER_SECOND = "Terabytes/Second" -BITS_PER_SECOND = "Bits/Second" -KILOBITS_PER_SECOND = "Kilobits/Second" -MEGABITS_PER_SECOND = "Megabits/Second" -GIGABITS_PER_SECOND = "Gigabits/Second" -TERABITS_PER_SECOND = "Terabits/Second" -COUNT_PER_SECOND = "Count/Second" diff --git a/aws_embedded_metrics/unit.py b/aws_embedded_metrics/unit.py new file mode 100644 index 0000000..f6a5700 --- /dev/null +++ b/aws_embedded_metrics/unit.py @@ -0,0 +1,29 @@ +from enum import Enum + +class Unit(Enum): + SECONDS = "Seconds" + MICROSECONDS = "Microseconds" + MILLISECONDS = "Milliseconds" + BYTES = "Bytes" + KILOBYTES = "Kilobytes" + MEGABYTES = "Megabytes" + GIGABYTES = "Gigabytes" + TERABYTES = "Terabytes" + BITS = "Bits" + KILOBITS = "Kilobits" + MEGABITS = "Megabits" + GIGABITS = "Gigabits" + TERABITS = "Terabits" + PERCENT = "Percent" + COUNT = "Count" + BYTES_PER_SECOND = "Bytes/Second" + KILOBYTES_PER_SECOND = "Kilobytes/Second" + MEGABYTES_PER_SECOND = "Megabytes/Second" + GIGABYTES_PER_SECOND = "Gigabytes/Second" + TERABYTES_PER_SECOND = "Terabytes/Second" + BITS_PER_SECOND = "Bits/Second" + KILOBITS_PER_SECOND = "Kilobits/Second" + MEGABITS_PER_SECOND = "Megabits/Second" + GIGABITS_PER_SECOND = "Gigabits/Second" + TERABITS_PER_SECOND = "Terabits/Second" + COUNT_PER_SECOND = "Count/Second" From a29066fe552cff2509344a6f5ea103bf28c53aed Mon Sep 17 00:00:00 2001 From: Jared Nance Date: Fri, 28 Aug 2020 07:27:52 -0700 Subject: [PATCH 3/3] fix flake8 tests --- aws_embedded_metrics/unit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aws_embedded_metrics/unit.py b/aws_embedded_metrics/unit.py index f6a5700..dfd01e9 100644 --- a/aws_embedded_metrics/unit.py +++ b/aws_embedded_metrics/unit.py @@ -1,5 +1,6 @@ from enum import Enum + class Unit(Enum): SECONDS = "Seconds" MICROSECONDS = "Microseconds"