diff --git a/.gitignore b/.gitignore index e0cc8394a..2a2942000 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ /.settings/ /build /.project -/bin/ /coverage-error.log gradle.properties /src/test/resources/tmp/file_gc/ diff --git a/INSTALL.md b/INSTALL.md index c188bad2f..7eef3d170 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -39,7 +39,7 @@ This document walks you through the process of building and deploying the RCA fr This will not currently enforce client authentication. This feature, including full support for TLS is planned for an upcoming release. - a. Open pa_config/performance-analyzer.properties + a. Open config/performance-analyzer.properties b. Modify the certificate-file-path, private-key-file-path, and https-enabled entries diff --git a/README.md b/README.md index 02f90b519..e51d3e4a4 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ __Metrics__: Metrics are typically served as continuous datastreams to downstrea ### Components -__Framework__: The RCA runtime operates on an `AnalysisGraph`. You can extend this class and override the `construct` method to build your own RCAs. You should specify the path to the class in the `analysis-graph-implementor` section of `pa_config/rca.conf`. The `addLeaf` and `addAllUpstreams` helper methods are useful when you define the dependencies between nodes of the graph. +__Framework__: The RCA runtime operates on an `AnalysisGraph`. You can extend this class and override the `construct` method to build your own RCAs. You should specify the path to the class in the `analysis-graph-implementor` section of `config/rca.conf`. The `addLeaf` and `addAllUpstreams` helper methods are useful when you define the dependencies between nodes of the graph. __Scheduler__: The scheduler invokes the `operate` method on each graph node in topological order as defined in the `AnalysisGraph`. Nodes with no dependencies can be executed in parallel. Use flow-units to share data between RCA nodes instead of shared objects to avoid data races and performance bottlenecks. diff --git a/pa_bin/performance-analyzer-agent b/bin/performance-analyzer-agent similarity index 93% rename from pa_bin/performance-analyzer-agent rename to bin/performance-analyzer-agent index f36c7d5cb..b9c3a77ee 100755 --- a/pa_bin/performance-analyzer-agent +++ b/bin/performance-analyzer-agent @@ -29,11 +29,11 @@ echo "Using JAVA_HOME: $JAVA_HOME" export JAVA_HOME=$JAVA_HOME if ! echo $* | grep -E '(^-d |-d$| -d |--daemonize$|--daemonize )' > /dev/null; then - export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/performance-analyzer-rca/pa_config/log4j2.xml\ -XX:+ExitOnOutOfMemoryError + export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/performance-analyzer-rca/config/log4j2.xml\ -XX:+ExitOnOutOfMemoryError exec $OPENSEARCH_HOME/performance-analyzer-rca/bin/performance-analyzer-rca else echo 'Starting deamon' - export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/performance-analyzer-rca/pa_config/log4j2.xml\ -XX:+ExitOnOutOfMemoryError + export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/performance-analyzer-rca/config/log4j2.xml\ -XX:+ExitOnOutOfMemoryError exec $OPENSEARCH_HOME/performance-analyzer-rca/bin/performance-analyzer-rca & pid=$! diff --git a/build.gradle b/build.gradle index c9efc93bb..e4f660dc7 100644 --- a/build.gradle +++ b/build.gradle @@ -35,10 +35,10 @@ application { '-XX:MaxRAM=400m'] } -// Include pa_config folder in the distribution. +// Include PA related folder in the distribution. applicationDistribution.from(".") { - include 'pa_config/*' - include 'pa_bin/*' + include 'config/*' + include 'bin/*' } distributions { @@ -214,6 +214,8 @@ test { excludeTestsMatching 'org.opensearch.performanceanalyzer.rca.integTests.*' // TODO: Fix this test as it causes OutOfMemoryError: Java heap space error and runs forever excludeTestsMatching 'org.opensearch.performanceanalyzer.reader.OSMetricsSnapshotTests' + // TODO: Fix flaky test: https://github.com/opensearch-project/performance-analyzer-rca/issues/167 + excludeTestsMatching 'org.opensearch.performanceanalyzer.PerformanceAnalyzerWebServerTest' } } else { diff --git a/pa_config/agent-stats-metadata b/config/agent-stats-metadata similarity index 100% rename from pa_config/agent-stats-metadata rename to config/agent-stats-metadata diff --git a/pa_config/log4j2.xml b/config/log4j2.xml similarity index 100% rename from pa_config/log4j2.xml rename to config/log4j2.xml diff --git a/pa_config/opensearch_security.policy b/config/opensearch_security.policy similarity index 99% rename from pa_config/opensearch_security.policy rename to config/opensearch_security.policy index 1e0d2f6b1..bbe1b2e38 100644 --- a/pa_config/opensearch_security.policy +++ b/config/opensearch_security.policy @@ -13,4 +13,3 @@ grant codeBase "jrt:/jdk.attach" { grant codeBase "jrt:/jdk.internal.jvmstat" { permission java.security.AllPermission; }; - diff --git a/pa_config/performance-analyzer.properties b/config/performance-analyzer.properties similarity index 100% rename from pa_config/performance-analyzer.properties rename to config/performance-analyzer.properties diff --git a/pa_config/plugin-stats-metadata b/config/plugin-stats-metadata similarity index 100% rename from pa_config/plugin-stats-metadata rename to config/plugin-stats-metadata diff --git a/pa_config/rca.conf b/config/rca.conf similarity index 100% rename from pa_config/rca.conf rename to config/rca.conf diff --git a/pa_config/rca_idle_master.conf b/config/rca_idle_master.conf similarity index 100% rename from pa_config/rca_idle_master.conf rename to config/rca_idle_master.conf diff --git a/pa_config/rca_master.conf b/config/rca_master.conf similarity index 100% rename from pa_config/rca_master.conf rename to config/rca_master.conf diff --git a/pa_config/supervisord.conf b/config/supervisord.conf similarity index 91% rename from pa_config/supervisord.conf rename to config/supervisord.conf index 5bb8d4bb0..47162f7b4 100644 --- a/pa_config/supervisord.conf +++ b/config/supervisord.conf @@ -28,5 +28,5 @@ serverurl=/usr/share/supervisord.sock files = /etc/supervisor/conf.d/*.conf [program:performance_analyzer] -command=/usr/share/opensearch/performance-analyzer-rca/pa_bin/performance-analyzer-agent /usr/share/opensearch +command=/usr/share/opensearch/performance-analyzer-rca/bin/performance-analyzer-agent /usr/share/opensearch user=1000 diff --git a/docker/Dockerfile b/docker/Dockerfile index 907e21d80..350cda3b3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -54,7 +54,7 @@ RUN chown -R opensearch:0 . && \ RUN unzip config/performance-analyzer-rca-2.0.0.0-rc1-SNAPSHOT.zip RUN cp -r performance-analyzer-rca/* plugins/opensearch-performance-analyzer/ -RUN chmod 755 /usr/share/opensearch/plugins/opensearch-performance-analyzer/pa_bin/performance-analyzer-agent +RUN chmod 755 /usr/share/opensearch/plugins/opensearch-performance-analyzer/bin/performance-analyzer-agent RUN chmod -R 755 /dev/shm ################################################################################ # Build stage 1 (the actual OpenSearch image): @@ -118,7 +118,7 @@ RUN chgrp 0 /usr/local/bin/docker-entrypoint.sh && \ chmod 0775 /usr/local/bin/docker-entrypoint.sh # Bind to all interfaces so that the docker container is accessible from the host machine -RUN sed -i "s|#webservice-bind-host =|webservice-bind-host = 0.0.0.0|g" /usr/share/opensearch/plugins/opensearch-performance-analyzer/pa_config/performance-analyzer.properties +RUN sed -i "s|#webservice-bind-host =|webservice-bind-host = 0.0.0.0|g" /usr/share/opensearch/plugins/opensearch-performance-analyzer/config/performance-analyzer.properties EXPOSE 9200 9300 9600 9650 diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 18b1522cf..db8d89948 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -91,8 +91,8 @@ fi if [[ -d "/usr/share/opensearch/plugins/opensearch-performance-analyzer" ]]; then CLK_TCK=`/usr/bin/getconf CLK_TCK` DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n" - OPENSEARCH_JAVA_OPTS="-Djava.security.policy=file:///usr/share/opensearch/performance-analyzer-rca/pa_config/opensearch_security.policy -Dclk.tck=$CLK_TCK -Djdk.attach.allowAttachSelf=true $OPENSEARCH_JAVA_OPTS" - /usr/bin/supervisord -c /usr/share/opensearch/performance-analyzer-rca/pa_config/supervisord.conf + OPENSEARCH_JAVA_OPTS="-Djava.security.policy=file:///usr/share/opensearch/performance-analyzer-rca/config/opensearch_security.policy -Dclk.tck=$CLK_TCK -Djdk.attach.allowAttachSelf=true $OPENSEARCH_JAVA_OPTS" + /usr/bin/supervisord -c /usr/share/opensearch/performance-analyzer-rca/config/supervisord.conf fi run_as_other_user_if_needed /usr/share/opensearch/bin/opensearch "${open_search_opts[@]}" diff --git a/src/main/java/org/opensearch/performanceanalyzer/config/PluginSettings.java b/src/main/java/org/opensearch/performanceanalyzer/config/PluginSettings.java index 1940938c9..8447311ec 100644 --- a/src/main/java/org/opensearch/performanceanalyzer/config/PluginSettings.java +++ b/src/main/java/org/opensearch/performanceanalyzer/config/PluginSettings.java @@ -21,9 +21,9 @@ public class PluginSettings { private static final Logger LOG = LogManager.getLogger(PluginSettings.class); private static PluginSettings instance; - public static final String CONFIG_FILES_PATH = "pa_config/"; + public static final String CONFIG_FILES_PATH = "config/"; private static final String DEFAULT_CONFIG_FILE_PATH = - Util.PLUGIN_LOCATION + "pa_config/performance-analyzer.properties"; + Util.PLUGIN_LOCATION + "config/performance-analyzer.properties"; private static final String METRICS_LOCATION_KEY = "metrics-location"; private static final String METRICS_LOCATION_DEFAULT = "/dev/shm/performanceanalyzer/"; private static final String DELETION_INTERVAL_KEY = "metrics-deletion-interval"; diff --git a/src/main/java/org/opensearch/performanceanalyzer/jvm/ThreadList.java b/src/main/java/org/opensearch/performanceanalyzer/jvm/ThreadList.java index a2e402da3..cf40b7221 100644 --- a/src/main/java/org/opensearch/performanceanalyzer/jvm/ThreadList.java +++ b/src/main/java/org/opensearch/performanceanalyzer/jvm/ThreadList.java @@ -169,7 +169,7 @@ public static ThreadState getThreadState(long threadId) { // Attach to pid and perform a thread dump private static void runAttachDump(String pid, String[] args) { - + VirtualMachine vm = null; try { vm = VirtualMachine.attach(pid); diff --git a/src/main/java/org/opensearch/performanceanalyzer/rca/framework/util/RcaConsts.java b/src/main/java/org/opensearch/performanceanalyzer/rca/framework/util/RcaConsts.java index fc6c0792e..5291a06d7 100644 --- a/src/main/java/org/opensearch/performanceanalyzer/rca/framework/util/RcaConsts.java +++ b/src/main/java/org/opensearch/performanceanalyzer/rca/framework/util/RcaConsts.java @@ -22,7 +22,7 @@ public class RcaConsts { private static final String RCA_CONF_IDLE_MASTER_FILENAME = "rca_idle_master.conf"; private static final String THRESHOLDS_DIR_NAME = "thresholds"; public static final String CONFIG_DIR_PATH = - Paths.get(Util.READER_LOCATION, "pa_config").toString(); + Paths.get(Util.READER_LOCATION, "config").toString(); public static final String RCA_CONF_PATH = Paths.get(CONFIG_DIR_PATH, RCA_CONF_FILENAME).toString(); public static final String RCA_CONF_MASTER_PATH =