ApplicationInsights-Java
ApplicationInsights-Java copied to clipboard
valueMax reporting wrong number
Expected behavior
I would expect valueMax
to have a value less than valueSum
.
Actual behavior
valueMax
is greater than valueSum
.
To Reproduce
This is my method that is called to gather metrics using micrometer
:
@RequiredArgsConstructor
@Slf4j
public class TimeRecorder {
private final static String METHOD = "method";
private final static String CLASS = "class";
private final MeterRegistry registry;
public <T> T recorded(Supplier<T> supplier) {
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
if (stackTrace.length >= 3) {
StackTraceElement stackTraceElement = stackTrace[2];
return registry.timer("method.timing",
List.of(
Tag.of(CLASS, stackTraceElement.getClassName()),
Tag.of(METHOD, stackTraceElement.getMethodName())
))
.record(supplier);
} else {
log.error("unable to determine callee, skipping metrics");
return supplier.get();
}
}
}
System information
Please provide the following information:
- SDK Version: applicationinsights-agent-3.4.6.jar
- OS type and version: eclipse-temurin:17-jdk-alpine
- Application Server type and version (if applicable):
- Using spring-boot? Yes (version 2.7.1)
- Additional relevant libraries (with version, if applicable): Micrometer 1.9.1
Logs
Turn on SDK logs and attach/paste them to the issue. If using an application server, also attach any relevant server logs.
Be sure to remove any private information from the logs before posting!
Screenshots
If applicable, add screenshots to help explain your problem.