Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Added try catch block for createContext in http #579

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Util {
private static final Logger LOG = LogManager.getLogger(Util.class);

public static final String PA_BASE_URL = "/_plugins/_performanceanalyzer";
public static final String LEGACY_OPENDISTRO_PA_BASE_URL = PA_BASE_URL;
public static final String LEGACY_OPENDISTRO_PA_BASE_URL = "/_opendistro/_performanceanalyzer";

public static final String METRICS_QUERY_URL = PA_BASE_URL + "/metrics";
public static final String LEGACY_OPENDISTRO_METRICS_QUERY_URL =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,14 +527,36 @@ public RCAScheduler getRcaScheduler() {
}

private void addRcaRequestHandler() {
httpServer.createContext(Util.RCA_QUERY_URL, queryRcaRequestHandler);
httpServer.createContext(Util.LEGACY_OPENDISTRO_RCA_QUERY_URL, queryRcaRequestHandler);
try {
httpServer.createContext(Util.RCA_QUERY_URL, queryRcaRequestHandler);
} catch (IllegalArgumentException e) {
LOG.error("unable to create context in http server for URL: " + Util.RCA_QUERY_URL);
}

try {
httpServer.createContext(Util.LEGACY_OPENDISTRO_RCA_QUERY_URL, queryRcaRequestHandler);
} catch (IllegalArgumentException e) {
LOG.error(
"unable to create context in http server for URL: "
+ Util.LEGACY_OPENDISTRO_RCA_QUERY_URL);
}
}

private void addActionsRequestHandler() {
httpServer.createContext(Util.ACTIONS_QUERY_URL, queryActionRequestHandler);
httpServer.createContext(
Util.LEGACY_OPENDISTRO_ACTIONS_QUERY_URL, queryActionRequestHandler);
try {
httpServer.createContext(Util.ACTIONS_QUERY_URL, queryActionRequestHandler);
} catch (IllegalArgumentException e) {
LOG.error("unable to create context in http server for URL: " + Util.ACTIONS_QUERY_URL);
}

try {
httpServer.createContext(
Util.LEGACY_OPENDISTRO_ACTIONS_QUERY_URL, queryActionRequestHandler);
} catch (IllegalArgumentException e) {
LOG.error(
"unable to create context in http server for URL: "
+ Util.LEGACY_OPENDISTRO_ACTIONS_QUERY_URL);
}
}

public void setDeliberateInterrupt() {
Expand Down