Skip to content

Commit

Permalink
GH-862: expose all actuators via JMX for live hovers automatically wh…
Browse files Browse the repository at this point in the history
…en launching
  • Loading branch information
martinlippert committed Nov 7, 2022
1 parent cb78131 commit fdeb9fe
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import psList from 'ps-list';
import { ListenablePreferenceSetting } from "@pivotal-tools/commons-vscode/lib/launch-util";

const JMX_VM_ARG = '-Dspring.jmx.enabled='
const ACTUATOR_JMX_EXPOSURE_ARG = '-Dmanagement.endpoints.jmx.exposure.include='
const ADMIN_VM_ARG = '-Dspring.application.admin.enabled='
const BOOT_PROJECT_ARG = '-Dspring.boot.project.name=';
const RMI_HOSTNAME = '-Djava.rmi.server.hostname=localhost';
Expand All @@ -23,6 +24,9 @@ class SpringBootDebugConfigProvider implements DebugConfigurationProvider {
if (debugConfiguration.vmArgs.indexOf(JMX_VM_ARG) < 0) {
debugConfiguration.vmArgs += ` ${JMX_VM_ARG}true`;
}
if (debugConfiguration.vmArgs.indexOf(ACTUATOR_JMX_EXPOSURE_ARG) < 0) {
debugConfiguration.vmArgs += ` ${ACTUATOR_JMX_EXPOSURE_ARG}*`;
}
if (debugConfiguration.vmArgs.indexOf(ADMIN_VM_ARG) < 0) {
debugConfiguration.vmArgs += ` ${ADMIN_VM_ARG}true`;
}
Expand All @@ -33,7 +37,7 @@ class SpringBootDebugConfigProvider implements DebugConfigurationProvider {
debugConfiguration.vmArgs += ` ${RMI_HOSTNAME}`;
}
} else {
debugConfiguration.vmArgs = `${JMX_VM_ARG}true ${ADMIN_VM_ARG}true ${BOOT_PROJECT_ARG}${debugConfiguration.projectName} ${RMI_HOSTNAME}`;
debugConfiguration.vmArgs = `${JMX_VM_ARG}true ${ACTUATOR_JMX_EXPOSURE_ARG}* ${ADMIN_VM_ARG}true ${BOOT_PROJECT_ARG}${debugConfiguration.projectName} ${RMI_HOSTNAME}`;
}
}
return debugConfiguration;
Expand Down

0 comments on commit fdeb9fe

Please sign in to comment.