Skip to content

Commit aa9dbc4

Browse files
committed
gcPauses -> jvm.gc.pause, memory -> jvm.memory.used
1 parent 8350c5b commit aa9dbc4

File tree

5 files changed

+33
-9
lines changed

5 files changed

+33
-9
lines changed

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/HttpActuatorConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public String getBeans() throws IOException {
8080
@Override
8181
public String getLiveMetrics(String metricName, String tags) throws IOException {
8282
UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromPath("/metrics/"+metricName);
83-
if (tags != null) {
83+
if (tags != null && !tags.isBlank()) {
8484
uriBuilder.queryParam("tag", tags);
8585
}
8686
String url = uriBuilder.encode().toUriString();

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/Measurements.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2022 VMware, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* VMware, Inc. - initial API and implementation
10+
*******************************************************************************/
111
package org.springframework.ide.vscode.boot.java.livehover.v2;
212

313
public class Measurements {
414

515
private String statistic;
6-
private Long value;
16+
private Double value;
717

818
public String getStatistic() {
919
return statistic;
1020
}
1121

1222

13-
public Long getValue() {
23+
public Double getValue() {
1424
return value;
1525
}
1626

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/ProcessType.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2022 VMware, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* VMware, Inc. - initial API and implementation
10+
*******************************************************************************/
111
package org.springframework.ide.vscode.boot.java.livehover.v2;
212

313
public enum ProcessType {

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/SpringProcessCommandHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,11 @@ private CompletableFuture<Object> handleLiveMetricsProcessRequest(ExecuteCommand
301301
String metricName = getArgumentByKey(params, "metricName");
302302
if (processKey != null) {
303303
switch(metricName) {
304-
case "gcPauses": {
304+
case SpringProcessConnectorService.GC_PAUSES: {
305305
SpringProcessGcPausesMetricsLiveData data = connectorService.getGcPausesMetricsLiveData(processKey);
306306
return CompletableFuture.completedFuture(data.getGcPausesMetrics());
307307
}
308-
case "memory": {
308+
case SpringProcessConnectorService.MEMORY: {
309309
SpringProcessMemoryMetricsLiveData data = connectorService.getMemoryMetricsLiveData(processKey);
310310
return CompletableFuture.completedFuture(data.getMemoryMetrics());
311311
}

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/SpringProcessConnectorService.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
*/
3030
public class SpringProcessConnectorService {
3131

32+
private static final String METRICS = "metrics";
33+
public static final String GC_PAUSES = "jvm.gc.pause";
34+
public static final String MEMORY = "jvm.memory.used";
35+
3236
private static final Logger log = LoggerFactory.getLogger(SpringProcessConnectorService.class);
3337

3438
private final SpringProcessLiveDataProvider liveDataProvider;
@@ -171,8 +175,8 @@ private void scheduleConnect(ProgressTask progressTask, String processKey, Sprin
171175
progressTask.progressDone();
172176

173177
refreshProcess(new SpringProcessParams(processKey, "", "", ""));
174-
refreshProcess(new SpringProcessParams(processKey, "metrics", "memory", "area:heap"));
175-
refreshProcess(new SpringProcessParams(processKey, "metrics", "gcPauses", ""));
178+
refreshProcess(new SpringProcessParams(processKey, METRICS, MEMORY, "area:heap"));
179+
refreshProcess(new SpringProcessParams(processKey, METRICS, GC_PAUSES, ""));
176180
}
177181
catch (Exception e) {
178182
log.info("problem occured during process connect", e);
@@ -232,7 +236,7 @@ private void scheduleRefresh(ProgressTask progressTask, SpringProcessParams spri
232236

233237
try {
234238
progressTask.progressEvent(progressMessage);
235-
if(endpoint.equals("metrics") && metricName.equals("memory")) {
239+
if(METRICS.equals(endpoint) && MEMORY.equals(metricName)) {
236240
SpringProcessMemoryMetricsLiveData newMetricsLiveData = connector.refreshMemoryMetrics(this.liveDataProvider.getCurrent(processKey), metricName, springProcessParams.getTags());
237241

238242
if (newMetricsLiveData != null) {
@@ -243,7 +247,7 @@ private void scheduleRefresh(ProgressTask progressTask, SpringProcessParams spri
243247
this.connectedSuccess.put(processKey, true);
244248
}
245249

246-
} else if(endpoint.equals("metrics") && metricName.equals("gcPauses")) {
250+
} else if(METRICS.equals(endpoint) && GC_PAUSES.equals(metricName)) {
247251
SpringProcessGcPausesMetricsLiveData newMetricsLiveData = connector.refreshGcPausesMetrics(this.liveDataProvider.getCurrent(processKey), metricName, springProcessParams.getTags());
248252

249253
if (newMetricsLiveData != null) {

0 commit comments

Comments
 (0)