Skip to content

Commit

Permalink
prometheus exporter: remove non-ucum units from conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
dashpole committed Aug 16, 2023
1 parent ff79bb7 commit bf6d294
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,6 @@ private static String getPrometheusUnit(String unitAbbreviation) {
return "gigabytes";
case "TBy":
return "terabytes";
case "B":
return "bytes";
case "KB":
return "kilobytes";
case "MB":
return "megabytes";
case "GB":
return "gigabytes";
case "TB":
return "terabytes";
// SI
case "m":
return "meters";
Expand All @@ -186,8 +176,6 @@ private static String getPrometheusUnit(String unitAbbreviation) {
return "";
case "%":
return "percent";
case "$":
return "dollars";
default:
return unitAbbreviation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,13 @@ private static Stream<Arguments> providePrometheusOTelUnitEquivalentPairs() {
return Stream.of(
// Simple expansion - storage Bytes
Arguments.of("By", "bytes"),
Arguments.of("B", "bytes"),
// Simple expansion - storage KB
Arguments.of("KB", "kilobytes"),
Arguments.of("KBy", "kilobytes"),
// Simple expansion - storage MB
Arguments.of("MB", "megabytes"),
Arguments.of("MBy", "megabytes"),
// Simple expansion - storage GB
Arguments.of("GB", "gigabytes"),
Arguments.of("GBy", "gigabytes"),
// Simple expansion - storage TB
Arguments.of("TB", "terabytes"),
Arguments.of("TBy", "terabytes"),
// Simple expansion - storage KiBy
Arguments.of("KiBy", "kibibytes"),
Expand All @@ -61,8 +56,6 @@ private static Stream<Arguments> providePrometheusOTelUnitEquivalentPairs() {
Arguments.of("min", "minutes"),
// Simple expansion - special symbol - %
Arguments.of("%", "percent"),
// Simple expansion - special symbols - $
Arguments.of("$", "dollars"),
// Simple expansion - frequency
Arguments.of("Hz", "hertz"),
// Simple expansion - temperature
Expand Down Expand Up @@ -90,7 +83,7 @@ private static Stream<Arguments> providePrometheusOTelUnitEquivalentPairs() {
// Units expressing rate - per month
Arguments.of("J/mo", "joules_per_month"),
// Units expressing rate - per year
Arguments.of("TB/y", "terabytes_per_year"),
Arguments.of("TBy/y", "terabytes_per_year"),
// Units expressing rate - 'per' units, both units unknown
Arguments.of("v/v", "v_per_v"),
// Units expressing rate - 'per' units, first unit unknown
Expand Down

0 comments on commit bf6d294

Please sign in to comment.