Skip to content

Commit

Permalink
[#10018] Suggest dynamic list of available agent profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
smilu97 committed Jun 5, 2023
1 parent 91c9ba7 commit a39c034
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ public enum CONFIG_LOAD_MODE {

public static final String ACTIVE_PROFILE_KEY = "pinpoint.profiler.profiles.active";

public static final String ACTIVE_PROFILE_CANDIDATES_KEY = "pinpoint.profiler.profiles.candidates";
public static final String DEFAULT_ACTIVE_PROFILE_CANDIDATES = "local | release";

// 1. default config
public static final String CONFIG_FILE_NAME = "pinpoint-root.config";
// 2. profile config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,9 @@ private String getActiveProfile(Properties defaultProperties) {
profile = defaultProperties.getProperty(Profiles.ACTIVE_PROFILE_KEY);
}
if (profile == null) {
final String profileCandidates = javaSystemProperty.getProperty(
Profiles.ACTIVE_PROFILE_CANDIDATES_KEY,
defaultProperties.getProperty(
Profiles.ACTIVE_PROFILE_CANDIDATES_KEY,
Profiles.DEFAULT_ACTIVE_PROFILE_CANDIDATES
)
);
throw new RuntimeException("Failed to detect pinpoint profile. Please add -D" +
Profiles.ACTIVE_PROFILE_KEY +
"=<profile> to VM option. Valid profiles are \"" + profileCandidates + "\"");
"=<profile> to VM option. Valid profiles are \"" + String.join(" | ", supportedProfiles) + "\"");
}

// prevent directory traversal attack
Expand Down
2 changes: 1 addition & 1 deletion redis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>1.17.6</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class NetworkAvailabilityChecker {
public static final String CONFIG_FILE_NAME = "pinpoint-root.config";
public static final String PROFILE_CONFIG_FILE_NAME = "pinpoint.config";

private static final String DEFAULT_PROFILE = "release";

private static final Logger logger = new Logger();

public static void main(String[] args) {
Expand Down Expand Up @@ -99,7 +101,7 @@ public static void main(String[] args) {
}

private static String getActiveProfile(Properties defaultProperties) {
return defaultProperties.getProperty(ACTIVE_PROFILE_KEY, "release");
return defaultProperties.getProperty(ACTIVE_PROFILE_KEY, DEFAULT_PROFILE);
}

private static void loadFileProperties(Properties properties, Path filePath) {
Expand Down

0 comments on commit a39c034

Please sign in to comment.