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

Map time units to UCUM format for Dynatrace #5588

Closed
jonatan-ivanov opened this issue Oct 12, 2024 · 0 comments · Fixed by #5589
Closed

Map time units to UCUM format for Dynatrace #5588

jonatan-ivanov opened this issue Oct 12, 2024 · 0 comments · Fixed by #5589
Labels
bug A general bug registry: dynatrace A Dynatrace Registry related issue
Milestone

Comments

@jonatan-ivanov
Copy link
Member

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.

@jonatan-ivanov jonatan-ivanov added bug A general bug registry: dynatrace A Dynatrace Registry related issue labels Oct 12, 2024
@jonatan-ivanov jonatan-ivanov changed the title Map time units to UCUM compliant format for Dynatrace Map time units to UCUM format for Dynatrace Oct 12, 2024
@jonatan-ivanov jonatan-ivanov added this to the 1.12.11 milestone Oct 12, 2024
jonatan-ivanov added a commit to jonatan-ivanov/micrometer that referenced this issue Oct 12, 2024
Closes micrometer-metricsgh-5588

Co-authored-by: Georg P <georg.pirklbauer@dynatrace.com>
Co-authored-by: Jonatan Ivanov <jonatan.ivanov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug registry: dynatrace A Dynatrace Registry related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant