Skip to content

Map time units to UCUM format for Dynatrace #5588

@jonatan-ivanov

Description

@jonatan-ivanov

Reported by @pirgeo.

MeterRegistry implementations mapping TimeUnits to a string representation using its .toString() through this cache:

private static final EnumMap<TimeUnit, String> BASE_TIME_UNIT_STRING_CACHE = Arrays.stream(TimeUnit.values())
.collect(
Collectors.toMap(
Function.identity(),
(timeUnit) -> timeUnit.toString().toLowerCase(),
(k, v) -> { throw new IllegalStateException("Duplicate keys should not exist."); },
() -> new EnumMap<>(TimeUnit.class)
)
);

This is the standard OpenJDK representation for time units but for Dynatrace, we need UCUM-compliant units, e.g.: s instead of seconds, ms instead of milliseconds, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA general bugregistry: dynatraceA Dynatrace Registry related issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions