Browse Source

Fix Wrong parentId tracking in JFR application startup

This commit fixes the tracking of the main event parentId for the Java
Flight Recorder implementation variant.

Fixes gh-34254
6.1.x
Brian Clozel 11 months ago
parent
commit
cf662368a5
  1. 5
      spring-core/src/main/java/org/springframework/core/metrics/jfr/FlightRecorderApplicationStartup.java

5
spring-core/src/main/java/org/springframework/core/metrics/jfr/FlightRecorderApplicationStartup.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2022 the original author or authors. * Copyright 2002-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -51,10 +51,11 @@ public class FlightRecorderApplicationStartup implements ApplicationStartup {
@Override @Override
public StartupStep start(String name) { public StartupStep start(String name) {
Long parentId = this.currentSteps.getFirst();
long sequenceId = this.currentSequenceId.incrementAndGet(); long sequenceId = this.currentSequenceId.incrementAndGet();
this.currentSteps.offerFirst(sequenceId); this.currentSteps.offerFirst(sequenceId);
return new FlightRecorderStartupStep(sequenceId, name, return new FlightRecorderStartupStep(sequenceId, name,
this.currentSteps.getFirst(), committedStep -> this.currentSteps.removeFirstOccurrence(sequenceId)); parentId, committedStep -> this.currentSteps.removeFirstOccurrence(sequenceId));
} }
} }

Loading…
Cancel
Save