├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ ├── documentation-issue.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── add-untriaged.yml │ ├── backport.yml │ ├── cd.yml │ ├── create-documentation-issue.yml │ ├── delete_backport_branch.yml │ ├── gradle.yml │ ├── links.yml │ └── maven-publish.yml ├── .gitignore ├── .whitesource ├── ADMINS.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── DEVELOPER_GUIDE.md ├── LICENSE.txt ├── MAINTAINERS.md ├── NOTICE ├── README.md ├── RELEASING.md ├── SECURITY.md ├── THIRD-PARTY ├── bin └── performance-analyzer-agent ├── build.gradle ├── checkstyle ├── checkstyle.xml └── findbugs-exclude.xml ├── config ├── agent-stats-metadata ├── log4j2.xml ├── opensearch_security.policy ├── performance-analyzer.properties ├── plugin-stats-metadata └── supervisord.conf ├── docs ├── OVERVIEW.md ├── READER.md └── images │ ├── arch.png │ ├── pa.png │ ├── reader.png │ └── searchbackpressure_autotune.png ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── license-header ├── licenses ├── bc-fips-2.0.0.jar.sha1 ├── bc-fips-LICENSE.txt ├── bc-fips-NOTICE.txt ├── bcpkix-fips-2.0.7.jar.sha1 ├── bcpkix-fips-LICENSE.txt ├── bcpkix-fips-NOTICE.txt ├── byte-buddy-1.9.7.jar.sha1 ├── byte-buddy-LICENSE.txt ├── byte-buddy-NOTICE.txt ├── byte-buddy-agent-1.9.7.jar.sha1 ├── byte-buddy-agent-LICENSE.txt ├── byte-buddy-agent-NOTICE.txt ├── checker-qual-3.29.0.jar.sha1 ├── checker-qual-LICENSE.txt ├── checker-qual-NOTICE.txt ├── commons-lang3-3.14.0.jar.sha1 ├── commons-lang3-LICENSE.txt ├── commons-lang3-NOTICE.txt ├── error_prone_annotations-2.9.0.jar.sha1 ├── error_prone_annotations-LICENSE.txt ├── error_prone_annotations-NOTICE.txt ├── failureaccess-1.0.2.jar.sha1 ├── failureaccess-LICENSE.txt ├── failureaccess-NOTICE.txt ├── gson-2.9.0.jar.sha1 ├── gson-LICENSE.txt ├── gson-NOTICE.txt ├── guava-33.2.1-jre.jar.sha1 ├── guava-LICENSE.txt ├── guava-NOTICE.txt ├── jackson-LICENSE.txt ├── jackson-NOTICE.txt ├── jackson-annotations-2.18.2.jar.sha1 ├── jackson-databind-2.18.2.jar.sha1 ├── jackson-module-paranamer-2.18.2.jar.sha1 ├── jooq-3.10.8.jar.sha1 ├── jooq-LICENSE.txt ├── jooq-NOTICE.txt ├── jsr305-3.0.2.jar.sha1 ├── jsr305-LICENSE.txt ├── jsr305-NOTICE.txt ├── listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar.sha1 ├── listenablefuture-LICENSE.txt ├── listenablefuture-NOTICE.txt ├── mockito-core-2.23.0.jar.sha1 ├── mockito-core-LICENSE.txt ├── mockito-core-NOTICE.txt ├── netty-buffer-4.1.118.Final.jar.sha1 ├── netty-buffer-LICENSE.txt ├── netty-buffer-NOTICE.txt ├── netty-codec-4.1.118.Final.jar.sha1 ├── netty-codec-LICENSE.txt ├── netty-codec-NOTICE.txt ├── netty-codec-http-4.1.118.Final.jar.sha1 ├── netty-codec-http-LICENSE.txt ├── netty-codec-http-NOTICE.txt ├── netty-codec-http2-4.1.118.Final.jar.sha1 ├── netty-codec-http2-LICENSE.txt ├── netty-codec-http2-NOTICE.txt ├── netty-codec-socks-4.1.118.Final.jar.sha1 ├── netty-codec-socks-LICENSE.txt ├── netty-codec-socks-NOTICE.txt ├── netty-common-4.1.118.Final.jar.sha1 ├── netty-common-LICENSE.txt ├── netty-common-NOTICE.txt ├── netty-handler-4.1.118.Final.jar.sha1 ├── netty-handler-LICENSE.txt ├── netty-handler-NOTICE.txt ├── netty-handler-proxy-4.1.118.Final.jar.sha1 ├── netty-handler-proxy-LICENSE.txt ├── netty-handler-proxy-NOTICE.txt ├── netty-resolver-4.1.118.Final.jar.sha1 ├── netty-resolver-LICENSE.txt ├── netty-resolver-NOTICE.txt ├── netty-transport-4.1.118.Final.jar.sha1 ├── netty-transport-LICENSE.txt ├── netty-transport-NOTICE.txt ├── netty-transport-native-unix-common-4.1.118.Final.jar.sha1 ├── netty-transport-native-unix-common-LICENSE.txt ├── netty-transport-native-unix-common-NOTICE.txt ├── objenesis-3.0.1.jar.sha1 ├── objenesis-LICENSE.txt ├── objenesis-NOTICE.txt ├── performance-analyzer-commons-2.0.0.jar.sha1 ├── performance-analyzer-commons-LICENSE.txt └── performance-analyzer-commons-NOTICE.txt ├── packaging ├── deb │ ├── postinst │ └── postrm ├── opensearch-performance-analyzer.service ├── performance-analyzer-agent-cli └── rpm │ ├── postinst │ └── postrm ├── rca ├── README.md └── rfc-rca.pdf ├── release-notes ├── opendistro-for-elasticsearch-performance-analyzer.release-notes-1.10.0.0.md ├── opendistro-for-elasticsearch-performance-analyzer.release-notes-1.10.1.0.md ├── opendistro-for-elasticsearch-performance-analyzer.release-notes-1.11.0.md ├── opendistro-for-elasticsearch-performance-analyzer.release-notes-1.12.0.md ├── opendistro-for-elasticsearch-performance-analyzer.release-notes-1.13.0.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-0.7.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-0.8.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-0.9.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-1.0.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-1.1.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-1.2.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-1.2.1.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-1.3.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-1.4.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-1.6.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-1.7.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-1.8.0.md ├── opendistro-for-elasticsearch.performance-analyzer.release-notes-1.9.0.md ├── opensearch-performance-analyzer.release-notes-1.0.0.0-beta1.md ├── opensearch-performance-analyzer.release-notes-1.0.0.0-rc1.md ├── opensearch-performance-analyzer.release-notes-1.0.0.0.md ├── opensearch-performance-analyzer.release-notes-1.0.1.0.md ├── opensearch-performance-analyzer.release-notes-1.1.0.0.md ├── opensearch-performance-analyzer.release-notes-1.2.0.0.md ├── opensearch-performance-analyzer.release-notes-1.2.1.0.md ├── opensearch-performance-analyzer.release-notes-1.2.2.0.md ├── opensearch-performance-analyzer.release-notes-1.2.3.0.md ├── opensearch-performance-analyzer.release-notes-1.3.0.0.md ├── opensearch-performance-analyzer.release-notes-1.3.16.0.md ├── opensearch-performance-analyzer.release-notes-1.3.20.0.md ├── opensearch-performance-analyzer.release-notes-1.3.8.0.md ├── opensearch-performance-analyzer.release-notes-2.0.0.0-rc1.md ├── opensearch-performance-analyzer.release-notes-2.0.0.0.md ├── opensearch-performance-analyzer.release-notes-2.1.0.0.md ├── opensearch-performance-analyzer.release-notes-2.10.0.0.md ├── opensearch-performance-analyzer.release-notes-2.11.0.0.md ├── opensearch-performance-analyzer.release-notes-2.11.1.0.md ├── opensearch-performance-analyzer.release-notes-2.12.0.0.md ├── opensearch-performance-analyzer.release-notes-2.13.0.0.md ├── opensearch-performance-analyzer.release-notes-2.15.0.0.md ├── opensearch-performance-analyzer.release-notes-2.16.0.0.md ├── opensearch-performance-analyzer.release-notes-2.17.0.0.md ├── opensearch-performance-analyzer.release-notes-2.18.0.0.md ├── opensearch-performance-analyzer.release-notes-2.19.0.0.md ├── opensearch-performance-analyzer.release-notes-2.2.0.0.md ├── opensearch-performance-analyzer.release-notes-2.3.0.0.md ├── opensearch-performance-analyzer.release-notes-2.4.0.0.md ├── opensearch-performance-analyzer.release-notes-2.5.0.0.md ├── opensearch-performance-analyzer.release-notes-2.7.0.0.md ├── opensearch-performance-analyzer.release-notes-2.8.0.0.md ├── opensearch-performance-analyzer.release-notes-2.9.0.0.md ├── opensearch-performance-analyzer.release-notes-3.0.0.0-alpha1.md ├── opensearch-performance-analyzer.release-notes-3.0.0.0-beta1.md └── opensearch-performance-analyzer.release-notes-3.0.0.0.md ├── scripts └── build.sh ├── src ├── main │ ├── java │ │ └── org │ │ │ └── opensearch │ │ │ └── performanceanalyzer │ │ │ ├── OpenSearchResources.java │ │ │ ├── PerformanceAnalyzerPlugin.java │ │ │ ├── action │ │ │ ├── PerformanceAnalyzerActionFilter.java │ │ │ ├── PerformanceAnalyzerActionListener.java │ │ │ └── RequestType.java │ │ │ ├── collectors │ │ │ ├── AdmissionControlMetricsCollector.java │ │ │ ├── CacheConfigMetricsCollector.java │ │ │ ├── CircuitBreakerCollector.java │ │ │ ├── ClusterApplierServiceStatsCollector.java │ │ │ ├── ClusterManagerServiceEventMetrics.java │ │ │ ├── ClusterManagerServiceMetrics.java │ │ │ ├── ElectionTermCollector.java │ │ │ ├── FaultDetectionMetricsCollector.java │ │ │ ├── NodeDetailsCollector.java │ │ │ ├── NodeStatsAllShardsMetricsCollector.java │ │ │ ├── NodeStatsFixedShardsMetricsCollector.java │ │ │ ├── SearchBackPressureStatsCollector.java │ │ │ ├── ShardIndexingPressureMetricsCollector.java │ │ │ ├── ShardStateCollector.java │ │ │ ├── ThreadPoolMetricsCollector.java │ │ │ ├── ValueCalculator.java │ │ │ └── telemetry │ │ │ │ ├── RTFCacheConfigMetricsCollector.java │ │ │ │ ├── RTFDisksCollector.java │ │ │ │ ├── RTFHeapMetricsCollector.java │ │ │ │ ├── RTFNodeStatsAllShardsMetricsCollector.java │ │ │ │ └── RTFThreadPoolMetricsCollector.java │ │ │ ├── config │ │ │ ├── PerformanceAnalyzerController.java │ │ │ └── setting │ │ │ │ ├── ClusterSettingListener.java │ │ │ │ ├── ClusterSettingsManager.java │ │ │ │ ├── PerformanceAnalyzerClusterSettings.java │ │ │ │ └── handler │ │ │ │ ├── ConfigOverridesClusterSettingHandler.java │ │ │ │ ├── NodeStatsSettingHandler.java │ │ │ │ ├── PerformanceAnalyzerClusterSettingHandler.java │ │ │ │ └── PerformanceAnalyzerCollectorsSettingHandler.java │ │ │ ├── http_action │ │ │ ├── config │ │ │ │ ├── PerformanceAnalyzerClusterConfigAction.java │ │ │ │ ├── PerformanceAnalyzerConfigAction.java │ │ │ │ ├── PerformanceAnalyzerOverridesClusterConfigAction.java │ │ │ │ ├── PerformanceAnalyzerResourceProvider.java │ │ │ │ └── RestConfig.java │ │ │ └── whoami │ │ │ │ ├── TransportWhoAmIAction.java │ │ │ │ ├── WhoAmIAction.java │ │ │ │ ├── WhoAmIRequest.java │ │ │ │ ├── WhoAmIRequestBuilder.java │ │ │ │ └── WhoAmIResponse.java │ │ │ ├── listener │ │ │ ├── NoOpSearchListener.java │ │ │ ├── PerformanceAnalyzerSearchListener.java │ │ │ ├── RTFPerformanceAnalyzerSearchListener.java │ │ │ └── SearchListener.java │ │ │ ├── transport │ │ │ ├── PerformanceAnalyzerTransportChannel.java │ │ │ ├── PerformanceAnalyzerTransportInterceptor.java │ │ │ ├── PerformanceAnalyzerTransportRequestHandler.java │ │ │ ├── RTFPerformanceAnalyzerTransportChannel.java │ │ │ ├── RTFPerformanceAnalyzerTransportInterceptor.java │ │ │ └── RTFPerformanceAnalyzerTransportRequestHandler.java │ │ │ ├── util │ │ │ └── Utils.java │ │ │ └── writer │ │ │ └── EventLogQueueProcessor.java │ └── resources │ │ ├── plugin-descriptor.properties │ │ └── plugin-security.policy └── test │ └── java │ └── org │ └── opensearch │ └── performanceanalyzer │ ├── AbstractTests.java │ ├── ConfigOverridesIT.java │ ├── CustomMetricsLocationTestBase.java │ ├── ITConfig.java │ ├── PerformanceAnalyzerIntegTestBase.java │ ├── PerformanceAnalyzerPluginTests.java │ ├── PerformanceAnalyzerRCAHealthCheckIT.java │ ├── action │ ├── PerformanceAnalyzerActionFilterTests.java │ └── PerformanceAnalyzerActionListenerTests.java │ ├── bwc │ └── PABackwardsCompatibilityIT.java │ ├── collectors │ ├── AdmissionControlMetricsCollectorTests.java │ ├── CacheConfigMetricsCollectorTests.java │ ├── CircuitBreakerCollectorTests.java │ ├── ClusterApplierServiceStatsCollectorTests.java │ ├── ClusterManagerServiceEventMetricsTests.java │ ├── ClusterManagerServiceMetricsTests.java │ ├── CollectorTestBase.java │ ├── ElectionTermCollectorTests.java │ ├── FaultDetectionMetricsCollectorTests.java │ ├── JsonKeyTests.java │ ├── NodeDetailsCollectorTests.java │ ├── NodeStatsAllShardsMetricsCollectorTests.java │ ├── NodeStatsFixedShardsMetricsCollectorTests.java │ ├── SearchBackPressureStatsCollectorTests.java │ ├── ShardIndexingPressureMetricsCollectorTests.java │ ├── ShardStateCollectorTests.java │ ├── StatsTests.java │ ├── ThreadPoolMetricsCollectorTests.java │ └── telemetry │ │ ├── RTFCacheConfigMetricsCollectorTests.java │ │ ├── RTFDisksCollectorTests.java │ │ ├── RTFHeapMetricsCollectorTests.java │ │ ├── RTFNodeStatsAllShardsMetricsCollectorTests.java │ │ └── RTFThreadPoolMetricsCollectorTests.java │ ├── config │ ├── ConfigOverridesTestHelper.java │ ├── PerformanceAnalyzerControllerTests.java │ └── setting │ │ └── handler │ │ ├── ConfigOverridesClusterSettingHandlerTests.java │ │ ├── NodeStatsSettingHandlerTests.java │ │ ├── PerformanceAnalyzerClusterSettingHandlerTests.java │ │ └── PerformanceAnalyzerCollectorsSettingHandlerTests.java │ ├── http_action │ ├── config │ │ ├── PerformanceAnalyzerClusterConfigActionTests.java │ │ ├── PerformanceAnalyzerConfigActionTests.java │ │ ├── PerformanceAnalyzerOverridesClusterConfigActionTests.java │ │ └── PerformanceAnalyzerResourceProviderTests.java │ └── whoami │ │ └── WhoAmITests.java │ ├── hwnet │ └── CollectMetricsTests.java │ ├── integ_test │ ├── CpuMetricsIT.java │ ├── HeapMetricsIT.java │ ├── MetricCollectorIntegTestBase.java │ ├── PageFaultMetricsIT.java │ └── json │ │ ├── JsonResponseData.java │ │ ├── JsonResponseField.java │ │ └── JsonResponseNode.java │ ├── listener │ ├── PerformanceAnalyzerSearchListenerTests.java │ ├── RTFPerformanceAnalyzerSearchListenerTests.java │ └── SearchListenerTests.java │ ├── reader_writer_shared │ └── EventLogFileHandlerTests.java │ ├── sqlite │ └── PerformanceAnalyzerSqliteTests.java │ ├── transport │ ├── PerformanceAnalyzerTransportChannelTests.java │ ├── PerformanceAnalyzerTransportRequestHandlerTests.java │ ├── RTFPerformanceAnalyzerTransportChannelTests.java │ └── RTFPerformanceAnalyzerTransportRequestHandlerTests.java │ └── util │ ├── CopyTestResource.java │ ├── TestUtil.java │ ├── UtilsTests.java │ └── WaitFor.java └── test_files ├── new_format ├── new_format.tar.gz └── performance-analyzer.properties ├── old_format ├── old_format.tar.gz └── performance-analyzer.properties └── shm.tar.gz /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # This should match the owning team set up in https://github.com/orgs/opensearch-project/teams 2 | * @khushbr @ansjcy @sbcd90 @devagarwal1803 @Shephalimittal @atharvasharma61 @nishchay21 @DevJhaAbhishek @varunsrivathsav @rramachand21 @psychbot @Gaganjuneja 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 Bug report 3 | about: Create a report to help us improve 4 | title: '[BUG]' 5 | labels: 'bug, untriaged' 6 | assignees: '' 7 | --- 8 | 9 | **What is the bug?** 10 | A clear and concise description of the bug. 11 | 12 | **How can one reproduce the bug?** 13 | Steps to reproduce the behavior: 14 | 1. Go to '...' 15 | 2. Click on '....' 16 | 3. Scroll down to '....' 17 | 4. See error 18 | 19 | **What is the expected behavior?** 20 | A clear and concise description of what you expected to happen. 21 | 22 | **What is your host/environment?** 23 | - OS: [e.g. iOS] 24 | - Version [e.g. 22] 25 | - Plugins 26 | 27 | **Do you have any screenshots?** 28 | If applicable, add screenshots to help explain your problem. 29 | 30 | **Do you have any additional context?** 31 | Add any other context about the problem. 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: OpenSearch Community Support 3 | url: https://discuss.opendistrocommunity.dev/ 4 | about: Please ask and answer questions here. 5 | - name: AWS/Amazon Security 6 | url: https://aws.amazon.com/security/vulnerability-reporting/ 7 | about: Please report security vulnerabilities here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation-issue.md: -------------------------------------------------------------------------------- 1 | **Is your feature request related to a problem?** 2 | A new feature has been added. 3 | 4 | **What solution would you like?** 5 | Document the usage of the new feature. 6 | 7 | **What alternatives have you considered?** 8 | N/A 9 | 10 | **Do you have any additional context?** 11 | See please 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🎆 Feature request 3 | about: Request a feature in this project 4 | title: '[FEATURE]' 5 | labels: 'enhancement, untriaged' 6 | assignees: '' 7 | --- 8 | **Is your feature request related to a problem?** 9 | A clear and concise description of what the problem is, e.g. _I'm always frustrated when [...]_ 10 | 11 | **What solution would you like?** 12 | A clear and concise description of what you want to happen. 13 | 14 | **What alternatives have you considered?** 15 | A clear and concise description of any alternative solutions or features you've considered. 16 | 17 | **Do you have any additional context?** 18 | Add any other context or screenshots about the feature request here. -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | [Describe what this change achieves] 3 | 4 | ### Related Issues 5 | Resolves #[Issue number to be closed when this PR is merged] 6 | 7 | 8 | ### Check List 9 | - [ ] New functionality includes testing. 10 | - [ ] New functionality has been documented. 11 | - [ ] API changes companion pull request [created](https://github.com/opensearch-project/opensearch-api-specification/blob/main/DEVELOPER_GUIDE.md). 12 | - [ ] Commits are signed per the DCO using `--signoff`. 13 | - [ ] Public documentation issue/PR [created](https://github.com/opensearch-project/documentation-website/issues/new/choose). 14 | 15 | By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. 16 | For more information on following Developer Certificate of Origin and signing off your commits, please check [here](https://github.com/opensearch-project/performance-analyzer/blob/main/CONTRIBUTING.md#developer-certificate-of-origin). 17 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gradle" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | commit-message: 8 | prefix: "dependabot:" 9 | ignore: 10 | # For all packages, ignore all major versions to minimize breaking issues 11 | - dependency-name: "*" 12 | update-types: ["version-update:semver-major"] 13 | - package-ecosystem: "github-actions" 14 | directory: "/" 15 | schedule: 16 | interval: "weekly" 17 | commit-message: 18 | prefix: "dependabot:" -------------------------------------------------------------------------------- /.github/workflows/add-untriaged.yml: -------------------------------------------------------------------------------- 1 | name: Apply 'untriaged' label during issue lifecycle 2 | 3 | on: 4 | issues: 5 | types: [opened, reopened, transferred] 6 | 7 | jobs: 8 | apply-label: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/github-script@v6 12 | with: 13 | script: | 14 | github.rest.issues.addLabels({ 15 | issue_number: context.issue.number, 16 | owner: context.repo.owner, 17 | repo: context.repo.repo, 18 | labels: ['untriaged'] 19 | }) 20 | -------------------------------------------------------------------------------- /.github/workflows/backport.yml: -------------------------------------------------------------------------------- 1 | name: Backport 2 | on: 3 | pull_request_target: 4 | types: 5 | - closed 6 | - labeled 7 | 8 | jobs: 9 | backport: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | contents: write 13 | pull-requests: write 14 | name: Backport 15 | steps: 16 | - name: GitHub App token 17 | id: github_app_token 18 | uses: tibdex/github-app-token@v1.5.0 19 | with: 20 | app_id: ${{ secrets.APP_ID }} 21 | private_key: ${{ secrets.APP_PRIVATE_KEY }} 22 | installation_id: 22958780 23 | 24 | - name: Backport 25 | uses: VachaShah/backport@v1.1.4 26 | with: 27 | github_token: ${{ steps.github_app_token.outputs.token }} 28 | branch_name: backport/backport-${{ github.event.number }} -------------------------------------------------------------------------------- /.github/workflows/cd.yml: -------------------------------------------------------------------------------- 1 | name: CD 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout Performance Analyzer package 14 | uses: actions/checkout@v2 15 | with: 16 | path: ./tmp/pa 17 | - name: Set up JDK 1.12 18 | uses: actions/setup-java@v1 19 | with: 20 | java-version: 1.12 21 | - name: Build Artifacts 22 | working-directory: ./tmp/pa 23 | run: | 24 | ./gradlew build buildDeb buildRpm --refresh-dependencies -Dbuild.snapshot=false -Dperformance-analyzer-rca.build=true -Dperformance-analyzer-rca.branch=main -x javadoc 25 | mkdir artifacts 26 | artifact=`ls build/distributions/*.zip` 27 | rpm_artifact=`ls build/distributions/*.rpm` 28 | deb_artifact=`ls build/distributions/*.deb` 29 | cp $artifact artifacts/ 30 | cp $rpm_artifact artifacts/ 31 | cp $deb_artifact artifacts/ 32 | 33 | - name: Configure AWS Credentials 34 | uses: aws-actions/configure-aws-credentials@v1 35 | with: 36 | aws-access-key-id: ${{ secrets.AWS_STAGING_ACCESS_KEY_ID }} 37 | aws-secret-access-key: ${{ secrets.AWS_STAGING_SECRET_ACCESS_KEY }} 38 | aws-region: us-west-2 39 | 40 | - name: Upload Artifacts to S3 41 | working-directory: ./tmp/pa 42 | shell: bash 43 | run: | 44 | zip=`ls artifacts/*.zip` 45 | rpm=`ls artifacts/*.rpm` 46 | deb=`ls artifacts/*.deb` 47 | 48 | # Inject the build number before the suffix 49 | zip_outfile=`basename ${zip%.zip}-build-${GITHUB_RUN_NUMBER}.zip` 50 | rpm_outfile=`basename ${rpm%.rpm}-build-${GITHUB_RUN_NUMBER}.rpm` 51 | deb_outfile=`basename ${deb%.deb}-build-${GITHUB_RUN_NUMBER}.deb` 52 | 53 | s3_prefix="s3://staging.artifacts.opendistroforelasticsearch.amazon.com/snapshots/elasticsearch-plugins/performance-analyzer/" 54 | 55 | echo "Copying ${zip} to ${s3_prefix}${zip_outfile}" 56 | aws s3 cp --quiet $zip ${s3_prefix}${zip_outfile} 57 | 58 | echo "Copying ${rpm} to ${s3_prefix}${rpm_outfile}" 59 | aws s3 cp --quiet $rpm ${s3_prefix}${rpm_outfile} 60 | 61 | echo "Copying ${deb} to ${s3_prefix}${deb_outfile}" 62 | aws s3 cp --quiet $deb ${s3_prefix}${deb_outfile} 63 | 64 | - name: Upload Workflow Artifacts 65 | uses: actions/upload-artifact@v1 66 | with: 67 | name: artifacts 68 | path: ./tmp/pa/artifacts/ 69 | -------------------------------------------------------------------------------- /.github/workflows/create-documentation-issue.yml: -------------------------------------------------------------------------------- 1 | name: Create Documentation Issue 2 | on: 3 | pull_request: 4 | types: 5 | - labeled 6 | env: 7 | PR_NUMBER: ${{ github.event.number }} 8 | 9 | jobs: 10 | create-issue: 11 | if: ${{ github.event.label.name == 'needs-documentation' }} 12 | runs-on: ubuntu-latest 13 | name: Create Documentation Issue 14 | steps: 15 | - name: GitHub App token 16 | id: github_app_token 17 | uses: tibdex/github-app-token@v1.5.0 18 | with: 19 | app_id: ${{ secrets.APP_ID }} 20 | private_key: ${{ secrets.APP_PRIVATE_KEY }} 21 | installation_id: 22958780 22 | 23 | - name: Checkout code 24 | uses: actions/checkout@v2 25 | 26 | - name: Edit the issue template 27 | run: | 28 | echo "https://github.com/opensearch-project/performance-analyzer/pull/${{ env.PR_NUMBER }}." >> ./.github/ISSUE_TEMPLATE/documentation-issue.md 29 | 30 | - name: Create Issue From File 31 | id: create-issue 32 | uses: peter-evans/create-issue-from-file@v4 33 | with: 34 | title: Add documentation related to new feature 35 | content-filepath: ./.github/ISSUE_TEMPLATE/documentation-issue.md 36 | labels: documentation 37 | repository: opensearch-project/documentation-website 38 | token: ${{ steps.github_app_token.outputs.token }} 39 | 40 | - name: Print Issue 41 | run: echo Created related documentation issue ${{ steps.create-issue.outputs.issue-number }} 42 | -------------------------------------------------------------------------------- /.github/workflows/delete_backport_branch.yml: -------------------------------------------------------------------------------- 1 | name: Delete merged branch of the backport PRs 2 | on: 3 | pull_request: 4 | types: 5 | - closed 6 | 7 | jobs: 8 | delete-branch: 9 | runs-on: ubuntu-latest 10 | if: startsWith(github.event.pull_request.head.ref,'backport/') 11 | steps: 12 | - name: Delete merged branch 13 | uses: SvanBoxel/delete-merged-branch@main 14 | env: 15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/gradle.yml: -------------------------------------------------------------------------------- 1 | name: Java CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - "*" 7 | pull_request: 8 | branches: 9 | - "*" 10 | 11 | jobs: 12 | build_pa_pkg: 13 | strategy: 14 | matrix: 15 | java: 16 | - 21 17 | - 23 18 | fail-fast: false 19 | runs-on: [ubuntu-latest] 20 | name: Building PA package 21 | steps: 22 | - name: Set up JDK 23 | uses: actions/setup-java@v1 24 | with: 25 | java-version: ${{matrix.java}} 26 | # Performance Analyzer in ./tmp/performance-analyzer 27 | - name: Checkout Performance Analyzer package 28 | uses: actions/checkout@v2 29 | with: 30 | path: ./tmp/performance-analyzer 31 | # Explicitly set the docker-compose program path so that our build scripts in RCA can run the program 32 | # This is necessary because of the Github Actions environment and the workingDir of the Gradle environment 33 | - name: Set docker-compose path 34 | run: echo "DOCKER_COMPOSE_LOCATION=$(which docker-compose)" >> $GITHUB_ENV 35 | # Set the vm.max_map_count system property to the minimum required to run OpenSearch 36 | - name: Set vm.max_map_count 37 | run: sudo sysctl -w vm.max_map_count=262144 38 | - name: Build Performance Analyzer and run Unit Tests 39 | working-directory: ./tmp/performance-analyzer 40 | run: | 41 | ./gradlew build -Dperformance-analyzer-rca.build=true \ 42 | -Dperformance-analyzer-rca.repo="https://github.com/opensearch-project/performance-analyzer-rca.git" \ 43 | -Dperformance-analyzer-rca.branch=main 44 | - name: Assemble PA jar for BWC tests 45 | working-directory: ./tmp/performance-analyzer 46 | run: | 47 | ./gradlew assemble 48 | version=`./gradlew properties -q | grep "opensearch_version:" | awk '{print $2}'` 49 | IFS='-' read -r -a version_array <<< "$version" 50 | plugin_version="${version_array[0]}.0"; for entry in ${version_array[@]:1}; do plugin_version+="-$entry"; done 51 | echo $plugin_version 52 | mkdir -p ./src/test/resources/org/opensearch/performanceanalyzer/bwc/$plugin_version 53 | cp ./build/distributions/*.zip ./src/test/resources/org/opensearch/performanceanalyzer/bwc/$plugin_version 54 | - name: Generate Jacoco coverage report 55 | working-directory: ./tmp/performance-analyzer 56 | run: ./gradlew jacocoTestReport 57 | - name: Upload coverage report 58 | uses: codecov/codecov-action@v5 59 | with: 60 | token: ${{ secrets.CODECOV_TOKEN }} 61 | - uses: actions/upload-artifact@v4 62 | with: 63 | name: linux-JDK${{ matrix.java }}-reports 64 | path: | 65 | ./tmp/performance-analyzer/build/reports/ 66 | - name: Run Integration Tests 67 | working-directory: ./tmp/performance-analyzer 68 | run: ./gradlew integTest -Dtests.enableIT -Dtests.useDockerCluster 69 | #- name: Run PerformanceAnalzyer Backwards Compatibility Tests 70 | # working-directory: ./tmp/performance-analyzer 71 | # run: ./gradlew bwcTestSuite -Dtests.security.manager=false 72 | -------------------------------------------------------------------------------- /.github/workflows/links.yml: -------------------------------------------------------------------------------- 1 | name: Link Checker 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | check: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - name: Lychee Link Checker 11 | uses: lycheeverse/lychee-action@v1.2.0 12 | with: 13 | args: --accept=200,403,429 **/*.html **/*.md **/*.txt **/*.json 14 | fail: true 15 | env: 16 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} 17 | -------------------------------------------------------------------------------- /.github/workflows/maven-publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish snapshots to maven 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - 'main' 8 | - '[0-9]+.[0-9]+' 9 | - '[0-9]+.x' 10 | 11 | jobs: 12 | build-and-publish-snapshots: 13 | runs-on: ubuntu-latest 14 | 15 | permissions: 16 | id-token: write 17 | contents: write 18 | 19 | steps: 20 | - uses: actions/setup-java@v3 21 | with: 22 | distribution: temurin # Temurin is a distribution of adoptium 23 | java-version: 11 24 | - uses: actions/checkout@v3 25 | - uses: aws-actions/configure-aws-credentials@v1 26 | with: 27 | role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }} 28 | aws-region: us-east-1 29 | - name: publish snapshots to maven 30 | run: | 31 | export SONATYPE_USERNAME=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-username --query SecretString --output text) 32 | export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text) 33 | echo "::add-mask::$SONATYPE_USERNAME" 34 | echo "::add-mask::$SONATYPE_PASSWORD" 35 | ./gradlew publishPluginZipPublicationToSnapshotsRepository 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.gradle/ 2 | /.idea/ 3 | /build/ 4 | *.iml 5 | /bin/ -------------------------------------------------------------------------------- /.whitesource: -------------------------------------------------------------------------------- 1 | { 2 | "scanSettings": { 3 | "configMode": "AUTO", 4 | "configExternalURL": "", 5 | "projectToken": "", 6 | "baseBranches": [] 7 | }, 8 | "checkRunSettings": { 9 | "vulnerableCheckRunConclusionLevel": "failure", 10 | "displayMode": "diff" 11 | }, 12 | "issueSettings": { 13 | "minSeverityLevel": "LOW" 14 | } 15 | } -------------------------------------------------------------------------------- /ADMINS.md: -------------------------------------------------------------------------------- 1 | ## Admins 2 | 3 | | Admin | GitHub ID | Affiliation | 4 | | --------------- | --------------------------------------- | ----------- | 5 | | Charlotte | [CEHENKLE](https://github.com/CEHENKLE) | Amazon | 6 | | Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon | 7 | 8 | [This document](https://github.com/opensearch-project/.github/blob/main/ADMINS.md) explains what admins do in this repo. and how they should be doing it. If you're interested in becoming a maintainer, see [MAINTAINERS](MAINTAINERS.md). If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md). -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This code of conduct applies to all spaces provided by the OpenSource project including in code, documentation, issue trackers, mailing lists, chat channels, wikis, blogs, social media and any other communication channels used by the project. 3 | 4 | 5 | **Our open source communities endeavor to:** 6 | 7 | * Be Inclusive: We are committed to being a community where everyone can join and contribute. This means using inclusive and welcoming language. 8 | * Be Welcoming: We are committed to maintaining a safe space for everyone to be able to contribute. 9 | * Be Respectful: We are committed to encouraging differing viewpoints, accepting constructive criticism and work collaboratively towards decisions that help the project grow. Disrespectful and unacceptable behavior will not be tolerated. 10 | * Be Collaborative: We are committed to supporting what is best for our community and users. When we build anything for the benefit of the project, we should document the work we do and communicate to others on how this affects their work. 11 | 12 | 13 | **Our Responsibility. As contributors, members, or bystanders we each individually have the responsibility to behave professionally and respectfully at all times. Disrespectful and unacceptable behaviors include, but are not limited to:** 14 | 15 | * The use of violent threats, abusive, discriminatory, or derogatory language; 16 | * Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, race, political or religious affiliation; 17 | * Posting of sexually explicit or violent content; 18 | * The use of sexualized language and unwelcome sexual attention or advances; 19 | * Public or private harassment of any kind; 20 | * Publishing private information, such as physical or electronic address, without permission; 21 | * Other conduct which could reasonably be considered inappropriate in a professional setting; 22 | * Advocating for or encouraging any of the above behaviors. 23 | * Enforcement and Reporting Code of Conduct Issues: 24 | 25 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported. [Contact us](mailto:opensource-codeofconduct@amazon.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. 26 | 27 | In the event of conflict, this **Code of Conduct** supercedes the original [Code of Conduct](https://opensearch.org/codeofconduct.html) that this project had adopted. 28 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | OpenSearch is a community project that is built and maintained by people just like **you**. 2 | [This document](https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md) explains how you can contribute to this and related projects. -------------------------------------------------------------------------------- /DEVELOPER_GUIDE.md: -------------------------------------------------------------------------------- 1 | - [Developer Guide](#developer-guide) 2 | - [Forking and Cloning](#forking-and-cloning) 3 | - [Install Prerequisites](#install-prerequisites) 4 | - [JDK](#jdk) 5 | - [Building](#building) 6 | - [Using IntelliJ IDEA](#using-intellij-idea) 7 | - [Submitting Changes](#submitting-changes) 8 | 9 | ## Developer Guide 10 | 11 | So you want to contribute code to this project? Excellent! We're glad you're here. Here's what you need to do. 12 | 13 | ### Forking and Cloning 14 | 15 | Fork this repository on GitHub, and clone locally with `git clone`. 16 | 17 | ### Install Prerequisites 18 | 19 | #### JDK 11 20 | 21 | OpenSearch components build using Java 11 at a minimum and supports JDK 11, 17. This means you must have a JDK of supported version installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-11`. 22 | 23 | ### Building 24 | 25 | To build from the command line, use `./gradlew`. 26 | 27 | ``` 28 | ./gradlew clean 29 | ./gradlew build 30 | ./gradlew publishToMavenLocal 31 | ``` 32 | 33 | `./gradlew spotlessApply` formats code. 34 | `./gradlew paBwcCluster#mixedClusterTask -Dtests.security.manager=false` launches a cluster with three nodes of bwc version of OpenSearch with performance-analyzer and tests backwards compatibility by upgrading one of the nodes with the current version of OpenSearch with performance-analyzer creating a mixed cluster. 35 | `./gradlew paBwcCluster#rollingUpgradeClusterTask -Dtests.security.manager=false` launches a cluster with three nodes of bwc version of OpenSearch with performance-analyzer and tests backwards compatibility by performing rolling upgrade of each node with the current version of OpenSearch with performance-analyzer. 36 | `./gradlew paBwcCluster#fullRestartClusterTask -Dtests.security.manager=false` launches a cluster with three nodes of bwc version of OpenSearch with performance-analyzer and tests backwards compatibility by performing a full restart on the cluster upgrading all the nodes with the current version of OpenSearch with performance-analyzer. 37 | `./gradlew bwcTestSuite -Dtests.security.manager=false` runs all the above bwc tests combined. 38 | `./gradlew integTestRemote -Dtests.enableIT -Dtests.useDockerCluster -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -Dhttps=true -Duser=admin -Dpassword=admin` launches integration tests against a local cluster and run tests with security 39 | 40 | ### Using IntelliJ IDEA 41 | 42 | Launch Intellij IDEA, choose **Import Project**, and select the `build.gradle` file in the root of this package. 43 | 44 | ### Submitting Changes 45 | 46 | See [CONTRIBUTING](CONTRIBUTING.md). 47 | 48 | ### Backports 49 | 50 | The Github workflow in [`backport.yml`](.github/workflows/backport.yml) creates backport PRs automatically when the 51 | original PR with an appropriate label `backport ` is merged to main with the backport workflow 52 | run successfully on the PR. For example, if a PR on main needs to be backported to `1.x` branch, add a label 53 | `backport 1.x` to the PR and make sure the backport workflow runs on the PR along with other checks. Once this PR is 54 | merged to main, the workflow will create a backport PR to the `1.x` branch. -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | ## Overview 2 | 3 | This document contains a list of maintainers in this repo. See [opensearch-project/.github/RESPONSIBILITIES.md](https://github.com/opensearch-project/.github/blob/main/RESPONSIBILITIES.md#maintainer-responsibilities) that explains what the role of maintainer means, what maintainers do in this and other repos, and how they should be doing it. If you're interested in contributing, and becoming a maintainer, see [CONTRIBUTING](CONTRIBUTING.md). 4 | 5 | ## Current Maintainers 6 | 7 | | Maintainer | GitHub ID | Affiliation | 8 | |---------------------------|-------------------------------------------------------| ----------- | 9 | | Khushboo Rajput | [khushbr](https://github.com/khushbr) | Amazon | 10 | | Chenyang Ji | [ansjcy](https://github.com/ansjcy) | Amazon | 11 | | Subhobrata Dey | [sbcd90](https://github.com/sbcd90) | Amazon | 12 | | Dev Agarwal | [devagarwal1803](https://github.com/devagarwal1803) | Amazon | 13 | | shephali mittal | [Shephalimittal](https://github.com/Shephalimittal) | Amazon | 14 | | Atharva Sharma | [atharvasharma61](https://github.com/atharvasharma61) | Amazon | 15 | | Nishchay Malhotra | [nishchay21](https://github.com/nishchay21) | Amazon | 16 | | DevJhaAbhishek | [DevJhaAbhishek](https://github.com/DevJhaAbhishek) | Amazon | 17 | | Varunsrivathsa Venkatesha | [varunsrivathsav](https://github.com/varunsrivathsav) | Amazon | 18 | | Ranjith Ramachandra | [rramachand21](https://github.com/rramachand21) | Amazon | 19 | | Dharmesh Singh | [psychbot](https://github.com/psychbot) | Amazon | 20 | | Gagan Juneja | [Gaganjuneja](https://github.com/Gaganjuneja) | Amazon | 21 | 22 | 23 | ## Previous Maintainers 24 | 25 | | Maintainer | GitHub ID | Affiliation | 26 | |-------------------|-------------------------------------------------------|-------------| 27 | | Joshua Tokle | [jotok](https://github.com/jotok) | Amazon | 28 | | Ruizhen Guo | [rguo-aws](https://github.com/rguo-aws) | Amazon | 29 | | Yujia Sun | [yujias0706](https://github.com/yujias0706) | Amazon | 30 | | Kunal Khatua | [kkhatua](https://github.com/kkhatua) | Amazon | 31 | | Sruti Parthiban | [sruti1312](https://github.com/sruti1312) | Amazon | 32 | | Praveen Sameneni | [praveensameneni](https://github.com/praveensameneni) | Amazon | 33 | | Saurabh Singh | [getsaurabh02](https://github.com/getsaurabh02) | Amazon | 34 | | Megha Goyal | [goyamegh](https://github.com/goyamegh) | Amazon | 35 | | Sagar | [sgup432](https://github.com/sgup432) | Amazon | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | OpenSearch (https://opensearch.org/) 2 | Copyright OpenSearch Contributors 3 | 4 | This product includes software developed by 5 | Elasticsearch (http://www.elastic.co). 6 | Copyright 2009-2018 Elasticsearch 7 | 8 | This product includes software developed by The Apache Software 9 | Foundation (http://www.apache.org/). 10 | 11 | This product includes software developed by 12 | Joda.org (http://www.joda.org/). -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | ## Releasing 2 | 3 | This project follows [OpenSearch branching, labelling, and releasing](https://github.com/opensearch-project/.github/blob/main/RELEASING.md). 4 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | ## Reporting a Vulnerability 2 | 3 | If you discover a potential security issue in this project we ask that you notify OpenSearch Security directly via email to security@opensearch.org. Please do **not** create a public GitHub issue. 4 | -------------------------------------------------------------------------------- /bin/performance-analyzer-agent: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$START_PERF_ANALYZER" = "false" ]; then 4 | echo "Not starting performance-analyzer-agent" 5 | exit 0 6 | fi 7 | 8 | if [ -z "$1" ]; then 9 | if [ -z "$OPENSEARCH_HOME" ]; then 10 | echo "OPENSEARCH_HOME needs to be set or passed in as the first parameter." 11 | exit 1 12 | fi 13 | else 14 | OPENSEARCH_HOME=$1 15 | fi 16 | 17 | if [ ! -z "$2" ]; then 18 | JAVA_HOME=$2 19 | elif [ ! -z "$OPENSEARCH_JAVA_HOME" ]; then 20 | # Use OPENSEARCH_JAVA_HOME if present 21 | JAVA_HOME=$OPENSEARCH_JAVA_HOME 22 | elif [ -z "$JAVA_HOME" ]; then 23 | # Nor OPENSEARCH_JAVA_HOME nor JAVA_HOME is present, failing 24 | echo "OPENSEARCH_JAVA_HOME / JAVA_HOME needs to be set or passed in as the second parameter." 25 | exit 1 26 | fi 27 | 28 | echo "Using JAVA_HOME: $JAVA_HOME" 29 | export JAVA_HOME=$JAVA_HOME 30 | 31 | # Instead of the supervisor executing performance-analyzer-agent from the plugin location, 32 | # we should move this to the reader. The entry-point script should be executing 33 | # performance-analyzer-agent from the reader location. 34 | # We need to change this file: https://github.com/opensearch-project/opensearch-build/blob/main/release/docker/config/opensearch/opensearch-docker-entrypoint.sh 35 | 36 | if ! echo $* | grep -E '(^-d |-d$| -d |--daemonize$|--daemonize )' >/dev/null; then 37 | export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/performance-analyzer-rca-3.0.0-SNAPSHOT/config/log4j2.xml 38 | exec $OPENSEARCH_HOME/performance-analyzer-rca-3.0.0-SNAPSHOT/bin/performance-analyzer-rca 39 | else 40 | echo 'Starting deamon' 41 | export JAVA_OPTS=-Dopensearch.path.home=$OPENSEARCH_HOME\ -Dlog4j.configurationFile=$OPENSEARCH_HOME/performance-analyzer-rca-3.0.0-SNAPSHOT/config/log4j2.xml 42 | exec $OPENSEARCH_HOME/performance-analyzer-rca-3.0.0-SNAPSHOT/bin/performance-analyzer-rca & 43 | 44 | pid=$! 45 | PID_LOC=/tmp/performance-analyzer-agent 46 | if [ -n "$4" ]; then 47 | PID_LOC=$4 48 | fi 49 | 50 | if ! ps -p $pid >$PID_LOC; then 51 | exit 1 52 | fi 53 | fi 54 | -------------------------------------------------------------------------------- /checkstyle/findbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /config/agent-stats-metadata: -------------------------------------------------------------------------------- 1 | # All the meta data to be emitted in the agent stats; an example below 2 | Program=PerformanceAnalyzerAgent 3 | -------------------------------------------------------------------------------- /config/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /config/opensearch_security.policy: -------------------------------------------------------------------------------- 1 | grant { 2 | permission java.lang.management.ManagementPermission "control"; 3 | }; 4 | 5 | grant codebase "file:${java.home}/../lib/tools.jar" { 6 | permission java.security.AllPermission; 7 | }; 8 | 9 | grant codeBase "jrt:/jdk.attach" { 10 | permission java.security.AllPermission; 11 | }; 12 | 13 | grant codeBase "jrt:/jdk.internal.jvmstat" { 14 | permission java.security.AllPermission; 15 | }; 16 | -------------------------------------------------------------------------------- /config/performance-analyzer.properties: -------------------------------------------------------------------------------- 1 | # ======================== OpenSearch performance analyzer plugin config ========================= 2 | 3 | # NOTE: this is an example for Linux. Please modify the config accordingly if you are using it under other OS. 4 | 5 | # Metrics data location 6 | metrics-location = /dev/shm/performanceanalyzer/ 7 | 8 | # Metrics deletion interval (minutes) for metrics data. 9 | # Interval should be between 1 to 60. 10 | metrics-deletion-interval = 1 11 | 12 | # If set to true, the system cleans up the files behind it. So at any point, we should expect only 2 13 | # metrics-db-file-prefix-path files. If set to false, no files are cleaned up. This can be useful, if you are archiving 14 | # the files and wouldn't like for them to be cleaned up. 15 | cleanup-metrics-db-files = true 16 | 17 | # WebService exposed by App's port 18 | webservice-listener-port = 9600 19 | 20 | # Metric DB File Prefix Path location 21 | metrics-db-file-prefix-path = /tmp/metricsdb_ 22 | 23 | https-enabled = false 24 | 25 | #Setup the correct path for certificates 26 | certificate-file-path = specify_path 27 | 28 | private-key-file-path = specify_path 29 | 30 | # WebService bind host; default to all interfaces 31 | #webservice-bind-host = 32 | 33 | # Plugin Stats Metadata file name, expected to be in the same location 34 | plugin-stats-metadata = plugin-stats-metadata 35 | 36 | # Agent Stats Metadata file name, expected to be in the same location 37 | agent-stats-metadata = agent-stats-metadata 38 | 39 | -------------------------------------------------------------------------------- /config/plugin-stats-metadata: -------------------------------------------------------------------------------- 1 | # All the meta data to be emitted in the plugin stats; an example below 2 | Program=PerformanceAnalyzerPlugin 3 | -------------------------------------------------------------------------------- /config/supervisord.conf: -------------------------------------------------------------------------------- 1 | ; supervisor config file 2 | 3 | [unix_http_server] 4 | file=/usr/share/supervisor/performance_analyzer/supervisord.sock 5 | chmod=0770 6 | 7 | [supervisord] 8 | logfile=/usr/share/supervisor/performance_analyzer/supervisord.log ; (main log file;default $CWD/supervisord.log) 9 | pidfile=/usr/share/supervisor/performance_analyzer/supervisord.pid ; (supervisord pidfile;default supervisord.pid) 10 | childlogdir=/usr/share/supervisor/performance_analyzer ; ('AUTO' child log dir, default $TEMP) 11 | 12 | ; the below section must remain in the config file for RPC 13 | ; (supervisorctl/web interface) to work, additional interfaces may be 14 | ; added by defining them in separate rpcinterface: sections 15 | [rpcinterface:supervisor] 16 | supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface 17 | 18 | [supervisorctl] 19 | serverurl=/usr/share/supervisord.sock 20 | 21 | ; The [include] section can just contain the "files" setting. This 22 | ; setting can list multiple files (separated by whitespace or 23 | ; newlines). It can also contain wildcards. The filenames are 24 | ; interpreted as relative to this file. Included files *cannot* 25 | ; include files themselves. 26 | 27 | [include] 28 | files = /etc/supervisor/conf.d/*.conf 29 | 30 | [program:performance_analyzer] 31 | command=/usr/share/opensearch/bin/opensearch-performance-analyzer/performance-analyzer-agent /usr/share/opensearch 32 | user=1000 33 | -------------------------------------------------------------------------------- /docs/OVERVIEW.md: -------------------------------------------------------------------------------- 1 | In `src/main/java/org/opensearch/performanceanalyzer/`: 2 | 3 | - `PerformanceAnalyzerPlugin`'s constructor does the following: 4 | 1. Creates a `scheduledMetricCollectorsExecutor`. 5 | 2. `scheduledMetricCollectorsExecutor.addScheduledMetricCollector(new XYZMetricsCollector())` is called for all collectors. 6 | 3. `scheduledMetricCollectorsExecutor.start()` is called and then `EventLogQueueProcessor.scheduleExecutor()`. 7 | 8 | - Methods in `PerformanceAnalyzerPlugin` interface with the OpenSearch plugin architecture 9 | - `onIndexModule`, `onDiscovery`, etc. are all called by OpenSearch when their corresponding events occur and the plugin can act on them. 10 | - For example: 11 | - `getActionFilters` provides OpenSearch with a list of classes that implement `ActionFilter`. 12 | - `action/PerformanceAnalyzerActionFilter` is the only class currently returned to OpenSearch as an `ActionFilter`. 13 | - when a BulkRequest or SearchRequest is recieved by OpenSearch, `action/PerformanceAnalyzerActionFilter` logs a start event and creates a listener (`action/PerformanceAnalyzerActionListener`) which waits to record the corresponding end event. 14 | - `PerformanceAnalyzerPlugin.getRestHandlers` returns all the classes that can handle REST requests to OpenSearch. 15 | - The classes in `http_action/config` define all the public API routes for Performance Analyzer. 16 | - `http_action/config/RestConfig` defines `PA_BASE_URI = "/_plugins/_performanceanalyzer"` 17 | - `PerformanceAnalyzerResourceProvider` defines the `metrics`, `rca`, `batch` and `actions` routes. 18 | - `PerformanceAnalyzerResourceProvider.SUPPORTED_REDIRECTIONS = ("rca", "metrics", "batch", "actions")` 19 | - `listener/PerformanceAnalyzerSearchListener` hooks into OpenSearch core to emit search operation related metrics. 20 | 21 | 22 | - `writer/EventLogQueueProcessor`: 23 | - contains `purgeQueueAndPersist` which drains `PerformanceAnalyzerMetrics.metricQueue` into a file that contains all events for a certain time bucket. It also removes old events. Uses `event_process.EventLogFileHandler` in Performance Analyzer Commons for file writing logic. 24 | - `scheduleExecutor` periodically runs `purgeQueueAndPersist`. 25 | 26 | - Classes in `collectors` extend `PerformanceAnalyzerMetricsCollector` and implement `MetricsProcessor`. 27 | - `PerformanceAnalyzerMetricsCollector` implements `Runnable` and contains common variables like `value` where a collector stores serialized metrics. 28 | - A collector is triggered through `PerformanceAnalyzerMetricsCollector.collectMetrics`. 29 | 1. The collector will store serialized data in the `value` variable and then call `MetricsProcessor.saveMetricValues`. 30 | 2. `saveMetricValues` calls `PerformanceAnalyzerMetrics.emitMetric` that creates an `Event` from the serialized data and adds it to a static queue (`PerformanceAnalyzerMetrics.metricQueue`) shared across all collectors. -------------------------------------------------------------------------------- /docs/images/arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/docs/images/arch.png -------------------------------------------------------------------------------- /docs/images/pa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/docs/images/pa.png -------------------------------------------------------------------------------- /docs/images/reader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/docs/images/reader.png -------------------------------------------------------------------------------- /docs/images/searchbackpressure_autotune.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/docs/images/searchbackpressure_autotune.png -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # The following 3 properties are used for integration testing with OpenSearch 2 | # The "enablePaAndRca" gradle task in the performance-analyzer-rca repository contains logic to spin up a 2-node 3 | # OpenSearch cluster with the PA and RCA components enabled. The cluster endpoint for this cluster is localhost:9300 4 | # and the REST endpoint is localhost:9200. 5 | 6 | # The OpenSearch cluster endpoint to use for test REST requests 7 | systemProp.tests.rest.cluster=localhost:9200 8 | # The OpenSearch cluster node communication endpoint 9 | systemProp.tests.cluster=localhost:9300 10 | 11 | # The OpenSearch cluster name for integ tests 12 | systemProp.tests.clustername=IntegTestCluster 13 | 14 | # Set this to true if you want a cluster spun up for integration testing 15 | systemProp.tests.useDockerCluster=false 16 | 17 | # Set this to true if you want to enable integration testing 18 | systemProp.tests.enableIT=false 19 | 20 | # The port number for the PerformanceAnalyzer WebService 21 | systemProp.tests.pa.port=9600 22 | 23 | # Whether or not to use https for REST and transport clients 24 | systemProp.tests.https=false 25 | 26 | # The username of the admin user (or any user able to auth requests against opensearch-security) 27 | # NOTE: this only does something if tests.https is set to true 28 | systemProp.tests.user=admin 29 | # The password of the user specified above 30 | systemProp.tests.password=admin 31 | 32 | # Below were added to fix build issue. Refer - https://github.com/diffplug/spotless/issues/834 33 | org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ 34 | --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ 35 | --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ 36 | --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ 37 | --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ 38 | --add-exports jdk.attach/sun.tools.attach=ALL-UNNAMED 39 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip 4 | validateDistributionUrl=true 5 | networkTimeout=10000 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /license-header: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | -------------------------------------------------------------------------------- /licenses/bc-fips-2.0.0.jar.sha1: -------------------------------------------------------------------------------- 1 | ee9ac432cf08f9a9ebee35d7cf8a45f94959a7ab -------------------------------------------------------------------------------- /licenses/bc-fips-LICENSE.txt: -------------------------------------------------------------------------------- 1 | LICENSE 2 | Copyright (c) 2000 - 2024 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/bc-fips-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/bc-fips-NOTICE.txt -------------------------------------------------------------------------------- /licenses/bcpkix-fips-2.0.7.jar.sha1: -------------------------------------------------------------------------------- 1 | 01eea0f325315ca6295b0a6926ff862d8001cdf9 -------------------------------------------------------------------------------- /licenses/bcpkix-fips-LICENSE.txt: -------------------------------------------------------------------------------- 1 | LICENSE 2 | Copyright (c) 2000 - 2024 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/bcpkix-fips-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/bcpkix-fips-NOTICE.txt -------------------------------------------------------------------------------- /licenses/byte-buddy-1.9.7.jar.sha1: -------------------------------------------------------------------------------- 1 | 8fea78fea6449e1738b675cb155ce8422661e237 -------------------------------------------------------------------------------- /licenses/byte-buddy-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright ${project.inceptionYear} - Present ${copyright.holder} 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /licenses/byte-buddy-agent-1.9.7.jar.sha1: -------------------------------------------------------------------------------- 1 | 8e7d1b599f4943851ffea125fd9780e572727fc0 -------------------------------------------------------------------------------- /licenses/byte-buddy-agent-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright ${project.inceptionYear} - Present ${copyright.holder} 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /licenses/checker-qual-3.29.0.jar.sha1: -------------------------------------------------------------------------------- 1 | a805a761b7a734d69f9c1766ead1ff78698a1497 -------------------------------------------------------------------------------- /licenses/checker-qual-NOTICE.txt: -------------------------------------------------------------------------------- 1 | 5786699a0cb71f9dc32e6cca1d665eef07a0882f -------------------------------------------------------------------------------- /licenses/commons-lang3-3.14.0.jar.sha1: -------------------------------------------------------------------------------- 1 | 1ed471194b02f2c6cb734a0cd6f6f107c673afae -------------------------------------------------------------------------------- /licenses/commons-lang3-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Licensed to the Apache Software Foundation (ASF) under one or more 2 | contributor license agreements. See the NOTICE file distributed with 3 | this work for additional information regarding copyright ownership. 4 | The ASF licenses this file to You under the Apache License, Version 2.0 5 | (the "License"); you may not use this file except in compliance with 6 | the License. You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | ============================================================================= 17 | 18 | Commons Lang Package 19 | Version 3.0 20 | Release Notes 21 | 22 | 23 | INTRODUCTION: 24 | 25 | This document contains the release notes for the 3.0 version of Apache Commons Lang. 26 | Commons Lang is a set of utility functions and reusable components that should be of use in any 27 | Java environment. 28 | 29 | Lang 3.0 now targets Java 5.0, making use of features that arrived with Java 5.0 such as generics, 30 | variable arguments, autoboxing, concurrency and formatted output. 31 | 32 | For the latest advice on upgrading, see the following page: 33 | 34 | https://commons.apache.org/lang/article3_0.html -------------------------------------------------------------------------------- /licenses/error_prone_annotations-2.9.0.jar.sha1: -------------------------------------------------------------------------------- 1 | 74fe3b8b4f3fc84dc940d0ca4c4b270dbc902764 -------------------------------------------------------------------------------- /licenses/error_prone_annotations-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/error_prone_annotations-NOTICE.txt -------------------------------------------------------------------------------- /licenses/failureaccess-1.0.2.jar.sha1: -------------------------------------------------------------------------------- 1 | c4a06a64e650562f30b7bf9aaec1bfed43aca12b -------------------------------------------------------------------------------- /licenses/failureaccess-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/failureaccess-NOTICE.txt -------------------------------------------------------------------------------- /licenses/gson-2.9.0.jar.sha1: -------------------------------------------------------------------------------- 1 | 8a1167e089096758b49f9b34066ef98b2f4b37aa -------------------------------------------------------------------------------- /licenses/gson-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/gson-NOTICE.txt -------------------------------------------------------------------------------- /licenses/guava-33.2.1-jre.jar.sha1: -------------------------------------------------------------------------------- 1 | 818e780da2c66c63bbb6480fef1f3855eeafa3e4 -------------------------------------------------------------------------------- /licenses/guava-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/guava-NOTICE.txt -------------------------------------------------------------------------------- /licenses/jackson-LICENSE.txt: -------------------------------------------------------------------------------- 1 | This copy of Jackson JSON processor databind module is licensed under the 2 | Apache (Software) License, version 2.0 ("the License"). 3 | See the License for details about distribution rights, and the 4 | specific rights regarding derivate works. 5 | 6 | You may obtain a copy of the License at: 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 -------------------------------------------------------------------------------- /licenses/jackson-NOTICE.txt: -------------------------------------------------------------------------------- 1 | # Jackson JSON processor 2 | 3 | Jackson is a high-performance, Free/Open Source JSON processing library. 4 | It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has 5 | been in development since 2007. 6 | It is currently developed by a community of developers, as well as supported 7 | commercially by FasterXML.com. 8 | 9 | ## Licensing 10 | 11 | Jackson core and extension components may be licensed under different licenses. 12 | To find the details that apply to this artifact see the accompanying LICENSE file. 13 | For more information, including possible other licensing options, contact 14 | FasterXML.com (http://fasterxml.com). 15 | 16 | ## Credits 17 | 18 | A list of contributors may be found from CREDITS file, which is included 19 | in some artifacts (usually source distributions); but is always available 20 | from the source code management (SCM) system project uses. -------------------------------------------------------------------------------- /licenses/jackson-annotations-2.18.2.jar.sha1: -------------------------------------------------------------------------------- 1 | 985d77751ebc7fce5db115a986bc9aa82f973f4a -------------------------------------------------------------------------------- /licenses/jackson-databind-2.18.2.jar.sha1: -------------------------------------------------------------------------------- 1 | deef8697b92141fb6caf7aa86966cff4eec9b04f -------------------------------------------------------------------------------- /licenses/jackson-module-paranamer-2.18.2.jar.sha1: -------------------------------------------------------------------------------- 1 | e47799848ddd2640ed6c01899db43ddabdac11b0 -------------------------------------------------------------------------------- /licenses/jooq-3.10.8.jar.sha1: -------------------------------------------------------------------------------- 1 | eac51cec417b599da67ecc19c4b04c9a03a95346 -------------------------------------------------------------------------------- /licenses/jooq-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Licensed under the Apache License, Version 2.0 (the "License"); 2 | you may not use this file except in compliance with the License. 3 | You may obtain a copy of the License at 4 | 5 | http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | 13 | Other licenses: 14 | ----------------------------------------------------------------------------- 15 | Commercial licenses for this work are available. These replace the above 16 | ASL 2.0 and offer limited warranties, support, maintenance, and commercial 17 | database integrations. 18 | 19 | For more information, please visit: http://www.jooq.org/licenses -------------------------------------------------------------------------------- /licenses/jooq-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/jooq-NOTICE.txt -------------------------------------------------------------------------------- /licenses/jsr305-3.0.2.jar.sha1: -------------------------------------------------------------------------------- 1 | 25ea2e8b0c338a877313bd4672d3fe056ea78f0d -------------------------------------------------------------------------------- /licenses/jsr305-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007-2009, JSR305 expert group 2 | All rights reserved. 3 | 4 | https://opensource.org/licenses/BSD-3-Clause 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | * Neither the name of the JSR305 expert group nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/jsr305-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/jsr305-NOTICE.txt -------------------------------------------------------------------------------- /licenses/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar.sha1: -------------------------------------------------------------------------------- 1 | b421526c5f297295adef1c886e5246c39d4ac629 -------------------------------------------------------------------------------- /licenses/listenablefuture-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/listenablefuture-NOTICE.txt -------------------------------------------------------------------------------- /licenses/mockito-core-2.23.0.jar.sha1: -------------------------------------------------------------------------------- 1 | 497ddb32fd5d01f9dbe99a2ec790aeb931dff1b1 -------------------------------------------------------------------------------- /licenses/mockito-core-LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2007 Mockito contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /licenses/mockito-core-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/mockito-core-NOTICE.txt -------------------------------------------------------------------------------- /licenses/netty-buffer-4.1.118.Final.jar.sha1: -------------------------------------------------------------------------------- 1 | 7022990af1e0d449f9d5322035899745e19735c5 -------------------------------------------------------------------------------- /licenses/netty-buffer-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/netty-buffer-NOTICE.txt -------------------------------------------------------------------------------- /licenses/netty-codec-4.1.118.Final.jar.sha1: -------------------------------------------------------------------------------- 1 | 307f665c08ce57333121de4f460479fc0c3c94d4 -------------------------------------------------------------------------------- /licenses/netty-codec-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/netty-codec-NOTICE.txt -------------------------------------------------------------------------------- /licenses/netty-codec-http-4.1.118.Final.jar.sha1: -------------------------------------------------------------------------------- 1 | eda08a71294afe78c779b85fd696bc13491507a8 -------------------------------------------------------------------------------- /licenses/netty-codec-http-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/netty-codec-http-NOTICE.txt -------------------------------------------------------------------------------- /licenses/netty-codec-http2-4.1.118.Final.jar.sha1: -------------------------------------------------------------------------------- 1 | e3c35c0685ec9e84c4f84b79feea7c9d185a08d3 -------------------------------------------------------------------------------- /licenses/netty-codec-http2-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/netty-codec-http2-NOTICE.txt -------------------------------------------------------------------------------- /licenses/netty-codec-socks-4.1.118.Final.jar.sha1: -------------------------------------------------------------------------------- 1 | 488a67579f062bba2d2d20ce46f9bb28a68b0875 -------------------------------------------------------------------------------- /licenses/netty-codec-socks-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/netty-codec-socks-NOTICE.txt -------------------------------------------------------------------------------- /licenses/netty-common-4.1.118.Final.jar.sha1: -------------------------------------------------------------------------------- 1 | 4bb0f9899146484fa89f7b9bc27389d5b8e2ecde -------------------------------------------------------------------------------- /licenses/netty-common-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/netty-common-NOTICE.txt -------------------------------------------------------------------------------- /licenses/netty-handler-4.1.118.Final.jar.sha1: -------------------------------------------------------------------------------- 1 | 30ebb05b6b0fb071dbfcf713017c4a767a97bb9b -------------------------------------------------------------------------------- /licenses/netty-handler-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/netty-handler-NOTICE.txt -------------------------------------------------------------------------------- /licenses/netty-handler-proxy-4.1.118.Final.jar.sha1: -------------------------------------------------------------------------------- 1 | 28d6c41b72df614e09440ae0bed53a43fbcfbe27 -------------------------------------------------------------------------------- /licenses/netty-handler-proxy-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/netty-handler-proxy-NOTICE.txt -------------------------------------------------------------------------------- /licenses/netty-resolver-4.1.118.Final.jar.sha1: -------------------------------------------------------------------------------- 1 | 28c378c19c1779eca1104b400452627f3ebc4aea -------------------------------------------------------------------------------- /licenses/netty-resolver-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/netty-resolver-NOTICE.txt -------------------------------------------------------------------------------- /licenses/netty-transport-4.1.118.Final.jar.sha1: -------------------------------------------------------------------------------- 1 | 5a27232e5d08218722d94ca14f0b1b4576e7711c -------------------------------------------------------------------------------- /licenses/netty-transport-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/netty-transport-NOTICE.txt -------------------------------------------------------------------------------- /licenses/netty-transport-native-unix-common-4.1.118.Final.jar.sha1: -------------------------------------------------------------------------------- 1 | 9da25a94e6a0edac90da0bc7894e5a54efcb866b -------------------------------------------------------------------------------- /licenses/netty-transport-native-unix-common-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/netty-transport-native-unix-common-NOTICE.txt -------------------------------------------------------------------------------- /licenses/objenesis-3.0.1.jar.sha1: -------------------------------------------------------------------------------- 1 | 11cfac598df9dc48bb9ed9357ed04212694b7808 -------------------------------------------------------------------------------- /licenses/objenesis-NOTICE.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /licenses/performance-analyzer-commons-2.0.0.jar.sha1: -------------------------------------------------------------------------------- 1 | 6f71f76d588a56b6d9b245f15233350c71448e47 -------------------------------------------------------------------------------- /licenses/performance-analyzer-commons-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/licenses/performance-analyzer-commons-NOTICE.txt -------------------------------------------------------------------------------- /packaging/deb/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # Make sure the OPENSEARCH_HOME environment variable is set 5 | if [ -z "$OPENSEARCH_HOME" ]; then 6 | OPENSEARCH_HOME=/usr/share/opensearch 7 | fi 8 | 9 | # Make sure the OPENSEARCH_PATH_CONF environment variable is set 10 | if [ -z "$OPENSEARCH_PATH_CONF" ]; then 11 | OPENSEARCH_PATH_CONF=/etc/opensearch 12 | fi 13 | 14 | # Prepare the RCA reader process for execution 15 | mv "$OPENSEARCH_HOME"/plugins/opensearch-performance-analyzer/performance-analyzer-rca $OPENSEARCH_HOME 16 | mkdir -p "$OPENSEARCH_HOME"/data 17 | mkdir -p "/var/lib/opensearch" 18 | touch "$OPENSEARCH_HOME"/data/rca_enabled.conf 19 | echo 'true' > "$OPENSEARCH_HOME"/data/rca_enabled.conf 20 | echo 'true' > /var/lib/opensearch/performance_analyzer_enabled.conf 21 | echo 'true' > /var/lib/opensearch/rca_enabled.conf 22 | chown opensearch /var/lib/opensearch/performance_analyzer_enabled.conf 23 | chown opensearch /var/lib/opensearch/rca_enabled.conf 24 | chown -R opensearch "$OPENSEARCH_HOME/performance-analyzer-rca" 25 | chmod a+rw /tmp 26 | 27 | if ! grep -q '## OpenSearch Performance Analyzer' $OPENSEARCH_PATH_CONF/jvm.options; then 28 | CLK_TCK=`/usr/bin/getconf CLK_TCK` 29 | echo >> $OPENSEARCH_PATH_CONF/jvm.options 30 | echo '## OpenSearch Performance Analyzer' >> $OPENSEARCH_PATH_CONF/jvm.options 31 | echo "-Dclk.tck=$CLK_TCK" >> $OPENSEARCH_PATH_CONF/jvm.options 32 | echo "-Djdk.attach.allowAttachSelf=true" >> $OPENSEARCH_PATH_CONF/jvm.options 33 | echo "-Djava.security.policy=file://$OPENSEARCH_PATH_CONF/opensearch-performance-analyzer/opensearch_security.policy" >> $OPENSEARCH_PATH_CONF/jvm.options 34 | fi 35 | 36 | IS_UPGRADE=false 37 | # Below codeblock is using the fact that postinst script is called with the most-recently configured version. 38 | # In other words, a fresh installed will be called like "postinst configure" with no previous version ($2 is null) 39 | if [ -z "$2" ]; then 40 | # If $2 is null, this is an install 41 | IS_UPGRADE=false 42 | else 43 | # otherwise this is an upgrade 44 | IS_UPGRADE=true 45 | fi 46 | 47 | #DEBHELPER# 48 | 49 | if [ "x$IS_UPGRADE" != "xtrue" ]; then 50 | if command -v systemctl > /dev/null; then 51 | echo '# Enabling OpenSearch performance analyzer to start and stop along with opensearch.service' 52 | systemctl daemon-reload 53 | systemctl enable opensearch-performance-analyzer.service || true 54 | 55 | elif command -v chkconfig >/dev/null; then 56 | echo "### Non systemd distro. Please start and stop performance analyzer manually using the command: " 57 | echo "sh /usr/share/opensearch/bin/opensearch-performance-analyzer/performance-analyzer-agent /usr/share/opensearch -d" 58 | fi 59 | fi 60 | 61 | exit 0 62 | -------------------------------------------------------------------------------- /packaging/deb/postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Make sure the OPENSEARCH_HOME environment variable is set 4 | if [ -z "$OPENSEARCH_HOME" ]; then 5 | OPENSEARCH_HOME=/usr/share/opensearch 6 | fi 7 | 8 | echo "OPENSEARCH_HOME is $OPENSEARCH_HOME" 9 | 10 | # Cleanup files 11 | if [ -d $OPENSEARCH_HOME/performance-analyzer-rca ]; then 12 | rm -rf $OPENSEARCH_HOME/performance-analyzer-rca 13 | fi 14 | 15 | if [ -f $OPENSEARCH_HOME/bin/performance-analyzer-agent-cli ]; then 16 | rm $OPENSEARCH_HOME/bin/performance-analyzer-agent-cli 17 | fi 18 | 19 | if [ -f "$OPENSEARCH_HOME"/data/rca_enabled.conf ]; then 20 | rm "$OPENSEARCH_HOME"/data/rca_enabled.conf 21 | fi 22 | 23 | if [ -f /var/lib/opensearch/performance_analyzer_enabled.conf ]; then 24 | rm /var/lib/opensearch/performance_analyzer_enabled.conf 25 | fi 26 | 27 | if [ -f /var/lib/opensearch/rca_enabled.conf ]; then 28 | rm /var/lib/opensearch/rca_enabled.conf 29 | fi 30 | 31 | if [ -f /usr/lib/systemd/system/opensearch.service ]; then 32 | rm /usr/lib/systemd/system/opensearch.service 33 | fi 34 | -------------------------------------------------------------------------------- /packaging/opensearch-performance-analyzer.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OpenSearch Performance Analyzer 3 | PartOf=opensearch.service 4 | 5 | [Service] 6 | ExecStart=/usr/share/opensearch/bin/opensearch-performance-analyzer/performance-analyzer-agent-cli 7 | Restart=on-failure 8 | User=opensearch 9 | Group=opensearch 10 | Environment=OPENSEARCH_HOME=/usr/share/opensearch 11 | WorkingDirectory=/usr/share/opensearch 12 | 13 | [Install] 14 | WantedBy=opensearch.service 15 | -------------------------------------------------------------------------------- /packaging/performance-analyzer-agent-cli: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Make sure the OPENSEARCH_HOME environment variable is set 4 | if [ -z "$OPENSEARCH_HOME" ]; then 5 | echo "OPENSEARCH_HOME variable needs to be set or passed in as a parameter." 6 | exit 1 7 | fi 8 | 9 | # Make sure the OPENSEARCH_PATH_CONF environment variable is set 10 | if [ -z "$OPENSEARCH_PATH_CONF" ]; then 11 | echo "OPENSEARCH_PATH_CONF variable needs to be set or passed in as a parameter." 12 | echo "Note: It should be set to $OPENSEARCH_HOME/config (for docker or tar) or /etc/opensearch (for rpm or deb)" 13 | exit 1 14 | fi 15 | 16 | PA_AGENT_JAVA_OPTS="-Dlog4j.configurationFile=$OPENSEARCH_PATH_CONF/opensearch-performance-analyzer/log4j2.xml \ 17 | -Xms64M -Xmx64M -XX:+UseSerialGC -XX:CICompilerCount=1 -XX:-TieredCompilation -XX:InitialCodeCacheSize=4096 \ 18 | -XX:MaxRAM=400m" 19 | 20 | OPENSEARCH_MAIN_CLASS="org.opensearch.performanceanalyzer.PerformanceAnalyzerApp" \ 21 | OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=performance-analyzer-rca/lib \ 22 | OPENSEARCH_JAVA_OPTS=$PA_AGENT_JAVA_OPTS \ 23 | exec $OPENSEARCH_HOME/bin/opensearch-cli \ 24 | "$@" 25 | -------------------------------------------------------------------------------- /packaging/rpm/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # We ignore errors in the rpm context because the package will be considered "installed" 3 | # even if the postinst script fails. Therefore, the postinst script must be written such 4 | # that it cannot fail 5 | 6 | # set -e 7 | 8 | # Post install script for Redhat like distros. Tested on CentOS 7. 9 | 10 | # Make sure the OPENSEARCH_HOME environment variable is set 11 | if [ -z "$OPENSEARCH_HOME" ]; then 12 | OPENSEARCH_HOME=/usr/share/opensearch 13 | fi 14 | 15 | # Make sure the OPENSEARCH_PATH_CONF environment variable is set 16 | if [ -z "$OPENSEARCH_PATH_CONF" ]; then 17 | OPENSEARCH_PATH_CONF=/etc/opensearch 18 | fi 19 | 20 | # Prepare the RCA reader process for execution 21 | mv "$OPENSEARCH_HOME"/plugins/opensearch-performance-analyzer/performance-analyzer-rca $OPENSEARCH_HOME 22 | mkdir -p "$OPENSEARCH_HOME"/data 23 | mkdir -p "/var/lib/opensearch" 24 | touch "$OPENSEARCH_HOME"/data/rca_enabled.conf 25 | echo 'true' > "$OPENSEARCH_HOME"/data/rca_enabled.conf 26 | echo 'true' > /var/lib/opensearch/performance_analyzer_enabled.conf 27 | echo 'true' > /var/lib/opensearch/rca_enabled.conf 28 | chown opensearch /var/lib/opensearch/performance_analyzer_enabled.conf 29 | chown opensearch /var/lib/opensearch/rca_enabled.conf 30 | chown -R opensearch "$OPENSEARCH_HOME/performance-analyzer-rca" 31 | chmod a+rw /tmp 32 | 33 | if ! grep -q '## OpenSearch Performance Analyzer' $OPENSEARCH_PATH_CONF/jvm.options; then 34 | CLK_TCK=`/usr/bin/getconf CLK_TCK` 35 | echo >> $OPENSEARCH_PATH_CONF/jvm.options 36 | echo '## OpenSearch Performance Analyzer' >> $OPENSEARCH_PATH_CONF/jvm.options 37 | echo "-Dclk.tck=$CLK_TCK" >> $OPENSEARCH_PATH_CONF/jvm.options 38 | echo "-Djdk.attach.allowAttachSelf=true" >> $OPENSEARCH_PATH_CONF/jvm.options 39 | echo "-Djava.security.policy=file://$OPENSEARCH_PATH_CONF/opensearch-performance-analyzer/opensearch_security.policy" >> $OPENSEARCH_PATH_CONF/jvm.options 40 | fi 41 | 42 | IS_UPGRADE=false 43 | case "$1" in 44 | 1) 45 | # If $1=1 this is an install 46 | IS_UPGRADE=false 47 | ;; 48 | 2) 49 | # If $1=2 this is an upgrade 50 | IS_UPGRADE=true 51 | ;; 52 | 53 | *) 54 | echo "post install script called with unknown argument \`$1'" >&2 55 | exit 1 56 | ;; 57 | esac 58 | 59 | if [ "x$IS_UPGRADE" != "xtrue" ]; then 60 | if command -v systemctl > /dev/null; then 61 | echo '# Enabling OpenSearch performance analyzer to start and stop along with opensearch.service' 62 | systemctl daemon-reload 63 | systemctl enable opensearch-performance-analyzer.service || true 64 | 65 | elif command -v chkconfig >/dev/null; then 66 | echo "### Non systemd distro. Please start and stop performance analyzer manually using the command: " 67 | echo "sh /usr/share/opensearch/bin/opensearch-performance-analyzer/performance-analyzer-agent /usr/share/opensearch -d" 68 | fi 69 | fi 70 | -------------------------------------------------------------------------------- /packaging/rpm/postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Make sure the OPENSEARCH_HOME environment variable is set 4 | if [ -z "$OPENSEARCH_HOME" ]; then 5 | OPENSEARCH_HOME=/usr/share/opensearch 6 | fi 7 | 8 | # Cleanup files 9 | if [ -d $OPENSEARCH_HOME/performance-analyzer-rca ]; then 10 | rm -rf $OPENSEARCH_HOME/performance-analyzer-rca 11 | fi 12 | 13 | if [ -f $OPENSEARCH_HOME/bin/performance-analyzer-agent-cli ]; then 14 | rm $OPENSEARCH_HOME/bin/performance-analyzer-agent-cli 15 | fi 16 | 17 | if [ -f "$OPENSEARCH_HOME"/data/rca_enabled.conf ]; then 18 | rm "$OPENSEARCH_HOME"/data/rca_enabled.conf 19 | fi 20 | 21 | if [ -f /var/lib/opensearch/performance_analyzer_enabled.conf ]; then 22 | rm /var/lib/opensearch/performance_analyzer_enabled.conf 23 | fi 24 | 25 | if [ -f /var/lib/opensearch/rca_enabled.conf ]; then 26 | rm /var/lib/opensearch/rca_enabled.conf 27 | fi 28 | 29 | if [ -f /usr/lib/systemd/system/opensearch.service ]; then 30 | rm /usr/lib/systemd/system/opensearch.service 31 | fi 32 | -------------------------------------------------------------------------------- /rca/README.md: -------------------------------------------------------------------------------- 1 | This is the RFC for the Root Cause Analysis feature to be built on Performance Analyzer. Please comment and post feedback at: 2 | https://github.com/opendistro-for-elasticsearch/performance-analyzer/issues/73 3 | -------------------------------------------------------------------------------- /rca/rfc-rca.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/rca/rfc-rca.pdf -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch-performance-analyzer.release-notes-1.11.0.md: -------------------------------------------------------------------------------- 1 | ## 2020-10-16 Version 1.11.0.0 2 | 3 | Supported Elasticsearch version 7.9.1 4 | 5 | ### Features 6 | * Batch Metrics API ([#159](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/159)) 7 | 8 | ### Enhancements 9 | * Update Threadpool metric collector to use reflection to read queue capacity([#210](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/210)) 10 | * Adding the Support to Proxy the call over to the _agent for Actions API([#215](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/215)) 11 | 12 | ### Bug fixes 13 | * Remove addition of new tests ([#202](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/202)) 14 | 15 | ### Infrastructure 16 | * Add integration test for the /override API ([#195](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/195)) 17 | 18 | ### Documentation 19 | * Fix download and doc link in the package description ([#198](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/198)) 20 | 21 | ### Maintenance 22 | * Enabling RCA framework by default ([#209](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/209)) 23 | 24 | ### Refactoring 25 | 26 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch-performance-analyzer.release-notes-1.12.0.md: -------------------------------------------------------------------------------- 1 | ## 2020-11-17 Version 1.12.0.0 2 | 3 | Supported Elasticsearch version 7.10.0 4 | 5 | ### Features 6 | * Publish shard state metrics ([#212](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/212)) 7 | * Add ClusterManager Throttling Collector Metrics ([#227](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/227)) 8 | * Publish fault detection metrics ([#218](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/218)) 9 | * Adding new GC info collector to the scheduled metrics collector([#225](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/225)) 10 | 11 | ### Enhancements 12 | * Updating Default Port web-server to 9600 ([#233](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/233)) 13 | 14 | ### Bug fixes 15 | * Cache Size metric: Using the Actual Cache Values and not the Delta ([#231](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/231)) 16 | 17 | ### Infrastructure 18 | * Set up jacoco for code coverage ([#234](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/234)) 19 | 20 | ### Documentation 21 | 22 | ### Maintenance 23 | 24 | ### Refactoring 25 | 26 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch-performance-analyzer.release-notes-1.13.0.0.md: -------------------------------------------------------------------------------- 1 | ## 2021-02-02 Version 1.13.0.0 2 | 3 | Supported Elasticsearch version 7.10.2 4 | 5 | ### Features 6 | 7 | ### Enhancements 8 | 9 | ### Bug fixes 10 | 11 | ### Infrastructure 12 | * Improve Test coverage ([#251](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/251)) 13 | * Improve Test coverage up to 48% ([#255](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/255)) 14 | * Changes for the Performance Analyzer IT to run with newer versions of ES ([#256](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/256)) 15 | * Improve test coverage up to 62% ([#257](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/257)) 16 | * Improve Test Coverage to 81% ([#258](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/258)) 17 | * Add integ tests for OS metrics(cpu, page fault) ([#252](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/252)) 18 | 19 | 20 | ### Documentation 21 | 22 | ### Maintenance 23 | 24 | ### Refactoring 25 | 26 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-0.7.0.md: -------------------------------------------------------------------------------- 1 | ## Version 0.7.0 (2019-01-31) 2 | 3 | Version compatible with elasticsearch 6.5.4 4 | 5 | ### New Features 6 | 7 | This is the first release of the Open Distro Performance Analyzer. 8 | 9 | Performance Analyzer has two components: 10 | Performance Analyzer Plugin: Collects metrics across the stack and writes them to shared memory. As this is the plug-in, this will run within the Elasticsearch process. 11 | Performance Analyzer Agent: A Java process that takes periodic snapshots of metrics collected by Plugin, and indexes them to provide a REST interface. The interface supports aggregations on metrics grouped by dimensions for a given time interval. More details of supported metrics, aggregations and dimensions can be found in the documentation. 12 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-0.8.0.md: -------------------------------------------------------------------------------- 1 | ## Version 0.8.0 2 | 3 | Version compatible with elasticsearch 6.6.2 4 | 5 | ### New Features 6 | 7 | This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 6.6.2 8 | 9 | ### Improvements 10 | 11 | * Better measurement granularity for ClusterManager Metrics [#16](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/16) 12 | 13 | ### Bug fixes 14 | 15 | * Bad File Descriptor Fix: Close not handled properly on sun.tools.attach.VirtualMachineImpl$SocketInputStream; fixed it on the Client side [#20](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/20) 16 | * Close DB Connection on reader restart [ab841cd]( https://github.com/opendistro-for-elasticsearch/performance-analyzer/commit/ab841cd462717d1a05da08028e63414887d8d71a) 17 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-0.9.0.md: -------------------------------------------------------------------------------- 1 | ## Version 0.9.0 2 | 3 | Version compatible with elasticsearch 6.7.1 4 | 5 | ### New Features 6 | 7 | This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 6.7.1 8 | 9 | * More ClusterManager metrics support: ClusterManager_Task_Queue_Time [#15](https://github.com/opendistro-for-elasticsearch/performance-analyzer/pull/15) 10 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-1.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.0.0 2 | 3 | Version compatible with elasticsearch 7.0.1 4 | 5 | ### New Features 6 | 7 | This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.0.1 8 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-1.1.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.1.0 2 | 3 | Version compatible with elasticsearch 7.1.1 4 | 5 | ### New Features 6 | 7 | This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.1.1 8 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-1.2.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.2.0 2 | 3 | Version compatible with elasticsearch 7.2.0 4 | 5 | ### New Features 6 | 7 | This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.2.0 8 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-1.2.1.md: -------------------------------------------------------------------------------- 1 | ## Version 1.2.1 2 | 3 | Version compatible with elasticsearch 7.2.1 4 | 5 | ### New Features 6 | 7 | This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.2.1 8 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-1.3.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.3.0 2 | 3 | Version compatible with elasticsearch 7.3.2 4 | 5 | ### New Features 6 | 7 | This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.3.2 8 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-1.4.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.4.0 2 | 3 | Version compatible with elasticsearch 7.4.2 4 | 5 | ### New Features 6 | 7 | This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.4.2 8 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-1.6.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.6.0 2 | 3 | Version compatible with elasticsearch 7.6.1 4 | 5 | ### New Features 6 | 7 | This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.6.1 8 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-1.7.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.7.0 2 | 3 | Version compatible with elasticsearch 7.6.1 4 | 5 | ### New Features 6 | 7 | No changes 8 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-1.8.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.8.0 2 | 3 | Version compatible with elasticsearch 7.7.0 4 | 5 | ### New Features 6 | 7 | This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.7.0 8 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch.performance-analyzer.release-notes-1.9.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.9.0 2 | 3 | Version compatible with elasticsearch 7.8.0 4 | 5 | ### New Features 6 | 7 | * This is the release of the Open Distro Performance Analyzer that will work with elasticsearch 7.8.0 8 | 9 | * Add the Root Cause Analysis (RCA) Framework [#12](https://github.com/opendistro-for-elasticsearch/performance-analyzer-rca/pull/12) 10 | 11 | * Add gRPC based networking for RCA [#13](https://github.com/opendistro-for-elasticsearch/performance-analyzer-rca/pull/13) 12 | 13 | * Add young gen RCA and unit tests [#41](https://github.com/opendistro-for-elasticsearch/performance-analyzer-rca/pull/41) 14 | 15 | * Add API for RCA [#61](https://github.com/opendistro-for-elasticsearch/performance-analyzer-rca/pull/61) 16 | 17 | * Add HighCpuRca to collect total cpu usage [#125](https://github.com/opendistro-for-elasticsearch/performance-analyzer-rca/pull/125) 18 | 19 | * Add hot node RCA [#128](https://github.com/opendistro-for-elasticsearch/performance-analyzer-rca/pull/128) 20 | 21 | * Muting API [#168](https://github.com/opendistro-for-elasticsearch/performance-analyzer-rca/pull/168) 22 | 23 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.0.0.0-beta1.md: -------------------------------------------------------------------------------- 1 | ## 2021-04-26 Version 1.0.0.0-beta1 Release Notes 2 | 3 | Compatible with OpenSearch 1.0.0-beta1 4 | 5 | ### Infrastructure 6 | 7 | * OpenSearch fork changes ([#1](https://github.com/opensearch-project/performance-analyzer/pull/1)) 8 | * OpenSearch fork changes ([#3](https://github.com/opensearch-project/performance-analyzer-rca/pull/3)) 9 | * Modify opensearch version and fix buiild CI ([#4](https://github.com/opensearch-project/performance-analyzer/pull/4)) 10 | * Add missing metricsdb* files and enable spotless ([#5](https://github.com/opensearch-project/performance-analyzer-rca/pull/5)) 11 | * Update version to 1.x ([#6](https://github.com/opensearch-project/performance-analyzer/pull/6)) 12 | * Update version to 1.0 beta ([#6](https://github.com/opensearch-project/performance-analyzer-rca/pull/6)) 13 | * Update plugin name and add release notes ([#7](https://github.com/opensearch-project/performance-analyzer/pull/7)) 14 | * Fix Integration test and update README ([#7](https://github.com/opensearch-project/performance-analyzer-rca/pull/7)) 15 | 16 | ### Documentation 17 | 18 | * Add SPDX license identifier ([#3](https://github.com/opensearch-project/performance-analyzer/pull/3)) 19 | * Add SPDX license identifier ([#4](https://github.com/opensearch-project/performance-analyzer-rca/pull/4)) 20 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.0.0.0-rc1.md: -------------------------------------------------------------------------------- 1 | ## Version 1.0.0.0-rc1 Release Notes 2 | 3 | Compatible with OpenSearch 1.0.0-rc1 4 | 5 | ### Enhancements 6 | 7 | * Add CONFIG_DIR_NOT_FOUND in StatExceptionCode ([#11](https://github.com/opensearch-project/performance-analyzer-rca/pull/11)) 8 | 9 | ### Bug fixes 10 | 11 | * Create conf directory if not exist to avoid NoSuchFile exceptions ([#9](https://github.com/opensearch-project/performance-analyzer/pull/9)) 12 | * Update docker artifact link ([#9](https://github.com/opensearch-project/performance-analyzer-rca/pull/9)) 13 | * Modify JVM gen tuning policy and update the Unit test ([#12](https://github.com/opensearch-project/performance-analyzer-rca/pull/12)) 14 | 15 | ### Infrastructure 16 | 17 | * Upgrade Jackson version to 2.11.4 ([#13](https://github.com/opensearch-project/performance-analyzer/pull/13)) 18 | * Upgrade Jackson version to 2.11.4 ([#15](https://github.com/opensearch-project/performance-analyzer-rca/pull/15)) 19 | * Update version to rc1 ([#16](https://github.com/opensearch-project/performance-analyzer/pull/16)) 20 | * Update to rc1 version and opendistro links ([#17](https://github.com/opensearch-project/performance-analyzer-rca/pull/17)) 21 | 22 | ### Maintenance 23 | 24 | * Modify printing stacktrace to logger instead of stdout ([#10](https://github.com/opensearch-project/performance-analyzer-rca/pull/10)) 25 | * Modify namespace from opendistro to opensearch ([#12](https://github.com/opensearch-project/performance-analyzer/pull/12)) 26 | * Modify namespace to opensearch ([#14](https://github.com/opensearch-project/performance-analyzer-rca/pull/14)) 27 | * Update REST resources to follow new OpenSearch naming convention ([#14](https://github.com/opensearch-project/performance-analyzer/pull/14)) 28 | * Replace references to /_opendistro with /_plugins ([#16](https://github.com/opensearch-project/performance-analyzer-rca/pull/16)) 29 | * Add legacy REST endpoints to integration tests ([#17](https://github.com/opensearch-project/performance-analyzer/pull/17)) 30 | * Create HTTP contexts for legacy resource name ([#18](https://github.com/opensearch-project/performance-analyzer-rca/pull/18)) 31 | * Add backward compatible resource names to RcaController ([#19](https://github.com/opensearch-project/performance-analyzer-rca/pull/19)) 32 | * Update licenses sha and add release notes ([#18](https://github.com/opensearch-project/performance-analyzer/pull/18)) 33 | 34 | ### Documentation 35 | 36 | * Update rest endpoint names in README ([#15](https://github.com/opensearch-project/performance-analyzer/pull/15)) 37 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.0.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.0.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 1.0.0 4 | 5 | ### Enhancements 6 | 7 | * Add CONFIG_DIR_NOT_FOUND in StatExceptionCode ([#11](https://github.com/opensearch-project/performance-analyzer-rca/pull/11)) 8 | 9 | ### Bug fixes 10 | 11 | * Create conf directory if not exist to avoid NoSuchFile exceptions ([#9](https://github.com/opensearch-project/performance-analyzer/pull/9)) 12 | * Update docker artifact link ([#9](https://github.com/opensearch-project/performance-analyzer-rca/pull/9)) 13 | * Modify JVM gen tuning policy and update the Unit test ([#12](https://github.com/opensearch-project/performance-analyzer-rca/pull/12)) 14 | * Fix actions by legacy cluster endpoints ([#21](https://github.com/opensearch-project/performance-analyzer/pull/21)) 15 | 16 | ### Infrastructure 17 | 18 | * Upgrade Jackson version to 2.11.4 ([#13](https://github.com/opensearch-project/performance-analyzer/pull/13)) 19 | * Upgrade Jackson version to 2.11.4 ([#15](https://github.com/opensearch-project/performance-analyzer-rca/pull/15)) 20 | * Update version to rc1 ([#16](https://github.com/opensearch-project/performance-analyzer/pull/16)) 21 | * Update to rc1 version and opendistro links ([#17](https://github.com/opensearch-project/performance-analyzer-rca/pull/17)) 22 | * Enabled automated license header checks ([#22](https://github.com/opensearch-project/performance-analyzer/pull/22)) 23 | * Standardize processes across all plugins - Checklist items ([#26](https://github.com/opensearch-project/performance-analyzer/pull/26)) 24 | * Standardize processes across all plugins - Checklist items ([#22](https://github.com/opensearch-project/performance-analyzer-rca/pull/22)) 25 | 26 | ### Maintenance 27 | 28 | * Modify printing stacktrace to logger instead of stdout ([#10](https://github.com/opensearch-project/performance-analyzer-rca/pull/10)) 29 | * Modify namespace from opendistro to opensearch ([#12](https://github.com/opensearch-project/performance-analyzer/pull/12)) 30 | * Modify namespace to opensearch ([#14](https://github.com/opensearch-project/performance-analyzer-rca/pull/14)) 31 | * Update REST resources to follow new OpenSearch naming convention ([#14](https://github.com/opensearch-project/performance-analyzer/pull/14)) 32 | * Replace references to /_opendistro with /_plugins ([#16](https://github.com/opensearch-project/performance-analyzer-rca/pull/16)) 33 | * Add legacy REST endpoints to integration tests ([#17](https://github.com/opensearch-project/performance-analyzer/pull/17)) 34 | * Create HTTP contexts for legacy resource name ([#18](https://github.com/opensearch-project/performance-analyzer-rca/pull/18)) 35 | * Add backward compatible resource names to RcaController ([#19](https://github.com/opensearch-project/performance-analyzer-rca/pull/19)) 36 | * Update licenses sha and add release notes ([#18](https://github.com/opensearch-project/performance-analyzer/pull/18)) 37 | * Update upstream dependency and README ([#21](https://github.com/opensearch-project/performance-analyzer-rca/pull/21)) 38 | * Update version from 1.0.0.0-rc1 to 1.0.0.0 ([#24](https://github.com/opensearch-project/performance-analyzer-rca/pull/24)) 39 | * Update OS upstream version and add release notes for 1.0.0.0 release ([#32](https://github.com/opensearch-project/performance-analyzer/pull/32)) 40 | 41 | ### Documentation 42 | 43 | * Update rest endpoint names in README ([#15](https://github.com/opensearch-project/performance-analyzer/pull/15)) 44 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.0.1.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.0.1.0 Release Notes 2 | 3 | Compatible with OpenSearch 1.0.0 4 | 5 | ### Bug fixes 6 | 7 | * Create writer file only if metrics are present ([#23](https://github.com/opensearch-project/performance-analyzer-rca/pull/23)) 8 | * Fixing Event Log file cleanup issue ([#30](https://github.com/opensearch-project/performance-analyzer-rca/pull/30)) 9 | * Create writer file if metrics are available ([#31](https://github.com/opensearch-project/performance-analyzer/pull/31)) 10 | * Addressing the spotbug failure ([#31](https://github.com/opensearch-project/performance-analyzer-rca/pull/31)) 11 | * Fixing Event Log file cleanup issue ([#36](https://github.com/opensearch-project/performance-analyzer/pull/36)) 12 | * Handling purging of lingering files before scheduleExecutor start ([#37](https://github.com/opensearch-project/performance-analyzer/pull/37)) 13 | * Fix failing file handler test ([#38](https://github.com/opensearch-project/performance-analyzer/pull/38)) 14 | * Add privileges for removing files ([#45](https://github.com/opensearch-project/performance-analyzer-rca/pull/45)) 15 | * Fix build to succeed with opensearch_version provided ([#52](https://github.com/opensearch-project/performance-analyzer/pull/52)) 16 | 17 | ### Maintenance 18 | 19 | * Add tests to check for writer file only if metrics are present ([#35](https://github.com/opensearch-project/performance-analyzer/pull/35)) 20 | * Fixing the linker error, updating from docs-beta to official document ([#32](https://github.com/opensearch-project/performance-analyzer/pull/32)) 21 | * Remove dependency on main branch when running spotless ([#47](https://github.com/opensearch-project/performance-analyzer/pull/47)) 22 | * Updates to gradle build file ([#48](https://github.com/opensearch-project/performance-analyzer/pull/48)) 23 | * Remove dependency on main branch when running spotless check ([#54](https://github.com/opensearch-project/performance-analyzer-rca/pull/54)) 24 | * Update the branch to 1.0.1 ([#58](https://github.com/opensearch-project/performance-analyzer/pull/58)) 25 | * Add release notes for 1.0.1 release ([#59](https://github.com/opensearch-project/performance-analyzer/pull/59)) 26 | * Update the branch to 1.0.1 ([#62](https://github.com/opensearch-project/performance-analyzer-rca/pull/62)) 27 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.1.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.1.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 1.1.0 4 | 5 | ### Features 6 | 7 | * AdmissionControl RequestSize AutoTuning ([#44](https://github.com/opensearch-project/performance-analyzer-rca/pull/44)) 8 | 9 | ### Enhancements 10 | 11 | * Use Collector override disable list for ShardIndexingPressureMetricCollector ([#28](https://github.com/opensearch-project/performance-analyzer/pull/28)) 12 | * Adding metric emission + UT for RCA_FRAMEWORK_CRASH ([#36](https://github.com/opensearch-project/performance-analyzer-rca/pull/36)) 13 | * Replace String split with Guava Splitter ([#42](https://github.com/opensearch-project/performance-analyzer-rca/pull/42)) 14 | * Add cluster_manager not up writer metric ([#51](https://github.com/opensearch-project/performance-analyzer-rca/pull/51)) 15 | 16 | ### Bug fixes 17 | 18 | * Handling empty flow unit during Cache/Queue RCA execution ([#34](https://github.com/opensearch-project/performance-analyzer-rca/pull/34)) 19 | * Fix for OOM error ([#35](https://github.com/opensearch-project/performance-analyzer-rca/pull/35)) 20 | * Fix thread name categorizations for Operation dimension in metrics API ([#44](https://github.com/opensearch-project/performance-analyzer-rca/pull/44)) 21 | * Add privileges for removing files ([#45](https://github.com/opensearch-project/performance-analyzer-rca/pull/45)) 22 | * Fix spotbugs failure by removing unused variable ([#47](https://github.com/opensearch-project/performance-analyzer-rca/pull/47)) 23 | * Change log level and remove retry ([#50](https://github.com/opensearch-project/performance-analyzer-rca/pull/50)) 24 | * Add retries for flaky tests and fix failing tests ([#52](https://github.com/opensearch-project/performance-analyzer-rca/pull/52)) 25 | * Fix deleting files within 60sec interval ([#62](https://github.com/opensearch-project/performance-analyzer/pull/62)) 26 | 27 | ### Maintenance 28 | 29 | * Fix snapshot build, upgrade to OpenSearch 1.1 ([#55](https://github.com/opensearch-project/performance-analyzer-rca/pull/55)) 30 | * Add workflow for gauntlet tests and fix spotbug errors ([#63](https://github.com/opensearch-project/performance-analyzer-rca/pull/63)) 31 | * Update version and add release notes for 1.1.0.0 release ([#68](https://github.com/opensearch-project/performance-analyzer/pull/68)) 32 | 33 | ### Documentation 34 | 35 | * Add themed logo to README ([#40](https://github.com/opensearch-project/performance-analyzer/pull/40)) 36 | * Fixes typo in APIs to enable PA batch metrics API in readme ([#42](https://github.com/opensearch-project/performance-analyzer/pull/42)) 37 | 38 | ### Refactoring 39 | 40 | * Addressing changes for StatsCollector ([#37](https://github.com/opensearch-project/performance-analyzer-rca/pull/37)) 41 | * Refactor stats collector ([#46](https://github.com/opensearch-project/performance-analyzer/pull/46)) 42 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.2.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.2.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 1.2.0 4 | 5 | ### Features 6 | 7 | * AdmissionControl Split RCA ([#69](https://github.com/opensearch-project/performance-analyzer-rca/pull/69)) 8 | 9 | ### Enhancements 10 | 11 | * Update commons-io version ([#73](https://github.com/opensearch-project/performance-analyzer-rca/pull/73)) 12 | * Adds Thread_Waited_Time and Thread_Waited_Event metrics ([#70](https://github.com/opensearch-project/performance-analyzer-rca/pull/70)) 13 | 14 | ### Bug fixes 15 | 16 | * Add checkstyle plugin reference ([#79](https://github.com/opensearch-project/performance-analyzer/pull/79)) 17 | * Add snapshot variable when building RCA ([#83](https://github.com/opensearch-project/performance-analyzer/pull/83)) 18 | * Fix broken build and remove deb rpm files ([#85](https://github.com/opensearch-project/performance-analyzer/pull/85)) 19 | * Remove emitting the entry key with the METRICS_WRITE_ERROR metric ([#71](https://github.com/opensearch-project/performance-analyzer-rca/pull/71)) 20 | * Add log rotation and prevent noisy logs ([#87](https://github.com/opensearch-project/performance-analyzer-rca/pull/87)) 21 | 22 | ### Maintenance 23 | 24 | * Add BWC tests for PA ([#69](https://github.com/opensearch-project/performance-analyzer/pull/69)) 25 | * Add DCO workflow and fix failing IT ([#78](https://github.com/opensearch-project/performance-analyzer/pull/78)) 26 | * Add DCO workflow ([#83](https://github.com/opensearch-project/performance-analyzer-rca/pull/83)) 27 | 28 | ### Documentation 29 | 30 | * Update README.md ([#88](https://github.com/opensearch-project/performance-analyzer-rca/pull/88)) -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.2.1.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.2.1.0 Release Notes 2 | 3 | Compatible with OpenSearch 1.2.1 4 | 5 | ### Bug fixes 6 | 7 | * Upgrade plugin and log4j version ([#96](https://github.com/opensearch-project/performance-analyzer-rca/pull/96)) 8 | * Upgrade plugin and log4j version ([#98](https://github.com/opensearch-project/performance-analyzer/pull/98)) 9 | 10 | ### Maintenance 11 | 12 | * Update branch to 1.2 and add release notes ([#99](https://github.com/opensearch-project/performance-analyzer/pull/99)) 13 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.2.2.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.2.2.0 Release Notes 2 | 3 | Compatible with OpenSearch 1.2.2 4 | 5 | ### Bug fixes 6 | 7 | * Upgrade plugin and log4j version ([#101](https://github.com/opensearch-project/performance-analyzer-rca/pull/101)) 8 | * Upgrade plugin and log4j version ([#100](https://github.com/opensearch-project/performance-analyzer/pull/100)) 9 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.2.3.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.2.3.0 Release Notes 2 | 3 | Compatible with OpenSearch 1.2.3 4 | 5 | ### Maintenance 6 | 7 | * Upgrade plugin version (1.2.3) and log4j version (2.17.0) ([#109](https://github.com/opensearch-project/performance-analyzer/pull/109)) 8 | * Upgraded to log4j 2.17 in 1.2 ([#105](https://github.com/opensearch-project/performance-analyzer-rca/pull/105)) -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.3.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.3.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 1.3.0 4 | 5 | ### Features 6 | 7 | * Add .whitesource configuration file ([#119](https://github.com/opensearch-project/performance-analyzer/pull/119)) 8 | * Add support for OPENSEARCH_JAVA_HOME ([#133](https://github.com/opensearch-project/performance-analyzer/pull/133)) 9 | * Adding auto backport ([#146](https://github.com/opensearch-project/performance-analyzer/pull/146)) 10 | 11 | ### Bug fixes 12 | 13 | * Fix and lock link checker at lycheeverse/lychee-action ([#113](https://github.com/opensearch-project/performance-analyzer/pull/113)) 14 | * Upgrade plugin to 1.3.0 and log4j to 2.17.1 ([#118](https://github.com/opensearch-project/performance-analyzer/pull/118)) 15 | * Don't run opensearch-cli in a child process ([#126](https://github.com/opensearch-project/performance-analyzer/pull/126)) 16 | * Modify grpc-netty-shaded to grpc-netty ([#129](https://github.com/opensearch-project/performance-analyzer-rca/pull/129)) 17 | * Fixes grpc channel leak issue and vertex buffer issue on non active cluster_manager ([#130](https://github.com/opensearch-project/performance-analyzer-rca/pull/130)) 18 | * Fixes RCA crash on active cluster_manager ([#132](https://github.com/opensearch-project/performance-analyzer-rca/pull/132)) 19 | 20 | ### Maintenance 21 | 22 | * Upgrade docker to 1.3 ([#114](https://github.com/opensearch-project/performance-analyzer-rca/pull/114)) 23 | * Upgrade plugin to 1.3.0 and log4j to 2.17.1 ([#118](https://github.com/opensearch-project/performance-analyzer/pull/118)) 24 | * Removing deprecated InitialBootClassLoaderMetaspaceSize JVM command line flag ([#124](https://github.com/opensearch-project/performance-analyzer/pull/124)) 25 | * Upgrade guava, protobuf version ([#127](https://github.com/opensearch-project/performance-analyzer/pull/127)) 26 | * Update jacksonVersion to 2.12.6 ([#129](https://github.com/opensearch-project/performance-analyzer/pull/129)) 27 | * Upgrade netty and bouncycastle versions ([#130](https://github.com/opensearch-project/performance-analyzer/pull/130)) 28 | * Remove jcenter ([#136](https://github.com/opensearch-project/performance-analyzer/pull/136)) 29 | * Update grpc licenses ([#139](https://github.com/opensearch-project/performance-analyzer/pull/139)) 30 | 31 | ### Documentation 32 | 33 | * Modify license headers ([#153](https://github.com/opensearch-project/performance-analyzer-rca/pull/153)) -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.3.16.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.3.16.0 Release Notes 2 | 3 | Compatible with OpenSearch 1.3.16 4 | 5 | ### Maintenance 6 | * Bump netty to match version from core's buildSrc/version.properties and bump grpc to 1.56.1 ([#546](https://github.com/opensearch-project/performance-analyzer-rca/pull/546)) 7 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.3.20.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.3.20 Release Notes 2 | 3 | Compatible with OpenSearch 1.3.20 4 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-1.3.8.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.3.8.0 Release Notes 2 | 3 | Compatible with OpenSearch 1.3.8 4 | 5 | ### Features 6 | * Enhance the cluster config fields for PA([#342](https://github.com/opensearch-project/performance-analyzer/pull/342)) 7 | 8 | ### Maintenance 9 | * Upgrade guava, protobuf minor versions. ([#374](https://github.com/opensearch-project/performance-analyzer/pull/374)) 10 | 11 | ### Documentation 12 | * add maintainers.md file. ([#359](https://github.com/opensearch-project/performance-analyzer/pull/359)) 13 | 14 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.0.0.0-rc1.md: -------------------------------------------------------------------------------- 1 | ## Version 2.0.0.0-rc1 Release Notes 2 | 3 | Compatible with OpenSearch 2.0.0-rc1 4 | 5 | ### Features 6 | 7 | * Adds setting to enable/disable Thread Contention Monitoring ([#171](https://github.com/opensearch-project/performance-analyzer/pull/171)) 8 | * Fixes calculation of average thread blocked time and average thread waited time ([#118](https://github.com/opensearch-project/performance-analyzer-rca/pull/118)) 9 | 10 | 11 | ### Bug fixes 12 | 13 | * Fix EventLogFileHandlerTests flaky test ([#178](https://github.com/opensearch-project/performance-analyzer/pull/178)) 14 | * Add retry for tests ([#180](https://github.com/opensearch-project/performance-analyzer/pull/180)) 15 | 16 | ### Maintenance 17 | 18 | * Gradle 7, JDK related changes and OS 2.0 ([#179](https://github.com/opensearch-project/performance-analyzer/pull/179)) 19 | * Add additional logs for Integration Tests ([#182](https://github.com/opensearch-project/performance-analyzer/pull/182)) 20 | * Enable dependency license check and removing unused license ([#183](https://github.com/opensearch-project/performance-analyzer/pull/183)) 21 | * Moving build script file here from opensearch build package ([#184](https://github.com/opensearch-project/performance-analyzer/pull/184)) 22 | * Update directory names and remove jar for integTest ([#187](https://github.com/opensearch-project/performance-analyzer/pull/187)) 23 | * Update PA directories from plugins to root ([#189](https://github.com/opensearch-project/performance-analyzer/pull/189)) 24 | * Changes to add jdk17, remove jdk 8,14, OS 2.0 and upgrade to gradle 7 ([#156](https://github.com/opensearch-project/performance-analyzer-rca/pull/156)) 25 | * Update directory names ([#166](https://github.com/opensearch-project/performance-analyzer-rca/pull/166)) 26 | * Update PA directories from plugins to root ([#168](https://github.com/opensearch-project/performance-analyzer-rca/pull/168)) 27 | 28 | ### Documentation 29 | * Updated issue templates from .github. ([#177](https://github.com/opensearch-project/performance-analyzer/pull/177)) 30 | * Removing metrics which are not required now as were removed in OS 2.0 ([#159](https://github.com/opensearch-project/performance-analyzer-rca/pull/159)) 31 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.0.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.0.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.0.0 4 | 5 | ### Features 6 | 7 | * Adds setting to enable/disable Thread Contention Monitoring ([#171](https://github.com/opensearch-project/performance-analyzer/pull/171)) 8 | * Fixes calculation of average thread blocked time and average thread waited time ([#118](https://github.com/opensearch-project/performance-analyzer-rca/pull/118)) 9 | 10 | ### Bug fixes 11 | 12 | * Fix EventLogFileHandlerTests flaky test ([#178](https://github.com/opensearch-project/performance-analyzer/pull/178)) 13 | * Add retry for tests ([#180](https://github.com/opensearch-project/performance-analyzer/pull/180)) 14 | 15 | ### Maintenance 16 | 17 | * Gradle 7, JDK related changes and OS 2.0 ([#179](https://github.com/opensearch-project/performance-analyzer/pull/179)) 18 | * Add additional logs for Integration Tests ([#182](https://github.com/opensearch-project/performance-analyzer/pull/182)) 19 | * Enable dependency license check and removing unused license ([#183](https://github.com/opensearch-project/performance-analyzer/pull/183)) 20 | * Moving build script file here from opensearch build package ([#184](https://github.com/opensearch-project/performance-analyzer/pull/184)) 21 | * Update directory names and remove jar for integTest ([#187](https://github.com/opensearch-project/performance-analyzer/pull/187)) 22 | * Update PA directories from plugins to root ([#189](https://github.com/opensearch-project/performance-analyzer/pull/189)) 23 | * Changes to add jdk17, remove jdk 8,14, OS 2.0 and upgrade to gradle 7 ([#156](https://github.com/opensearch-project/performance-analyzer-rca/pull/156)) 24 | * Update directory names ([#166](https://github.com/opensearch-project/performance-analyzer-rca/pull/166)) 25 | * Update PA directories from plugins to root ([#168](https://github.com/opensearch-project/performance-analyzer-rca/pull/168)) 26 | 27 | ### Documentation 28 | * Updated issue templates from .github. ([#177](https://github.com/opensearch-project/performance-analyzer/pull/177)) 29 | * Removing metrics which are not required now as were removed in OS 2.0 ([#159](https://github.com/opensearch-project/performance-analyzer-rca/pull/159)) 30 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.1.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.1.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.1.0 4 | 5 | ### Features 6 | 7 | * Thread Metrics RCA ([#180](https://github.com/opensearch-project/performance-analyzer/pull/180)) 8 | 9 | ### Maintenance 10 | 11 | * Update 2.1 release version ([#192](https://github.com/opensearch-project/performance-analyzer-rca/pull/192)) 12 | * Update 2.1 release version ([#232](https://github.com/opensearch-project/performance-analyzer/pull/232)) 13 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.10.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.10.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.10.0 4 | 5 | ### Enhancements 6 | * Add Search Back Pressure Autotune Pipeline [#517](https://github.com/opensearch-project/performance-analyzer/pull/517) 7 | * SearchBackPressure Service Node/Cluster RCA [#437](https://github.com/opensearch-project/performance-analyzer-rca/pull/437) 8 | * SearchBackPressure Policy/Decider Generic Framework Added [#461](https://github.com/opensearch-project/performance-analyzer-rca/pull/461) 9 | * Handle Reader thread termination gracefully [#476](https://github.com/opensearch-project/performance-analyzer-rca/pull/476) 10 | 11 | ### Infrastructure 12 | * Update BWC version to 2.9.0 [#529](https://github.com/opensearch-project/performance-analyzer/pull/529) 13 | * Update performance-analyzer-commons library version [#537](https://github.com/opensearch-project/performance-analyzer/pull/446) 14 | * Upgrade gRPC protobug to mitigate connection termination issue [#471](https://github.com/opensearch-project/performance-analyzer-rca/pull/471) 15 | 16 | 17 | ### Maintenance 18 | * Address core refactor changes for Task foundation classes and StreamIO [#522](https://github.com/opensearch-project/performance-analyzer/pull/522) 19 | * Address xcontent changes in core [#526](https://github.com/opensearch-project/performance-analyzer/pull/526) 20 | * Remove usage of deprecated "master" APIs [#513](https://github.com/opensearch-project/performance-analyzer/pull/513) 21 | * Update docker-compose.yml [#465](https://github.com/opensearch-project/performance-analyzer-rca/pull/465) 22 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.11.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.11.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.11.0 4 | 5 | ### Bug fixes 6 | * Update Jooq version and address bind variable failure in AdmissionControl Emitter [#493](https://github.com/opensearch-project/performance-analyzer/pull/493) 7 | 8 | ### Infrastructure 9 | * Update PULL_REQUEST_TEMPLATE.md [#560)](https://github.com/opensearch-project/performance-analyzer/pull/560) 10 | 11 | ### Maintenance 12 | * Depreceate NodeStatsFixedShardsMetricsCollector in favor of NodeStatsAllShardsMetricsCollector [#551](https://github.com/opensearch-project/performance-analyzer/pull/551) 13 | * Add tracer to getTransports [#556](https://github.com/opensearch-project/performance-analyzer/pull/556) 14 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.11.1.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.11.1 Release Notes 2 | 3 | Compatible with OpenSearch 2.11.1 4 | 5 | ### Infrastructure 6 | * Set Autopublish to true in Jenkins publish for performance-analyzer-commons repo [#45](https://github.com/opensearch-project/performance-analyzer-commons/pull/45) 7 | * Upgrade performance-analyzer-commons version to 1.2.0 [#598](https://github.com/opensearch-project/performance-analyzer/pull/598) 8 | 9 | 10 | ### Maintenance 11 | * Update build.gradle to use isSnapshot logic [#521](https://github.com/opensearch-project/performance-analyzer-rca/pull/521) 12 | * Add separate metric for cluster manager service events and metrics [#579](https://github.com/opensearch-project/performance-analyzer/pull/579) 13 | * Add separate metric in commons repo for cluster manager service events and metrics [#51](https://github.com/opensearch-project/performance-analyzer-commons/pull/51) 14 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.12.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.12.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.12.0 4 | 5 | ### Enhancements 6 | * Add separate metric for cluster manager service events and metrics [#579](https://github.com/opensearch-project/performance-analyzer/pull/579) 7 | 8 | ### Infrastructure 9 | * Update to Gradle 8.5 and Fixing CVE-2023-33202 [#617](https://github.com/opensearch-project/performance-analyzer/pull/617) 10 | 11 | ### Maintenance 12 | * Remove redundant ClusterManagerThrottlingMetricsCollector [#582](https://github.com/opensearch-project/performance-analyzer/pull/582) 13 | * Update spotless to meet JDK-21 baseline [#618](https://github.com/opensearch-project/performance-analyzer/pull/618) 14 | 15 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.13.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.13.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.13.0 4 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.15.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.15.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.15.0 4 | 5 | ### Infrastructure 6 | * Bump PA to use 1.4.0 PA commons lib [#664](https://github.com/opensearch-project/performance-analyzer/pull/664) 7 | 8 | ### Feature 9 | * Framework changes to merge PA with RTF [#662](https://github.com/opensearch-project/performance-analyzer/pull/662) 10 | 11 | ### Bug Fix 12 | * Fixed the bug in CacheConfigMetricsCollector [#657](https://github.com/opensearch-project/performance-analyzer/pull/657) 13 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.16.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.16.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.16.0 4 | 5 | ### Infrastructure 6 | * Bump bouncycastle from 1.74 to 1.78.1 [#656](https://github.com/opensearch-project/performance-analyzer/pull/656) 7 | * Bump PA to use 1.5.0 PA commons lib [#698](https://github.com/opensearch-project/performance-analyzer/pull/698) 8 | 9 | ### Feature 10 | * Adds index_uuid as a tag in node stats all shard metrics [#680](https://github.com/opensearch-project/performance-analyzer/pull/680) 11 | * Adds the listener for resource utilization metrics [#687](https://github.com/opensearch-project/performance-analyzer/pull/687) 12 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.17.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.17.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.17.0 4 | 5 | ### Infrastructure 6 | * Bump PA to use 1.6.0 PA commons lib [#712](https://github.com/opensearch-project/performance-analyzer/pull/712) 7 | 8 | ### Feature 9 | * Added cacheConfig Collector [#690](https://github.com/opensearch-project/performance-analyzer/pull/690) 10 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.18.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.18.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.18.0 4 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.19.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.19.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.19.0 4 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.2.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.2.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.2.0 4 | 5 | 6 | ### Maintenance 7 | 8 | * Update version to 2.2 ([#200](https://github.com/opensearch-project/performance-analyzer-rca/pull/200)) 9 | * Fixing ODFE BWC links and upgrade to 2.2 ([#243](https://github.com/opensearch-project/performance-analyzer/pull/243)) 10 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.3.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.3.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.3.0 4 | 5 | 6 | ### Maintenance 7 | 8 | * Upgrade netty version to 4.1.79 ([#249](https://github.com/opensearch-project/performance-analyzer/pull/249)) 9 | * Jackson version bump ([#247](https://github.com/opensearch-project/performance-analyzer/pull/247)) -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.4.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.4.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.4.0 4 | 5 | ### Bug fixes 6 | * Safeguard against appending origin twice ([#285](https://github.com/opensearch-project/performance-analyzer/pull/285)) 7 | 8 | ### Maintenance 9 | * Update netty and gson ([#274](https://github.com/opensearch-project/performance-analyzer/pull/274)) ([#280](https://github.com/opensearch-project/performance-analyzer/pull/280)) 10 | * Update jackson to 2.13.4 ([#293](https://github.com/opensearch-project/performance-analyzer/pull/293)) 11 | * Add group = org.opensearch.plugin ([#304](https://github.com/opensearch-project/performance-analyzer/pull/304)) ([#305](https://github.com/opensearch-project/performance-analyzer/pull/305)) 12 | * Address CVE-2022-42003 ([#312](https://github.com/opensearch-project/performance-analyzer/pull/312)) 13 | * Deprecate master nomenclature in 2.x ([#319](https://github.com/opensearch-project/performance-analyzer/pull/319)) 14 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.5.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.5.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.5.0 4 | 5 | ### Bug fixes 6 | * Add Connection read timeout to prevent indefinite wait ([#354](https://github.com/opensearch-project/performance-analyzer/pull/354)) 7 | 8 | ### Maintenance 9 | * Upgrade netty to 4.1.86 ([#352](https://github.com/opensearch-project/performance-analyzer/pull/352)) 10 | * Update jackson to 2.14.1 ([#369](https://github.com/opensearch-project/performance-analyzer/pull/369)) -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.7.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.7.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.7.0 4 | 5 | ## Enhancements 6 | * Adding CIRCUIT_BREAKER_COLLECTOR_EXECUTION_TIME, CIRCUIT_BREAKER_COLLECTOR_ERROR, CLUSTER_MANAGER_METRICS_ERROR in StatExceptionCode ([420](https://github.com/opensearch-project/performance-analyzer/pull/420/)) 7 | * Adding Shard HotSpot feature in RCA ([295](https://github.com/opensearch-project/performance-analyzer-rca/pull/295)) 8 | 9 | ### Bug fixes 10 | * Fix AdmissionControl class loading issue in Netty/PA communication ([#414](https://github.com/opensearch-project/performance-analyzer/pull/414)) 11 | * Fix GC metric not collected in RCA ([287](https://github.com/opensearch-project/performance-analyzer-rca/pull/287)) 12 | * Fix ShardEvents and ShardBulkDocs null metrics in RCA ([283](https://github.com/opensearch-project/performance-analyzer-rca/pull/283)) 13 | 14 | ### Infrastructure 15 | * Getting Jackson,JUnit, Log4j dependency version from core ([#417](https://github.com/opensearch-project/performance-analyzer/pull/417)) 16 | * Upgrade checkstyle to 9.3 ([#395](https://github.com/opensearch-project/performance-analyzer/pull/395)) 17 | * Publish snapshots to maven via GHA ([#385](https://github.com/opensearch-project/performance-analyzer/issues/385)) 18 | 19 | ### Maintenance 20 | * Modify namespace from xcontent common to core ([#410](https://github.com/opensearch-project/performance-analyzer/pull/410)) 21 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.8.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.8.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.8.0 4 | 5 | ## Enhancements 6 | * Add Latency and Error service metrics in PA plugin [#442](https://github.com/opensearch-project/performance-analyzer/pull/442) 7 | * Add Latency Metrics for respective Emitters in Reader Event Processing [#364](https://github.com/opensearch-project/performance-analyzer-rca/pull/364) 8 | * Adding Collector Metrics and refactoring the Error metrics [#365](https://github.com/opensearch-project/performance-analyzer-rca/pull/365) 9 | 10 | ### Bug fixes 11 | * Fix ShardStateCollector which was impacted by [core refactoring](https://github.com/opensearch-project/OpenSearch/pull/7301) [445](https://github.com/opensearch-project/performance-analyzer/pull/445) 12 | 13 | 14 | ### Infrastructure 15 | * Upgrade gradle to 7.6.1, upgrade gradle test-retry plugin to 1.5.2. ([#438](https://github.com/opensearch-project/performance-analyzer/pull/438)) 16 | * Introduce protobuf and guava dependency from core versions file [#437](https://github.com/opensearch-project/performance-analyzer/pull/437) 17 | * Update dependency org.xerial:sqlite-jdbc to v3.41.2.2 [#375](https://github.com/opensearch-project/performance-analyzer-rca/pull/375) 18 | 19 | 20 | ### Maintenance 21 | * Update RestController constructor for tests [#440](https://github.com/opensearch-project/performance-analyzer/pull/440) 22 | * Dependencies change in favor of Commons repo [#448](https://github.com/opensearch-project/performance-analyzer/pull/448) 23 | * WriterMetrics and config files dependency redirection [#450](https://github.com/opensearch-project/performance-analyzer/pull/450) 24 | * Refactor code related to Commons change, fixing unit tests [#451](https://github.com/opensearch-project/performance-analyzer/pull/451) 25 | * Remove remaining dependencies from PA-RCA due to commons repo [#453](https://github.com/opensearch-project/performance-analyzer/pull/453) 26 | * Fix BWC Integration tests [#413](https://github.com/opensearch-project/performance-analyzer/pull/413) 27 | * Fix SHA update for PA-Commons repo in build.gradle [#454](https://github.com/opensearch-project/performance-analyzer/pull/454) 28 | * Refactor Service/Stat Metrics [#376](https://github.com/opensearch-project/performance-analyzer-rca/pull/376) -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-2.9.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.9.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.9.0 4 | 5 | ### Enhancements 6 | * Remove heap allocation rate as the input metric to HotShardClusterRca [#411](https://github.com/opensearch-project/performance-analyzer-rca/pull/411) 7 | * Set ThreadMetricsRca evaluation period from 12 seconds to 5 seconds [#410](https://github.com/opensearch-project/performance-analyzer-rca/pull/410) 8 | * Add unit tests for the REST layer in RCA Agent [#436](https://github.com/opensearch-project/performance-analyzer-rca/pull/436) 9 | 10 | ### Bug fixes 11 | * Fix NPE issue in ShardStateCollector, which was impacted by changes from upstream core [#489](https://github.com/opensearch-project/performance-analyzer/pull/489) 12 | * Fix Mockito initialization issue [#443](https://github.com/opensearch-project/performance-analyzer-rca/pull/443) 13 | 14 | 15 | ### Infrastructure 16 | * Update the BWC version to 2.8.0 [#446](https://github.com/opensearch-project/performance-analyzer/pull/446) 17 | * Upgrade bcprov to bcprov-jdk15to18 in performance-analyzer [#493](https://github.com/opensearch-project/performance-analyzer/pull/493) 18 | * Upgrade bcprov to bcprov-jdk15to18 in performance-analyzer-rca [439](https://github.com/opensearch-project/performance-analyzer-rca/pull/439) 19 | * Upgrade bcpkix to bcpkix-jdk15to18 in performance-analyzer-rca [446](https://github.com/opensearch-project/performance-analyzer-rca/pull/446) 20 | * Upgrade checkstyle version from 9.3 to 10.3.3 [#495](https://github.com/opensearch-project/performance-analyzer/pull/495) 21 | 22 | 23 | ### Maintenance 24 | * Update build.gradle and github workflow to support 2.9 version [#499](https://github.com/opensearch-project/performance-analyzer/pull/499) 25 | * Update licenses files for 2.9 [#501](https://github.com/opensearch-project/performance-analyzer/pull/501) 26 | * Swap jboss annotation dependency for jakarta annotations [#407](https://github.com/opensearch-project/performance-analyzer-rca/pull/407) 27 | * Ensures compatibility check readiness [#438](https://github.com/opensearch-project/performance-analyzer-rca/pull/438) 28 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-3.0.0.0-alpha1.md: -------------------------------------------------------------------------------- 1 | ## Version 3.0.0.0-alpha1 Release Notes 2 | 3 | Compatible with OpenSearch 3.0.0-alpha1 4 | 5 | ### Maintenance 6 | 7 | * Bumps OS to 3.0.0-alpha1 and JDK 21 ([#791](https://github.com/opensearch-project/performance-analyzer/pull/791)) 8 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-3.0.0.0-beta1.md: -------------------------------------------------------------------------------- 1 | ## Version 3.0.0.0-beta1 Release Notes 2 | 3 | Compatible with OpenSearch 3.0.0-beta1 4 | 5 | ### Maintenance 6 | 7 | * Bumps plugin version to 3.0.0.0-beta1 in PA ([#794](https://github.com/opensearch-project/performance-analyzer/pull/794)) 8 | -------------------------------------------------------------------------------- /release-notes/opensearch-performance-analyzer.release-notes-3.0.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 3.0.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 3.0.0 4 | 5 | ### Maintenance 6 | 7 | * Bumps OS to 3.0.0-alpha1 and JDK 21 ([#791](https://github.com/opensearch-project/performance-analyzer/pull/791)) 8 | * Bumps plugin version to 3.0.0.0-beta1 in PA ([#794](https://github.com/opensearch-project/performance-analyzer/pull/794)) 9 | -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | # The OpenSearch Contributors require contributions made to 6 | # this file be licensed under the Apache-2.0 license or a 7 | # compatible open source license. 8 | 9 | set -ex 10 | 11 | function usage() { 12 | echo "Usage: $0 [args]" 13 | echo "" 14 | echo "Arguments:" 15 | echo -e "-v VERSION\t[Required] OpenSearch version." 16 | echo -e "-s SNAPSHOT\t[Optional] Build a snapshot, default is 'false'." 17 | echo -e "-q QUALIFIER\t[Optional] Build qualifier." 18 | echo -e "-p PLATFORM\t[Optional] Platform, ignored." 19 | echo -e "-a ARCHITECTURE\t[Optional] Build architecture, ignored." 20 | echo -e "-o OUTPUT\t[Optional] Output path, default is 'artifacts'." 21 | echo -e "-h help" 22 | } 23 | 24 | while getopts ":h:v:q:s:o:p:a:" arg; do 25 | case $arg in 26 | h) 27 | usage 28 | exit 1 29 | ;; 30 | v) 31 | VERSION=$OPTARG 32 | ;; 33 | q) 34 | QUALIFIER=$OPTARG 35 | ;; 36 | s) 37 | SNAPSHOT=$OPTARG 38 | ;; 39 | o) 40 | OUTPUT=$OPTARG 41 | ;; 42 | p) 43 | PLATFORM=$OPTARG 44 | ;; 45 | a) 46 | ARCHITECTURE=$OPTARG 47 | ;; 48 | :) 49 | echo "Error: -${OPTARG} requires an argument" 50 | usage 51 | exit 1 52 | ;; 53 | ?) 54 | echo "Invalid option: -${arg}" 55 | exit 1 56 | ;; 57 | esac 58 | done 59 | 60 | if [ -z "$VERSION" ]; then 61 | echo "Error: You must specify the OpenSearch version" 62 | usage 63 | exit 1 64 | fi 65 | 66 | [[ ! -z "$QUALIFIER" ]] && VERSION=$VERSION-$QUALIFIER 67 | [[ "$SNAPSHOT" == "true" ]] && VERSION=$VERSION-SNAPSHOT 68 | [ -z "$OUTPUT" ] && OUTPUT=artifacts 69 | 70 | ./gradlew build -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -Dbuild.version_qualifier=$QUALIFIER -x test 71 | mkdir -p $OUTPUT/plugins 72 | cp ./build/distributions/*.zip $OUTPUT/plugins 73 | 74 | ./gradlew publishPluginZipPublicationToZipStagingRepository -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -Dbuild.version_qualifier=$QUALIFIER 75 | mkdir -p $OUTPUT/maven/org/opensearch 76 | cp -r ./build/local-staging-repo/org/opensearch/. $OUTPUT/maven/org/opensearch 77 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/action/RequestType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.action; 7 | 8 | enum RequestType { 9 | bulk, 10 | search, 11 | other 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/collectors/ValueCalculator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.collectors; 7 | 8 | import org.opensearch.action.admin.indices.stats.ShardStats; 9 | 10 | @FunctionalInterface 11 | public interface ValueCalculator { 12 | long calculateValue(ShardStats shardStats); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/config/setting/ClusterSettingListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.config.setting; 7 | 8 | public interface ClusterSettingListener { 9 | /** 10 | * Handler that gets called when there is a new value for the setting that this listener is 11 | * listening to. 12 | * 13 | * @param newSettingValue The value of the new setting. 14 | */ 15 | void onSettingUpdate(T newSettingValue); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/config/setting/PerformanceAnalyzerClusterSettings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.config.setting; 7 | 8 | import org.opensearch.common.settings.Setting; 9 | 10 | public final class PerformanceAnalyzerClusterSettings { 11 | /** 12 | * Cluster setting that controls state for various PA components. Bit 0: Perf Analyzer 13 | * enabled/disabled Bit 1: RCA enabled/disabled Bit 2: Logging enabled/disabled Bit 3: Batch 14 | * Metrics enabled/disabled Bit 4: Thread Contention Monitoring enabled/disabled 15 | */ 16 | public static final Setting COMPOSITE_PA_SETTING = 17 | Setting.intSetting( 18 | "cluster.metadata.perf_analyzer.state", 19 | 0, 20 | Setting.Property.NodeScope, 21 | Setting.Property.Dynamic); 22 | 23 | public enum PerformanceAnalyzerFeatureBits { 24 | PA_BIT, 25 | RCA_BIT, 26 | LOGGING_BIT, 27 | BATCH_METRICS_BIT, 28 | THREAD_CONTENTION_MONITORING_BIT 29 | } 30 | 31 | /** 32 | * node stats collector enabled/disabled less than or equal to 0 : disabled greater than 0 : 33 | * enabled, and this set the number of shards per collection 34 | */ 35 | public static final Setting PA_NODE_STATS_SETTING = 36 | Setting.intSetting( 37 | "cluster.metadata.perf_analyzer.pa_node_stats_setting", 38 | 1, 39 | Setting.Property.NodeScope, 40 | Setting.Property.Dynamic); 41 | 42 | /** 43 | * Cluster setting controlling the collector mode : 0 - only RCA Collectors enabled (Default) 1 44 | * - only Telemetry Collectors enabled 2 - both RCA and Telemetry Collectors enabled 45 | */ 46 | public static final Setting PA_COLLECTORS_SETTING = 47 | Setting.intSetting( 48 | "cluster.metadata.perf_analyzer.collectors.mode", 49 | 0, 50 | Setting.Property.NodeScope, 51 | Setting.Property.Dynamic); 52 | 53 | /** 54 | * Cluster setting controlling the config overrides to be applied on performance analyzer 55 | * components. 56 | */ 57 | public static final Setting CONFIG_OVERRIDES_SETTING = 58 | Setting.simpleString( 59 | "cluster.metadata.perf_analyzer.config.overrides", 60 | "", 61 | Setting.Property.NodeScope, 62 | Setting.Property.Dynamic); 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/config/setting/handler/NodeStatsSettingHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.config.setting.handler; 7 | 8 | import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; 9 | import org.opensearch.performanceanalyzer.config.setting.ClusterSettingListener; 10 | import org.opensearch.performanceanalyzer.config.setting.ClusterSettingsManager; 11 | import org.opensearch.performanceanalyzer.config.setting.PerformanceAnalyzerClusterSettings; 12 | 13 | public class NodeStatsSettingHandler implements ClusterSettingListener { 14 | private final PerformanceAnalyzerController controller; 15 | private final ClusterSettingsManager clusterSettingsManager; 16 | 17 | private Integer currentClusterSetting = 18 | PerformanceAnalyzerController.DEFAULT_NUM_OF_SHARDS_PER_COLLECTION; 19 | 20 | public NodeStatsSettingHandler( 21 | final PerformanceAnalyzerController controller, 22 | final ClusterSettingsManager clusterSettingsManager) { 23 | this.controller = controller; 24 | this.clusterSettingsManager = clusterSettingsManager; 25 | } 26 | 27 | /** 28 | * Updates the PA Node Stats setting across the cluster. 29 | * 30 | * @param value The desired num of shards value for node stats. 31 | */ 32 | public void updateNodeStatsSetting(final int value) { 33 | clusterSettingsManager.updateSetting( 34 | PerformanceAnalyzerClusterSettings.PA_NODE_STATS_SETTING, value); 35 | } 36 | 37 | /** 38 | * Handler that gets called when there is a new value for the setting that this listener is 39 | * listening to. 40 | * 41 | * @param newSettingValue The value of the new setting. 42 | */ 43 | @Override 44 | public void onSettingUpdate(final Integer newSettingValue) { 45 | if (newSettingValue != null) { 46 | currentClusterSetting = newSettingValue; 47 | controller.updateNodeStatsShardsPerCollection(newSettingValue); 48 | } 49 | } 50 | 51 | /** 52 | * Gets the current(last seen) cluster setting value. 53 | * 54 | * @return integer value for setting. 55 | */ 56 | public int getNodeStatsSetting() { 57 | return currentClusterSetting; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/config/setting/handler/PerformanceAnalyzerCollectorsSettingHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.config.setting.handler; 7 | 8 | import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; 9 | import org.opensearch.performanceanalyzer.config.setting.ClusterSettingListener; 10 | import org.opensearch.performanceanalyzer.config.setting.ClusterSettingsManager; 11 | import org.opensearch.performanceanalyzer.config.setting.PerformanceAnalyzerClusterSettings; 12 | 13 | /* 14 | * This class is responsible for handling the collector setting value updates through API calls. 15 | * This also acts as a listener to the collector mode setting update 16 | */ 17 | public class PerformanceAnalyzerCollectorsSettingHandler 18 | implements ClusterSettingListener { 19 | private final PerformanceAnalyzerController controller; 20 | private final ClusterSettingsManager clusterSettingsManager; 21 | 22 | private Integer currentClusterSetting = 23 | PerformanceAnalyzerController.DEFAULT_COLLECTORS_SETTING_VALUE; 24 | 25 | public PerformanceAnalyzerCollectorsSettingHandler( 26 | PerformanceAnalyzerController controller, 27 | ClusterSettingsManager clusterSettingsManager) { 28 | this.controller = controller; 29 | this.clusterSettingsManager = clusterSettingsManager; 30 | } 31 | 32 | /** 33 | * Updates the Collectors mode setting across the cluster. 34 | * 35 | * @param value The desired collector mode amongst: 0 - only RCA Collectors enabled (Default) * 36 | * 1 - only Telemetry Collectors enabled * 2 - both RCA and Telemetry Collectors enabled 37 | */ 38 | public void updateCollectorsSetting(final int value) { 39 | clusterSettingsManager.updateSetting( 40 | PerformanceAnalyzerClusterSettings.PA_COLLECTORS_SETTING, value); 41 | } 42 | 43 | /** 44 | * Handler that gets called when there is a new value for the setting that this listener is 45 | * listening to. 46 | * 47 | * @param newSettingValue The value of the new setting. 48 | */ 49 | @Override 50 | public void onSettingUpdate(final Integer newSettingValue) { 51 | if (newSettingValue != null) { 52 | currentClusterSetting = newSettingValue; 53 | controller.updateCollectorsSetting(newSettingValue); 54 | } 55 | } 56 | 57 | /** 58 | * Gets the current(last seen) cluster setting value. 59 | * 60 | * @return integer value for setting. 61 | */ 62 | public int getCollectorsEnabledSetting() { 63 | return currentClusterSetting; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/http_action/config/RestConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.http_action.config; 7 | 8 | /** Shared constants and configuration used by the REST controllers defined by this plugin. */ 9 | public class RestConfig { 10 | public static final String PA_BASE_URI = "/_plugins/_performanceanalyzer"; 11 | public static final String LEGACY_PA_BASE_URI = "/_opendistro/_performanceanalyzer"; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/http_action/whoami/TransportWhoAmIAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.http_action.whoami; 7 | 8 | import org.opensearch.action.support.ActionFilters; 9 | import org.opensearch.action.support.HandledTransportAction; 10 | import org.opensearch.common.inject.Inject; 11 | import org.opensearch.core.action.ActionListener; 12 | import org.opensearch.indices.IndicesService; 13 | import org.opensearch.performanceanalyzer.OpenSearchResources; 14 | import org.opensearch.tasks.Task; 15 | import org.opensearch.transport.TransportService; 16 | 17 | public class TransportWhoAmIAction extends HandledTransportAction { 18 | 19 | @Inject 20 | public TransportWhoAmIAction( 21 | final TransportService transportService, 22 | final ActionFilters actionFilters, 23 | final IndicesService indicesService) { 24 | super(WhoAmIAction.NAME, transportService, actionFilters, WhoAmIRequest::new); 25 | OpenSearchResources.INSTANCE.setIndicesService(indicesService); 26 | } 27 | 28 | @Override 29 | protected void doExecute( 30 | Task task, WhoAmIRequest request, ActionListener listener) { 31 | listener.onResponse(new WhoAmIResponse()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/http_action/whoami/WhoAmIAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.http_action.whoami; 7 | 8 | import org.opensearch.action.ActionType; 9 | import org.opensearch.core.common.io.stream.Writeable; 10 | 11 | public class WhoAmIAction extends ActionType { 12 | 13 | public static final String NAME = "cluster:admin/performanceanalyzer/whoami"; 14 | public static final Writeable.Reader responseReader = null; 15 | public static final WhoAmIAction INSTANCE = new WhoAmIAction(); 16 | 17 | private WhoAmIAction() { 18 | super(NAME, responseReader); 19 | } 20 | 21 | @Override 22 | public Writeable.Reader getResponseReader() { 23 | return responseReader; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/http_action/whoami/WhoAmIRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.http_action.whoami; 7 | 8 | import org.opensearch.action.support.nodes.BaseNodesRequest; 9 | import org.opensearch.core.common.io.stream.StreamInput; 10 | 11 | public class WhoAmIRequest extends BaseNodesRequest { 12 | 13 | private static final String[] EMPTY_NODE_ID_ARRAY = {}; 14 | 15 | public WhoAmIRequest() { 16 | this(null); 17 | } 18 | 19 | public WhoAmIRequest(StreamInput input) { 20 | // Adding a ctor which matches the FunctionalInterface Writable.Reader<> so that ctor 21 | // reference succeeds. 22 | // The ctor itself calls the BaseNodesRequest<>(String... nodeIds) ctor with empty string 23 | // array(same functionality as 7.3.2's default ctor) since it was removed in 7.4.2. 24 | super(EMPTY_NODE_ID_ARRAY); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/http_action/whoami/WhoAmIRequestBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.http_action.whoami; 7 | 8 | import org.opensearch.action.ActionRequestBuilder; 9 | import org.opensearch.transport.client.ClusterAdminClient; 10 | import org.opensearch.transport.client.OpenSearchClient; 11 | 12 | public class WhoAmIRequestBuilder extends ActionRequestBuilder { 13 | public WhoAmIRequestBuilder(final ClusterAdminClient client) { 14 | this(client, WhoAmIAction.INSTANCE); 15 | } 16 | 17 | public WhoAmIRequestBuilder(final OpenSearchClient client, final WhoAmIAction action) { 18 | super(client, action, new WhoAmIRequest()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/http_action/whoami/WhoAmIResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.http_action.whoami; 7 | 8 | import java.io.IOException; 9 | import org.opensearch.core.action.ActionResponse; 10 | import org.opensearch.core.common.io.stream.StreamOutput; 11 | import org.opensearch.core.xcontent.ToXContent; 12 | import org.opensearch.core.xcontent.XContentBuilder; 13 | 14 | public class WhoAmIResponse extends ActionResponse implements ToXContent { 15 | @Override 16 | public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { 17 | builder.startObject().field("whoami", "whoami").endObject(); 18 | return builder; 19 | } 20 | 21 | @Override 22 | public void writeTo(StreamOutput out) throws IOException { 23 | // This is a no-op call just like how it was in 7.3.2(inherited from TransportMessage 24 | // .writeTo) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/listener/NoOpSearchListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.listener; 7 | 8 | class NoOpSearchListener implements SearchListener { 9 | @Override 10 | public String toString() { 11 | return "NoOpSearchListener"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/listener/SearchListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.listener; 7 | 8 | import org.opensearch.search.internal.SearchContext; 9 | 10 | interface SearchListener { 11 | default void preQueryPhase(SearchContext searchContext) {} 12 | 13 | default void queryPhase(SearchContext searchContext, long tookInNanos) {} 14 | 15 | default void failedQueryPhase(SearchContext searchContext) {} 16 | 17 | default void preFetchPhase(SearchContext searchContext) {} 18 | 19 | default void fetchPhase(SearchContext searchContext, long tookInNanos) {} 20 | 21 | default void failedFetchPhase(SearchContext searchContext) {} 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/transport/PerformanceAnalyzerTransportInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.transport; 7 | 8 | import org.apache.logging.log4j.LogManager; 9 | import org.apache.logging.log4j.Logger; 10 | import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; 11 | import org.opensearch.transport.TransportInterceptor; 12 | import org.opensearch.transport.TransportRequest; 13 | import org.opensearch.transport.TransportRequestHandler; 14 | 15 | public class PerformanceAnalyzerTransportInterceptor implements TransportInterceptor { 16 | 17 | private static final Logger LOG = 18 | LogManager.getLogger(PerformanceAnalyzerTransportInterceptor.class); 19 | private final PerformanceAnalyzerController controller; 20 | 21 | public PerformanceAnalyzerTransportInterceptor(final PerformanceAnalyzerController controller) { 22 | this.controller = controller; 23 | } 24 | 25 | @Override 26 | public TransportRequestHandler interceptHandler( 27 | String action, 28 | String executor, 29 | boolean forceExecution, 30 | TransportRequestHandler actualHandler) { 31 | return new PerformanceAnalyzerTransportRequestHandler<>(actualHandler, controller); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/performanceanalyzer/transport/RTFPerformanceAnalyzerTransportInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.transport; 7 | 8 | import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; 9 | import org.opensearch.transport.TransportInterceptor; 10 | import org.opensearch.transport.TransportRequest; 11 | import org.opensearch.transport.TransportRequestHandler; 12 | 13 | /** 14 | * Transport Interceptor to intercept the Indexing requests and populate the resource utilization 15 | * metrics. 16 | */ 17 | public final class RTFPerformanceAnalyzerTransportInterceptor implements TransportInterceptor { 18 | 19 | private final PerformanceAnalyzerController controller; 20 | 21 | public RTFPerformanceAnalyzerTransportInterceptor( 22 | final PerformanceAnalyzerController controller) { 23 | this.controller = controller; 24 | } 25 | 26 | @Override 27 | public TransportRequestHandler interceptHandler( 28 | String action, 29 | String executor, 30 | boolean forceExecution, 31 | TransportRequestHandler actualHandler) { 32 | return new RTFPerformanceAnalyzerTransportRequestHandler<>(actualHandler, controller); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/resources/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # OpenSearch plugin descriptor file 2 | # This file must exist as 'plugin-descriptor.properties' in a folder named `opensearch` 3 | # inside all plugins. 4 | # 5 | # 6 | # The file here is only for Brazil use 7 | # For gradle OpenSearch, it will be defined in the build.gradle 8 | # 9 | # 10 | ### example plugin for "foo" 11 | # 12 | # foo.zip <-- zip file for the plugin, with this structure: 13 | #|____opensearch/ 14 | #| |____ .jar <-- classes, resources, dependencies 15 | #| |____ .jar <-- any number of jars 16 | #| |____ plugin-descriptor.properties <-- example contents below: 17 | # 18 | # classname=foo.bar.BazPlugin 19 | # description=My cool plugin 20 | # version=3.0 21 | # opensearch.version=3.0 22 | # java.version=1.7 23 | # 24 | ### mandatory elements for all plugins: 25 | # 26 | # 'description': simple summary of the plugin 27 | description=Performance Analyzer Plugin 28 | # 29 | # 'version': plugin's version 30 | version=3.1.0.0 31 | # 32 | # 'name': the plugin name 33 | name=performance-analyzer 34 | # 35 | # 'classname': the name of the class to load, fully-qualified. 36 | classname=org.opensearch.performanceanalyzer.PerformanceAnalyzerPlugin 37 | # 38 | # 'java.version' version of java the code is built against 39 | # use the system property java.specification.version 40 | # version string must be a sequence of nonnegative decimal integers 41 | # separated by "."'s and may have leading zeros 42 | java.version=1.8 43 | # 44 | # 'opensearch.version' version of opensearch compiled against 45 | opensearch.version=3.1.0 46 | -------------------------------------------------------------------------------- /src/main/resources/plugin-security.policy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | grant { 7 | permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; 8 | permission java.lang.RuntimePermission "accessDeclaredMembers"; 9 | //- Java 8 jdk.attach fucntionality needs write permissions for /proc/pid/cwd, which varies, 10 | permission java.io.FilePermission "/-","read,readlink,write,delete,execute"; 11 | //permission java.io.FilePermission "/dev/shm/-","read,readlink,write,delete,execute"; 12 | //permission java.io.FilePermission "/proc/-","read,readlink,execute,write,delete"; 13 | //permission java.io.FilePermission "/sys/block/-","read,readlink,execute,write,delete"; 14 | permission java.io.FilePermission "build/tmp/junit_metrics", "read"; 15 | permission com.sun.tools.attach.AttachPermission "attachVirtualMachine"; 16 | permission com.sun.tools.attach.AttachPermission "createAttachProvider"; 17 | permission java.lang.RuntimePermission "manageProcess"; 18 | permission java.lang.RuntimePermission "loadLibrary.attach"; 19 | permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.misc"; 20 | permission java.lang.RuntimePermission "accessClassInPackage.sun.tools.attach"; 21 | permission java.lang.RuntimePermission "createClassLoader"; 22 | permission java.lang.RuntimePermission "getClassLoader"; 23 | permission java.lang.RuntimePermission "defineClass"; 24 | }; 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/AbstractTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer; 7 | 8 | import java.io.File; 9 | import org.apache.logging.log4j.Level; 10 | import org.apache.logging.log4j.core.Filter; 11 | import org.apache.logging.log4j.core.appender.ConsoleAppender; 12 | import org.apache.logging.log4j.core.config.Configurator; 13 | import org.apache.logging.log4j.core.config.builder.api.AppenderComponentBuilder; 14 | import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilder; 15 | import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory; 16 | import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration; 17 | import org.junit.Before; 18 | import org.junit.BeforeClass; 19 | import org.junit.Ignore; 20 | import org.junit.Rule; 21 | import org.junit.rules.TemporaryFolder; 22 | import org.opensearch.performanceanalyzer.util.Utils; 23 | 24 | @Ignore 25 | public class AbstractTests { 26 | 27 | // The TemporaryFolder Rule allows creation of files and folders that are 28 | // guaranteed to be deleted when the test method finishes (whether it passes 29 | // or fails) 30 | // But it is possible the deletion won't happen when you debug the code if 31 | // you quit early 32 | @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); 33 | 34 | protected String rootLocation; 35 | 36 | public AbstractTests() { 37 | super(); 38 | this.rootLocation = null; 39 | } 40 | 41 | @BeforeClass 42 | public static void setupLogging() { 43 | ConfigurationBuilder configurationBuilder = 44 | ConfigurationBuilderFactory.newConfigurationBuilder(); 45 | configurationBuilder.setStatusLevel(Level.INFO); 46 | configurationBuilder.setConfigurationName("DefaultConfig"); 47 | configurationBuilder.add( 48 | configurationBuilder 49 | .newFilter("ThresholdFilter", Filter.Result.ACCEPT, Filter.Result.NEUTRAL) 50 | .addAttribute("level", Level.DEBUG)); 51 | AppenderComponentBuilder appenderBuilder = 52 | configurationBuilder 53 | .newAppender("Stdout", "CONSOLE") 54 | .addAttribute("target", ConsoleAppender.Target.SYSTEM_OUT); 55 | appenderBuilder.add( 56 | configurationBuilder 57 | .newLayout("PatternLayout") 58 | .addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable")); 59 | appenderBuilder.add( 60 | configurationBuilder 61 | .newFilter("MarkerFilter", Filter.Result.DENY, Filter.Result.NEUTRAL) 62 | .addAttribute("marker", "FLOW")); 63 | configurationBuilder.add(appenderBuilder); 64 | configurationBuilder.add( 65 | configurationBuilder 66 | .newLogger("org.apache.logging.log4j", Level.DEBUG) 67 | .add(configurationBuilder.newAppenderRef("Stdout")) 68 | .addAttribute("additivity", false)); 69 | configurationBuilder.add( 70 | configurationBuilder 71 | .newRootLogger(Level.DEBUG) 72 | .add(configurationBuilder.newAppenderRef("Stdout"))); 73 | Configurator.initialize(configurationBuilder.build()); 74 | } 75 | 76 | @Before 77 | public void setUp() throws Exception { 78 | rootLocation = temporaryFolder.getRoot().getCanonicalPath() + File.separator; 79 | Utils.configureMetrics(); 80 | System.setProperty("performanceanalyzer.metrics.log.enabled", "False"); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/CustomMetricsLocationTestBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer; 7 | 8 | import java.io.File; 9 | import java.nio.file.Files; 10 | import java.nio.file.Path; 11 | import java.nio.file.Paths; 12 | import org.junit.Before; 13 | import org.opensearch.performanceanalyzer.commons.config.PluginSettings; 14 | 15 | public class CustomMetricsLocationTestBase { 16 | 17 | private static final Path METRICS_LOCATION = Paths.get("build/tmp/junit_metrics"); 18 | 19 | @Before 20 | public void setUp() throws Exception { 21 | if (!Files.exists(METRICS_LOCATION)) { 22 | Files.createDirectories(METRICS_LOCATION.getParent()); 23 | Files.createDirectory(METRICS_LOCATION); 24 | } 25 | 26 | PluginSettings.instance().setMetricsLocation(METRICS_LOCATION + File.separator); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/ITConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer; 7 | 8 | public class ITConfig { 9 | // Whether or not to use https clients for the integration tests 10 | private boolean https; 11 | // The username to use for basic https authentication (if https is specified) 12 | private String user; 13 | // The password of the user provided above 14 | private String password; 15 | // The OpenSearch REST endpoint to initialize clients against of the form $host:$port 16 | private String restEndpoint; 17 | // The OpenSearch transport endpoint to initialize clients against of the form $host:$port 18 | // see https://discuss.elastic.co/t/transport-client-vs-rest-client/13936 for a synopsis of the 19 | // difference between REST and transport endpoints 20 | private String transportEndpoint; 21 | 22 | // The port number to use for 23 | private int paPort = 9200; 24 | 25 | public ITConfig() { 26 | https = Boolean.parseBoolean(System.getProperty("tests.https")); 27 | user = System.getProperty("tests.user"); 28 | password = System.getProperty("tests.password"); 29 | restEndpoint = System.getProperty("tests.rest.cluster"); 30 | transportEndpoint = System.getProperty("tests.cluster"); 31 | String paPortTmp = System.getProperty("tests.paPort"); 32 | paPort = paPortTmp == null ? paPort : Integer.parseInt(paPortTmp); 33 | } 34 | 35 | public boolean isHttps() { 36 | return https; 37 | } 38 | 39 | public void setHttps(boolean https) { 40 | this.https = https; 41 | } 42 | 43 | public String getUser() { 44 | return user; 45 | } 46 | 47 | public void setUser(String user) { 48 | this.user = user; 49 | } 50 | 51 | public String getPassword() { 52 | return password; 53 | } 54 | 55 | public void setPassword(String password) { 56 | this.password = password; 57 | } 58 | 59 | public String getRestEndpoint() { 60 | return restEndpoint; 61 | } 62 | 63 | public void setRestEndpoint(String restEndpoint) { 64 | this.restEndpoint = restEndpoint; 65 | } 66 | 67 | public String getTransportEndpoint() { 68 | return transportEndpoint; 69 | } 70 | 71 | public void setTransportEndpoint(String transportEndpoint) { 72 | this.transportEndpoint = transportEndpoint; 73 | } 74 | 75 | public int getPaPort() { 76 | return paPort; 77 | } 78 | 79 | public void setPaPort(int paPort) { 80 | this.paPort = paPort; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/action/PerformanceAnalyzerActionFilterTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.action; 7 | 8 | import static org.junit.Assert.assertEquals; 9 | import static org.mockito.ArgumentMatchers.any; 10 | import static org.mockito.ArgumentMatchers.eq; 11 | import static org.mockito.Mockito.verify; 12 | import static org.mockito.MockitoAnnotations.initMocks; 13 | 14 | import org.junit.Before; 15 | import org.junit.Test; 16 | import org.mockito.Mock; 17 | import org.mockito.Mockito; 18 | import org.opensearch.action.ActionRequest; 19 | import org.opensearch.action.bulk.BulkRequest; 20 | import org.opensearch.action.search.SearchRequest; 21 | import org.opensearch.action.support.ActionFilterChain; 22 | import org.opensearch.core.action.ActionListener; 23 | import org.opensearch.core.action.ActionResponse; 24 | import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; 25 | import org.opensearch.tasks.Task; 26 | 27 | public class PerformanceAnalyzerActionFilterTests { 28 | private static final String[] testIndices = new String[] {"testIndex"}; 29 | private PerformanceAnalyzerActionFilter filter; 30 | 31 | @Mock private PerformanceAnalyzerController controller; 32 | @Mock private SearchRequest searchRequest; 33 | @Mock private BulkRequest bulkRequest; 34 | @Mock private ActionRequest request; 35 | @Mock private ActionListener listener; 36 | @Mock private ActionFilterChain chain; 37 | @Mock private Task task; 38 | 39 | @Before 40 | public void init() { 41 | initMocks(this); 42 | 43 | Mockito.when(controller.isPerformanceAnalyzerEnabled()).thenReturn(true); 44 | filter = new PerformanceAnalyzerActionFilter((controller)); 45 | } 46 | 47 | @Test 48 | public void testApplyWithSearchRequest() { 49 | Mockito.when(searchRequest.indices()).thenReturn(testIndices); 50 | testApply(searchRequest); 51 | } 52 | 53 | @Test 54 | public void testApplyWithBulkRequest() { 55 | testApply(bulkRequest); 56 | } 57 | 58 | @Test 59 | public void testApplyWithOtherRequest() { 60 | testApply(request); 61 | } 62 | 63 | private void testApply(ActionRequest request) { 64 | filter.apply(task, "_action", request, listener, chain); 65 | verify(chain).proceed(eq(task), eq("_action"), eq(request), any()); 66 | } 67 | 68 | @Test 69 | public void testOrder() { 70 | assertEquals(Integer.MIN_VALUE, filter.order()); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/collectors/AdmissionControlMetricsCollectorTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.collectors; 7 | 8 | import static org.junit.Assert.assertEquals; 9 | 10 | import java.util.List; 11 | import org.junit.Before; 12 | import org.junit.Test; 13 | import org.opensearch.performanceanalyzer.CustomMetricsLocationTestBase; 14 | import org.opensearch.performanceanalyzer.commons.event_process.Event; 15 | import org.opensearch.performanceanalyzer.commons.metrics.MetricsConfiguration; 16 | import org.opensearch.performanceanalyzer.util.TestUtil; 17 | 18 | public class AdmissionControlMetricsCollectorTests extends CustomMetricsLocationTestBase { 19 | 20 | @Override 21 | @Before 22 | public void setUp() throws Exception { 23 | super.setUp(); 24 | // clean metricQueue before running every test 25 | TestUtil.readEvents(); 26 | System.setProperty("performanceanalyzer.metrics.log.enabled", "False"); 27 | } 28 | 29 | @Test 30 | public void admissionControlMetricsCollector() { 31 | MetricsConfiguration.CONFIG_MAP.put( 32 | AdmissionControlMetricsCollector.class, MetricsConfiguration.cdefault); 33 | AdmissionControlMetricsCollector admissionControlMetricsCollector = 34 | new AdmissionControlMetricsCollector(); 35 | 36 | long startTimeInMills = System.currentTimeMillis(); 37 | admissionControlMetricsCollector.saveMetricValues("testMetric", startTimeInMills); 38 | 39 | List metrics = TestUtil.readEvents(); 40 | assertEquals(1, metrics.size()); 41 | assertEquals("testMetric", metrics.get(0).value); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/collectors/CollectorTestBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.collectors; 7 | 8 | import static org.mockito.ArgumentMatchers.any; 9 | import static org.mockito.ArgumentMatchers.anyString; 10 | import static org.mockito.Mockito.mock; 11 | import static org.mockito.MockitoAnnotations.initMocks; 12 | 13 | import org.junit.Before; 14 | import org.mockito.Mockito; 15 | import org.opensearch.performanceanalyzer.commons.config.overrides.ConfigOverridesWrapper; 16 | import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; 17 | 18 | public class CollectorTestBase { 19 | protected PerformanceAnalyzerController mockController; 20 | protected ConfigOverridesWrapper mockWrapper; 21 | 22 | @Before 23 | public void setUp() throws Exception { 24 | initMocks(this); 25 | System.setProperty("performanceanalyzer.metrics.log.enabled", "false"); 26 | mockController = mock(PerformanceAnalyzerController.class); 27 | mockWrapper = mock(ConfigOverridesWrapper.class); 28 | Mockito.when(mockController.isCollectorDisabled(any(), anyString())).thenReturn(false); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/collectors/FaultDetectionMetricsCollectorTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.collectors; 7 | 8 | import static org.junit.Assert.assertEquals; 9 | import static org.junit.Assert.assertTrue; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import org.junit.Test; 14 | import org.mockito.Mockito; 15 | import org.opensearch.performanceanalyzer.CustomMetricsLocationTestBase; 16 | import org.opensearch.performanceanalyzer.commons.config.overrides.ConfigOverridesWrapper; 17 | import org.opensearch.performanceanalyzer.commons.event_process.Event; 18 | import org.opensearch.performanceanalyzer.commons.metrics.MetricsConfiguration; 19 | import org.opensearch.performanceanalyzer.commons.metrics.PerformanceAnalyzerMetrics; 20 | import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; 21 | 22 | public class FaultDetectionMetricsCollectorTests extends CustomMetricsLocationTestBase { 23 | 24 | @Test 25 | public void testFaultDetectionMetrics() { 26 | MetricsConfiguration.CONFIG_MAP.put( 27 | FaultDetectionMetricsCollector.class, MetricsConfiguration.cdefault); 28 | System.setProperty("performanceanalyzer.metrics.log.enabled", "False"); 29 | long startTimeInMills = 1153721339; 30 | PerformanceAnalyzerController controller = 31 | Mockito.mock(PerformanceAnalyzerController.class); 32 | ConfigOverridesWrapper configOverrides = Mockito.mock(ConfigOverridesWrapper.class); 33 | FaultDetectionMetricsCollector faultDetectionMetricsCollector = 34 | new FaultDetectionMetricsCollector(controller, configOverrides); 35 | Mockito.when( 36 | controller.isCollectorEnabled( 37 | configOverrides, "FaultDetectionMetricsCollector")) 38 | .thenReturn(true); 39 | faultDetectionMetricsCollector.saveMetricValues( 40 | "fault_detection", startTimeInMills, "follower_check", "65432", "start"); 41 | List metrics = new ArrayList<>(); 42 | PerformanceAnalyzerMetrics.metricQueue.drainTo(metrics); 43 | 44 | assertEquals(1, metrics.size()); 45 | assertEquals("fault_detection", metrics.get(0).value); 46 | 47 | try { 48 | faultDetectionMetricsCollector.saveMetricValues( 49 | "fault_detection_metrics", startTimeInMills); 50 | assertTrue("Negative scenario test: Should have been a RuntimeException", true); 51 | } catch (RuntimeException ex) { 52 | // - expecting exception...0 values passed; 3 expected 53 | } 54 | 55 | try { 56 | faultDetectionMetricsCollector.saveMetricValues( 57 | "fault_detection_metrics", startTimeInMills, "leader_check"); 58 | assertTrue("Negative scenario test: Should have been a RuntimeException", true); 59 | } catch (RuntimeException ex) { 60 | // - expecting exception...1 values passed; 3 expected 61 | } 62 | 63 | try { 64 | faultDetectionMetricsCollector.saveMetricValues( 65 | "fault_detection_metrics", startTimeInMills, "leader_check", "823765423"); 66 | assertTrue("Negative scenario test: Should have been a RuntimeException", true); 67 | } catch (RuntimeException ex) { 68 | // - expecting exception...2 values passed; 0 expected 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/collectors/ShardIndexingPressureMetricsCollectorTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.collectors; 7 | 8 | import static org.junit.Assert.assertEquals; 9 | import static org.junit.Assert.assertTrue; 10 | import static org.mockito.MockitoAnnotations.initMocks; 11 | 12 | import java.util.List; 13 | import org.junit.Before; 14 | import org.junit.Test; 15 | import org.mockito.Mock; 16 | import org.mockito.Mockito; 17 | import org.opensearch.cluster.service.ClusterService; 18 | import org.opensearch.performanceanalyzer.CustomMetricsLocationTestBase; 19 | import org.opensearch.performanceanalyzer.OpenSearchResources; 20 | import org.opensearch.performanceanalyzer.commons.config.overrides.ConfigOverridesWrapper; 21 | import org.opensearch.performanceanalyzer.commons.event_process.Event; 22 | import org.opensearch.performanceanalyzer.commons.metrics.MetricsConfiguration; 23 | import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; 24 | import org.opensearch.performanceanalyzer.util.TestUtil; 25 | import org.powermock.core.classloader.annotations.PrepareForTest; 26 | 27 | @PrepareForTest(Class.class) 28 | public class ShardIndexingPressureMetricsCollectorTests extends CustomMetricsLocationTestBase { 29 | 30 | private ShardIndexingPressureMetricsCollector shardIndexingPressureMetricsCollector; 31 | 32 | @Mock private ClusterService mockClusterService; 33 | 34 | @Mock PerformanceAnalyzerController mockController; 35 | 36 | @Mock ConfigOverridesWrapper mockConfigOverrides; 37 | 38 | @Before 39 | public void init() { 40 | initMocks(this); 41 | OpenSearchResources.INSTANCE.setClusterService(mockClusterService); 42 | System.setProperty("performanceanalyzer.metrics.log.enabled", "False"); 43 | MetricsConfiguration.CONFIG_MAP.put( 44 | ShardIndexingPressureMetricsCollector.class, MetricsConfiguration.cdefault); 45 | shardIndexingPressureMetricsCollector = 46 | new ShardIndexingPressureMetricsCollector(mockController, mockConfigOverrides); 47 | 48 | // clean metricQueue before running every test 49 | TestUtil.readEvents(); 50 | } 51 | 52 | @Test 53 | public void testShardIndexingPressureMetrics() { 54 | long startTimeInMills = 1153721339; 55 | 56 | Mockito.when( 57 | mockController.isCollectorDisabled( 58 | mockConfigOverrides, "ShardIndexingPressureMetricsCollector")) 59 | .thenReturn(false); 60 | 61 | shardIndexingPressureMetricsCollector.saveMetricValues( 62 | "shard_indexing_pressure_metrics", startTimeInMills); 63 | 64 | List metrics = TestUtil.readEvents(); 65 | assertEquals(1, metrics.size()); 66 | assertEquals("shard_indexing_pressure_metrics", metrics.get(0).value); 67 | 68 | try { 69 | shardIndexingPressureMetricsCollector.saveMetricValues( 70 | "shard_indexing_pressure_metrics", startTimeInMills, "123"); 71 | assertTrue("Negative scenario test: Should have been a RuntimeException", true); 72 | } catch (RuntimeException ex) { 73 | // - expecting exception...1 values passed; 0 expected 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/collectors/telemetry/RTFDisksCollectorTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.collectors.telemetry; 7 | 8 | import static org.mockito.ArgumentMatchers.*; 9 | import static org.mockito.Mockito.*; 10 | 11 | import java.io.IOException; 12 | import org.junit.Before; 13 | import org.junit.Test; 14 | import org.opensearch.performanceanalyzer.OpenSearchResources; 15 | import org.opensearch.performanceanalyzer.collectors.CollectorTestBase; 16 | import org.opensearch.performanceanalyzer.commons.metrics.MetricsConfiguration; 17 | import org.opensearch.telemetry.metrics.Histogram; 18 | import org.opensearch.telemetry.metrics.MetricsRegistry; 19 | 20 | public class RTFDisksCollectorTests extends CollectorTestBase { 21 | private RTFDisksCollector rtfDisksCollector; 22 | private static MetricsRegistry metricsRegistry; 23 | private static Histogram testHistogram; 24 | 25 | @Before 26 | public void init() { 27 | MetricsConfiguration.CONFIG_MAP.put(RTFDisksCollector.class, MetricsConfiguration.cdefault); 28 | System.setProperty("os.name", "Linux"); 29 | metricsRegistry = mock(MetricsRegistry.class); 30 | testHistogram = mock(Histogram.class); 31 | OpenSearchResources.INSTANCE.setMetricsRegistry(metricsRegistry); 32 | when(metricsRegistry.createHistogram(anyString(), anyString(), anyString())) 33 | .thenReturn(testHistogram); 34 | rtfDisksCollector = spy(new RTFDisksCollector(mockController, mockWrapper)); 35 | } 36 | 37 | @Test 38 | public void testCollectMetrics() throws IOException { 39 | rtfDisksCollector.collectMetrics(System.currentTimeMillis()); 40 | verify(rtfDisksCollector, atLeastOnce()).recordMetrics(any()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/config/ConfigOverridesTestHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.config; 7 | 8 | import com.fasterxml.jackson.core.JsonProcessingException; 9 | import com.fasterxml.jackson.databind.ObjectMapper; 10 | import java.util.Arrays; 11 | import java.util.List; 12 | import org.opensearch.performanceanalyzer.commons.config.overrides.ConfigOverrides; 13 | 14 | public class ConfigOverridesTestHelper { 15 | private static final ObjectMapper MAPPER = new ObjectMapper(); 16 | public static final String RCA1 = "rca1"; 17 | public static final String RCA2 = "rca2"; 18 | public static final String RCA3 = "rca3"; 19 | public static final String RCA4 = "rca4"; 20 | public static final String ACTION1 = "act1"; 21 | public static final String ACTION2 = "act2"; 22 | public static final String ACTION3 = "act3"; 23 | public static final String ACTION4 = "act4"; 24 | public static final String DECIDER1 = "dec1"; 25 | public static final String DECIDER2 = "dec2"; 26 | public static final String DECIDER3 = "dec3"; 27 | public static final String DECIDER4 = "dec4"; 28 | public static final String COLLECTOR1 = "collector1"; 29 | public static final String COLLECTOR2 = "collector2"; 30 | public static final String COLLECTOR3 = "collector3"; 31 | public static final String COLLECTOR4 = "collector4"; 32 | public static final List DISABLED_RCAS_LIST = Arrays.asList(RCA1, RCA2); 33 | public static final List ENABLED_RCAS_LIST = Arrays.asList(RCA3, RCA4); 34 | public static final List DISABLED_ACTIONS_LIST = Arrays.asList(ACTION1, ACTION2); 35 | public static final List ENABLED_DECIDERS_LIST = Arrays.asList(DECIDER3, DECIDER4); 36 | public static final List DISABLED_COLLECTORS_LIST = 37 | Arrays.asList(COLLECTOR1, COLLECTOR2); 38 | public static final List ENABLED_COLLECTORS_LIST = 39 | Arrays.asList(COLLECTOR3, COLLECTOR4); 40 | 41 | public static ConfigOverrides buildValidConfigOverrides() { 42 | ConfigOverrides overrides = new ConfigOverrides(); 43 | overrides.getDisable().setRcas(DISABLED_RCAS_LIST); 44 | overrides.getDisable().setActions(DISABLED_ACTIONS_LIST); 45 | overrides.getEnable().setRcas(ENABLED_RCAS_LIST); 46 | overrides.getEnable().setDeciders(ENABLED_DECIDERS_LIST); 47 | overrides.getEnable().setCollectors(ENABLED_COLLECTORS_LIST); 48 | overrides.getDisable().setCollectors(DISABLED_COLLECTORS_LIST); 49 | 50 | return overrides; 51 | } 52 | 53 | public static String getValidConfigOverridesJson() throws JsonProcessingException { 54 | return MAPPER.writeValueAsString(buildValidConfigOverrides()); 55 | } 56 | 57 | public static String getInvalidConfigOverridesJson() throws JsonProcessingException { 58 | ConfigOverrides overrides = buildValidConfigOverrides(); 59 | overrides.getDisable().setRcas(ENABLED_RCAS_LIST); 60 | return MAPPER.writeValueAsString(overrides); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/config/setting/handler/NodeStatsSettingHandlerTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.config.setting.handler; 7 | 8 | import static org.mockito.ArgumentMatchers.anyInt; 9 | import static org.mockito.Mockito.never; 10 | import static org.mockito.Mockito.verify; 11 | import static org.mockito.MockitoAnnotations.initMocks; 12 | 13 | import org.junit.Before; 14 | import org.junit.Test; 15 | import org.mockito.Mock; 16 | import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; 17 | import org.opensearch.performanceanalyzer.config.setting.ClusterSettingsManager; 18 | 19 | public class NodeStatsSettingHandlerTests { 20 | private NodeStatsSettingHandler handler; 21 | 22 | @Mock private PerformanceAnalyzerController controller; 23 | @Mock private ClusterSettingsManager clusterSettingsManager; 24 | 25 | @Before 26 | public void init() { 27 | initMocks(this); 28 | handler = new NodeStatsSettingHandler(controller, clusterSettingsManager); 29 | } 30 | 31 | @Test 32 | public void testOnSettingUpdate() { 33 | Integer newSettingValue = null; 34 | handler.onSettingUpdate(newSettingValue); 35 | verify(controller, never()).updateNodeStatsShardsPerCollection(anyInt()); 36 | 37 | newSettingValue = 1; 38 | handler.onSettingUpdate(newSettingValue); 39 | verify(controller).updateNodeStatsShardsPerCollection(newSettingValue); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/config/setting/handler/PerformanceAnalyzerCollectorsSettingHandlerTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.config.setting.handler; 7 | 8 | import static org.mockito.ArgumentMatchers.anyInt; 9 | import static org.mockito.Mockito.never; 10 | import static org.mockito.Mockito.verify; 11 | import static org.mockito.MockitoAnnotations.initMocks; 12 | 13 | import org.junit.Before; 14 | import org.junit.Test; 15 | import org.mockito.Mock; 16 | import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; 17 | import org.opensearch.performanceanalyzer.config.setting.ClusterSettingsManager; 18 | 19 | public class PerformanceAnalyzerCollectorsSettingHandlerTests { 20 | private PerformanceAnalyzerCollectorsSettingHandler handler; 21 | @Mock private PerformanceAnalyzerController controller; 22 | @Mock private ClusterSettingsManager clusterSettingsManager; 23 | 24 | @Before 25 | public void init() { 26 | initMocks(this); 27 | handler = 28 | new PerformanceAnalyzerCollectorsSettingHandler(controller, clusterSettingsManager); 29 | } 30 | 31 | @Test 32 | public void testOnSettingUpdate() { 33 | Integer newSettingValue = null; 34 | handler.onSettingUpdate(newSettingValue); 35 | verify(controller, never()).updateCollectorsSetting(anyInt()); 36 | 37 | newSettingValue = 1; 38 | handler.onSettingUpdate(newSettingValue); 39 | verify(controller).updateCollectorsSetting(newSettingValue); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/http_action/whoami/WhoAmITests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.http_action.whoami; 7 | 8 | import static org.junit.Assert.assertEquals; 9 | import static org.mockito.ArgumentMatchers.any; 10 | import static org.mockito.Mockito.verify; 11 | import static org.mockito.MockitoAnnotations.initMocks; 12 | 13 | import java.io.IOException; 14 | import org.junit.Assert; 15 | import org.junit.Before; 16 | import org.junit.Test; 17 | import org.mockito.Mock; 18 | import org.opensearch.action.support.ActionFilters; 19 | import org.opensearch.common.xcontent.XContentType; 20 | import org.opensearch.core.action.ActionListener; 21 | import org.opensearch.core.common.io.stream.Writeable.Reader; 22 | import org.opensearch.core.xcontent.XContentBuilder; 23 | import org.opensearch.indices.IndicesService; 24 | import org.opensearch.performanceanalyzer.OpenSearchResources; 25 | import org.opensearch.tasks.Task; 26 | import org.opensearch.transport.TransportService; 27 | 28 | @SuppressWarnings("unchecked") 29 | public class WhoAmITests { 30 | private TransportWhoAmIAction transportWhoAmIAction; 31 | private WhoAmIAction whoAmIAction; 32 | private WhoAmIResponse response; 33 | 34 | @Mock private IndicesService indicesService; 35 | @Mock private ActionListener listener; 36 | @Mock private TransportService transportService; 37 | @Mock private ActionFilters actionFilters; 38 | @Mock private Task task; 39 | 40 | @Before 41 | public void init() { 42 | initMocks(this); 43 | 44 | transportWhoAmIAction = 45 | new TransportWhoAmIAction(transportService, actionFilters, indicesService); 46 | whoAmIAction = WhoAmIAction.INSTANCE; 47 | response = new WhoAmIResponse(); 48 | } 49 | 50 | @Test 51 | public void testDoExecute() { 52 | WhoAmIRequestBuilder builder = new WhoAmIRequestBuilder(null); 53 | transportWhoAmIAction.doExecute(task, new WhoAmIRequest(), listener); 54 | verify(listener).onResponse(any()); 55 | Assert.assertEquals(indicesService, OpenSearchResources.INSTANCE.getIndicesService()); 56 | } 57 | 58 | @Test 59 | public void testWhoAmIActionReader() { 60 | Reader reader = whoAmIAction.getResponseReader(); 61 | assertEquals(WhoAmIAction.responseReader, reader); 62 | } 63 | 64 | @Test 65 | public void testWhoAmIActionResponse() throws IOException { 66 | XContentBuilder contentBuilder = XContentBuilder.builder(XContentType.JSON.xContent()); 67 | XContentBuilder builder = response.toXContent(contentBuilder, null); 68 | response.writeTo(null); 69 | assertEquals(contentBuilder, builder); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/integ_test/CpuMetricsIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.integ_test; 7 | 8 | import java.util.List; 9 | import org.apache.logging.log4j.LogManager; 10 | import org.apache.logging.log4j.Logger; 11 | import org.junit.Assert; 12 | import org.junit.Before; 13 | import org.junit.Test; 14 | import org.opensearch.performanceanalyzer.commons.metrics.AllMetrics.OSMetrics; 15 | import org.opensearch.performanceanalyzer.http_action.config.RestConfig; 16 | import org.opensearch.performanceanalyzer.integ_test.json.JsonResponseData; 17 | import org.opensearch.performanceanalyzer.integ_test.json.JsonResponseField; 18 | import org.opensearch.performanceanalyzer.integ_test.json.JsonResponseNode; 19 | 20 | public class CpuMetricsIT extends MetricCollectorIntegTestBase { 21 | private static final Logger LOG = LogManager.getLogger(CpuMetricsIT.class); 22 | 23 | @Before 24 | public void init() throws Exception { 25 | initNodes(); 26 | } 27 | 28 | @Test 29 | public void checkCPUUtilization() throws Exception { 30 | checkCPUUtilization(RestConfig.PA_BASE_URI); 31 | } 32 | 33 | @Test 34 | public void checkLegacyCPUUtilization() throws Exception { 35 | checkCPUUtilization(RestConfig.LEGACY_PA_BASE_URI); 36 | } 37 | 38 | public void checkCPUUtilization(String paBaseUri) throws Exception { 39 | // read metric from local node 40 | List responseNodeList = 41 | readMetric(paBaseUri + "/_agent/metrics?metrics=CPU_Utilization&agg=sum"); 42 | Assert.assertEquals(1, responseNodeList.size()); 43 | validatePerNodeCPUMetric(responseNodeList.get(0)); 44 | 45 | // read metric from all nodes in cluster 46 | responseNodeList = 47 | readMetric(paBaseUri + "/_agent/metrics?metrics=CPU_Utilization&agg=sum&nodes=all"); 48 | int nodeNum = getNodeIDs().size(); 49 | Assert.assertEquals(nodeNum, responseNodeList.size()); 50 | for (int i = 0; i < nodeNum; i++) { 51 | validatePerNodeCPUMetric(responseNodeList.get(i)); 52 | } 53 | } 54 | 55 | /** 56 | * check if cpu usage is non zero { "JtlEoRowSI6iNpzpjlbp_Q": { "data": { "fields": [ { "name": 57 | * "CPU_Utilization", "type": "DOUBLE" } ], "records": [ [ 0.005275218803760752 ] ] }, 58 | * "timestamp": 1606861740000 } } 59 | */ 60 | private void validatePerNodeCPUMetric(JsonResponseNode responseNode) throws Exception { 61 | Assert.assertTrue(responseNode.getTimestamp() > 0); 62 | JsonResponseData responseData = responseNode.getData(); 63 | LOG.info(responseData.toString()); 64 | Assert.assertEquals(1, responseData.getFieldDimensionSize()); 65 | Assert.assertEquals( 66 | OSMetrics.CPU_UTILIZATION.toString(), responseData.getField(0).getName()); 67 | Assert.assertEquals( 68 | JsonResponseField.Type.Constants.DOUBLE, responseData.getField(0).getType()); 69 | Assert.assertEquals(1, responseData.getRecordSize()); 70 | Assert.assertTrue( 71 | responseData.getRecordAsDouble(0, OSMetrics.CPU_UTILIZATION.toString()) > 0); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/integ_test/MetricCollectorIntegTestBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.integ_test; 7 | 8 | import com.google.gson.Gson; 9 | import com.google.gson.JsonObject; 10 | import com.google.gson.JsonParseException; 11 | import com.google.gson.JsonParser; 12 | import java.io.BufferedReader; 13 | import java.io.InputStreamReader; 14 | import java.nio.charset.StandardCharsets; 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | import org.apache.hc.core5.http.HttpStatus; 18 | import org.apache.hc.core5.http.io.entity.EntityUtils; 19 | import org.junit.Assert; 20 | import org.opensearch.client.Request; 21 | import org.opensearch.client.Response; 22 | import org.opensearch.performanceanalyzer.PerformanceAnalyzerIntegTestBase; 23 | import org.opensearch.performanceanalyzer.integ_test.json.JsonResponseNode; 24 | 25 | public class MetricCollectorIntegTestBase extends PerformanceAnalyzerIntegTestBase { 26 | 27 | private List nodeIDs; 28 | 29 | protected List readMetric(String endpoint) throws Exception { 30 | String jsonString; 31 | // read metric from local node 32 | Request request = new Request("GET", endpoint); 33 | Response resp = paClient.performRequest(request); 34 | Assert.assertEquals(HttpStatus.SC_OK, resp.getStatusLine().getStatusCode()); 35 | jsonString = EntityUtils.toString(resp.getEntity()); 36 | JsonObject jsonObject = new JsonParser().parse(jsonString).getAsJsonObject(); 37 | return parseJsonResponse(jsonObject); 38 | } 39 | 40 | protected void initNodes() throws Exception { 41 | final Request request = new Request("GET", "/_cat/nodes?full_id&h=id"); 42 | final Response response = adminClient().performRequest(request); 43 | nodeIDs = new ArrayList<>(); 44 | if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { 45 | try (BufferedReader responseReader = 46 | new BufferedReader( 47 | new InputStreamReader( 48 | response.getEntity().getContent(), StandardCharsets.UTF_8))) { 49 | String line; 50 | while ((line = responseReader.readLine()) != null) { 51 | nodeIDs.add(line); 52 | } 53 | } 54 | } 55 | } 56 | 57 | protected List getNodeIDs() { 58 | return nodeIDs; 59 | } 60 | 61 | private List parseJsonResponse(JsonObject jsonObject) 62 | throws JsonParseException { 63 | List responseNodeList = new ArrayList<>(); 64 | jsonObject 65 | .entrySet() 66 | .forEach( 67 | n -> { 68 | JsonResponseNode responseNode = 69 | new Gson().fromJson(n.getValue(), JsonResponseNode.class); 70 | responseNodeList.add(responseNode); 71 | }); 72 | return responseNodeList; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/integ_test/json/JsonResponseData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.integ_test.json; 7 | 8 | import com.google.gson.annotations.SerializedName; 9 | import java.util.Arrays; 10 | 11 | /** 12 | * spotless:off 13 | * 14 | * "data": { 15 | * "fields": [ 16 | * { 17 | * "name": "CPU_Utilization", 18 | * "type": "DOUBLE" 19 | * } 20 | * ], 21 | * "records": [ 22 | * [ 23 | * 0.005275218803760752 24 | * ] 25 | * ] 26 | * } 27 | * 28 | * spotless:on 29 | */ 30 | public class JsonResponseData { 31 | private static final String FIELDS = "fields"; 32 | private static final String RECORDS = "records"; 33 | 34 | @SerializedName(FIELDS) 35 | private JsonResponseField[] fields; 36 | 37 | @SerializedName(RECORDS) 38 | private String[][] records; 39 | 40 | public JsonResponseData(JsonResponseField[] fields, String[][] records) { 41 | this.fields = fields; 42 | this.records = records; 43 | } 44 | 45 | public int getFieldDimensionSize() { 46 | return fields.length; 47 | } 48 | 49 | public int getRecordSize() { 50 | return records.length; 51 | } 52 | 53 | public JsonResponseField getField(int index) throws IndexOutOfBoundsException { 54 | return fields[index]; 55 | } 56 | 57 | public String getRecord(int index, String fieldName) throws Exception { 58 | for (int i = 0; i < getFieldDimensionSize(); i++) { 59 | if (fieldName.equals(fields[i].getName())) { 60 | return records[index][i]; 61 | } 62 | } 63 | throw new IllegalArgumentException(); 64 | } 65 | 66 | public Double getRecordAsDouble(int index, String fieldName) throws Exception { 67 | String recordStr = getRecord(index, fieldName); 68 | JsonResponseField field = getField(index); 69 | if (!field.getType().equals(JsonResponseField.Type.Constants.DOUBLE)) { 70 | throw new IllegalArgumentException(); 71 | } 72 | return Double.parseDouble(recordStr); 73 | } 74 | 75 | @Override 76 | public String toString() { 77 | return "data:{" 78 | + "fields=" 79 | + Arrays.toString(fields) 80 | + ", records=" 81 | + Arrays.toString(records) 82 | + '}'; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/integ_test/json/JsonResponseField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.integ_test.json; 7 | 8 | import com.google.gson.annotations.SerializedName; 9 | 10 | /** "fields": [ { "name": "CPU_Utilization", "type": "DOUBLE" } ] */ 11 | public class JsonResponseField { 12 | private static final String NAME = "name"; 13 | private static final String TYPE = "type"; 14 | 15 | @SerializedName(NAME) 16 | private String name; 17 | 18 | @SerializedName(TYPE) 19 | private String type; 20 | 21 | public JsonResponseField(String name, String type) { 22 | this.name = name; 23 | this.type = type; 24 | } 25 | 26 | public String getName() { 27 | return this.name; 28 | } 29 | 30 | public String getType() { 31 | return this.type; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return "JsonResponseField{" + "name='" + name + '\'' + ", type='" + type + '\'' + '}'; 37 | } 38 | 39 | // SQLite data type 40 | public enum Type { 41 | VARCHAR(Constants.VARCHAR), 42 | DOUBLE(Constants.DOUBLE); 43 | 44 | private final String value; 45 | 46 | Type(String value) { 47 | this.value = value; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return value; 53 | } 54 | 55 | public static class Constants { 56 | public static final String VARCHAR = "VARCHAR"; 57 | public static final String DOUBLE = "DOUBLE"; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/integ_test/json/JsonResponseNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.integ_test.json; 7 | 8 | import com.google.gson.annotations.SerializedName; 9 | 10 | /** "node1": { "data": { ....... }, "timestamp": 1606861740000 } */ 11 | public class JsonResponseNode { 12 | private static final String DATA = "data"; 13 | private static final String TIMESTAMP = "timestamp"; 14 | 15 | @SerializedName(DATA) 16 | private JsonResponseData data; 17 | 18 | @SerializedName(TIMESTAMP) 19 | private long timestamp; 20 | 21 | public JsonResponseNode(JsonResponseData data, long timestamp) { 22 | this.data = data; 23 | this.timestamp = timestamp; 24 | } 25 | 26 | public JsonResponseData getData() { 27 | return data; 28 | } 29 | 30 | public long getTimestamp() { 31 | return timestamp; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/transport/PerformanceAnalyzerTransportChannelTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.transport; 7 | 8 | import static org.junit.Assert.assertEquals; 9 | import static org.mockito.Mockito.verify; 10 | import static org.mockito.MockitoAnnotations.initMocks; 11 | 12 | import java.io.IOException; 13 | import org.apache.commons.lang3.SystemUtils; 14 | import org.junit.Before; 15 | import org.junit.Test; 16 | import org.mockito.Mock; 17 | import org.opensearch.core.transport.TransportResponse; 18 | import org.opensearch.performanceanalyzer.util.Utils; 19 | import org.opensearch.transport.TransportChannel; 20 | 21 | public class PerformanceAnalyzerTransportChannelTests { 22 | private PerformanceAnalyzerTransportChannel channel; 23 | 24 | @Mock private TransportChannel originalChannel; 25 | @Mock private TransportResponse response; 26 | 27 | @Before 28 | public void init() { 29 | // this test only runs in Linux system 30 | // as some of the static members of the ThreadList class are specific to Linux 31 | org.junit.Assume.assumeTrue(SystemUtils.IS_OS_LINUX); 32 | Utils.configureMetrics(); 33 | initMocks(this); 34 | channel = new PerformanceAnalyzerTransportChannel(); 35 | channel.set(originalChannel, 0, "testIndex", 1, 0, false); 36 | assertEquals("PerformanceAnalyzerTransportChannelProfile", channel.getProfileName()); 37 | assertEquals("PerformanceAnalyzerTransportChannelType", channel.getChannelType()); 38 | assertEquals(originalChannel, channel.getInnerChannel()); 39 | } 40 | 41 | @Test 42 | public void testResponse() throws IOException { 43 | channel.sendResponse(response); 44 | verify(originalChannel).sendResponse(response); 45 | 46 | Exception exception = new Exception("dummy exception"); 47 | channel.sendResponse(exception); 48 | verify(originalChannel).sendResponse(exception); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/transport/RTFPerformanceAnalyzerTransportChannelTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.transport; 7 | 8 | import static org.junit.Assert.assertEquals; 9 | import static org.mockito.ArgumentMatchers.any; 10 | import static org.mockito.ArgumentMatchers.anyDouble; 11 | import static org.mockito.Mockito.times; 12 | import static org.mockito.Mockito.verify; 13 | import static org.mockito.MockitoAnnotations.initMocks; 14 | 15 | import java.io.IOException; 16 | import org.apache.commons.lang3.SystemUtils; 17 | import org.junit.Before; 18 | import org.junit.Test; 19 | import org.mockito.Mock; 20 | import org.mockito.Mockito; 21 | import org.opensearch.core.index.Index; 22 | import org.opensearch.core.index.shard.ShardId; 23 | import org.opensearch.core.transport.TransportResponse; 24 | import org.opensearch.performanceanalyzer.util.Utils; 25 | import org.opensearch.telemetry.metrics.Histogram; 26 | import org.opensearch.telemetry.metrics.tags.Tags; 27 | import org.opensearch.transport.TransportChannel; 28 | 29 | public class RTFPerformanceAnalyzerTransportChannelTests { 30 | private RTFPerformanceAnalyzerTransportChannel channel; 31 | 32 | @Mock private TransportChannel originalChannel; 33 | @Mock private TransportResponse response; 34 | @Mock private Histogram cpuUtilizationHistogram; 35 | private ShardId shardId; 36 | @Mock private ShardId mockedShardId; 37 | @Mock private Index index; 38 | 39 | @Before 40 | public void init() { 41 | // this test only runs in Linux system 42 | // as some of the static members of the ThreadList class are specific to Linux 43 | org.junit.Assume.assumeTrue(SystemUtils.IS_OS_LINUX); 44 | Utils.configureMetrics(); 45 | initMocks(this); 46 | String indexName = "testIndex"; 47 | shardId = new ShardId(new Index(indexName, "uuid"), 1); 48 | channel = new RTFPerformanceAnalyzerTransportChannel(); 49 | channel.set(originalChannel, cpuUtilizationHistogram, indexName, shardId, false); 50 | assertEquals("RTFPerformanceAnalyzerTransportChannelProfile", channel.getProfileName()); 51 | assertEquals("RTFPerformanceAnalyzerTransportChannelType", channel.getChannelType()); 52 | assertEquals(originalChannel, channel.getInnerChannel()); 53 | } 54 | 55 | @Test 56 | public void testResponse() throws IOException { 57 | channel.sendResponse(response); 58 | verify(originalChannel).sendResponse(response); 59 | verify(cpuUtilizationHistogram, times(1)).record(anyDouble(), any(Tags.class)); 60 | } 61 | 62 | @Test 63 | public void testResponseWithException() throws IOException { 64 | Exception exception = new Exception("dummy exception"); 65 | channel.sendResponse(exception); 66 | verify(originalChannel).sendResponse(exception); 67 | verify(cpuUtilizationHistogram, times(1)).record(anyDouble(), any(Tags.class)); 68 | } 69 | 70 | @Test 71 | public void testRecordCPUUtilizationMetric() { 72 | RTFPerformanceAnalyzerTransportChannel channel = 73 | new RTFPerformanceAnalyzerTransportChannel(); 74 | channel.set(originalChannel, cpuUtilizationHistogram, "testIndex", mockedShardId, false); 75 | Mockito.when(mockedShardId.getIndex()).thenReturn(index); 76 | Mockito.when(index.getName()).thenReturn("myTestIndex"); 77 | Mockito.when(index.getUUID()).thenReturn("abc-def"); 78 | channel.recordCPUUtilizationMetric(mockedShardId, 10l, "bulkShard", false); 79 | Mockito.verify(cpuUtilizationHistogram) 80 | .record(Mockito.anyDouble(), Mockito.any(Tags.class)); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/util/CopyTestResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.util; 7 | 8 | import static java.nio.file.StandardCopyOption.COPY_ATTRIBUTES; 9 | import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; 10 | 11 | import java.io.File; 12 | import java.io.IOException; 13 | import java.nio.file.Files; 14 | import java.nio.file.Path; 15 | import java.nio.file.Paths; 16 | 17 | public class CopyTestResource implements AutoCloseable { 18 | private String path; 19 | 20 | public String getPath() { 21 | return path; 22 | } 23 | 24 | public CopyTestResource(String srcPath, String desPath) { 25 | if (srcPath.equals(desPath)) { 26 | throw new RuntimeException("srcPath and desPath cannot be same"); 27 | } 28 | 29 | System.out.println( 30 | "copying from " 31 | + Paths.get(srcPath).toAbsolutePath().toString() 32 | + " to " 33 | + Paths.get(desPath).toAbsolutePath().toString()); 34 | 35 | path = desPath; 36 | try { 37 | Files.walk(Paths.get(srcPath)) 38 | .forEach( 39 | (Path a) -> { 40 | Path b = 41 | Paths.get( 42 | desPath, a.toString().substring(srcPath.length())); 43 | try { 44 | Files.copy(a, b, REPLACE_EXISTING, COPY_ATTRIBUTES); 45 | } catch (IOException e) { 46 | e.printStackTrace(); 47 | } 48 | }); 49 | } catch (IOException e) { 50 | e.printStackTrace(); 51 | } 52 | } 53 | 54 | @Override 55 | public void close() throws Exception { 56 | try { 57 | delete(new File(path)); 58 | } catch (IOException e) { 59 | e.printStackTrace(); 60 | } 61 | } 62 | 63 | private void delete(File file) throws IOException { 64 | 65 | for (File childFile : file.listFiles()) { 66 | 67 | if (childFile.isDirectory()) { 68 | delete(childFile); 69 | } else { 70 | if (!childFile.delete()) { 71 | throw new IOException(); 72 | } 73 | } 74 | } 75 | 76 | if (!file.delete()) { 77 | throw new IOException(); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/util/TestUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.util; 7 | 8 | import java.util.ArrayList; 9 | import java.util.Arrays; 10 | import java.util.List; 11 | import org.opensearch.performanceanalyzer.commons.event_process.Event; 12 | import org.opensearch.performanceanalyzer.commons.metrics.PerformanceAnalyzerMetrics; 13 | 14 | public class TestUtil { 15 | public static List readEvents() { 16 | List metrics = new ArrayList<>(); 17 | PerformanceAnalyzerMetrics.metricQueue.drainTo(metrics); 18 | return metrics; 19 | } 20 | 21 | public static List readMetricsInJsonString(int length) { 22 | List metrics = readEvents(); 23 | assert metrics.size() == 1; 24 | String[] jsonStrs = metrics.get(0).value.split("\n"); 25 | assert jsonStrs.length == length; 26 | return Arrays.asList(jsonStrs).subList(1, jsonStrs.length); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/util/UtilsTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.util; 7 | 8 | import org.junit.Assert; 9 | import org.junit.Test; 10 | 11 | public class UtilsTests { 12 | 13 | @Test 14 | public void testCPUUtilization() { 15 | Assert.assertEquals(0.5, Utils.calculateCPUUtilization(2, 5, 5, 1.0), 0.0); 16 | Assert.assertEquals(1.0, Utils.calculateCPUUtilization(1, 5, 5, 1.0), 0.0); 17 | Assert.assertEquals( 18 | Double.valueOf(10 / 15.0), Utils.calculateCPUUtilization(3, 5, 10, 1.0), 0.0); 19 | Assert.assertEquals( 20 | Double.valueOf(0.50 * (20 / 30.0)), 21 | Utils.calculateCPUUtilization(3, 10, 20, 0.5d), 22 | 0.0); 23 | } 24 | 25 | @Test 26 | public void testCPUUtilizationZeroValue() { 27 | Assert.assertEquals(0.0, Utils.calculateCPUUtilization(2, 5, 0, 1.0), 0.0); 28 | Assert.assertEquals(0.0, Utils.calculateCPUUtilization(2, 0, 5, 1.0), 0.0); 29 | Assert.assertEquals(0.0, Utils.calculateCPUUtilization(0, 5, 5, 1.0), 0.0); 30 | Assert.assertEquals(0.0, Utils.calculateCPUUtilization(0, 5, 5, 0.0), 0.0); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/performanceanalyzer/util/WaitFor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.performanceanalyzer.util; 7 | 8 | import java.util.concurrent.Callable; 9 | import java.util.concurrent.TimeUnit; 10 | import java.util.concurrent.TimeoutException; 11 | 12 | /** 13 | * This class allows you to wait at most a specified duration until a condition evaluates to true 14 | */ 15 | public class WaitFor { 16 | /** 17 | * Waits at most the specified time for the given task to evaluate to true 18 | * 19 | * @param task The task which we hope evaluates to true before the time limit 20 | * @param maxWait The max amount of time to wait for the task to evaluate for true 21 | * @param unit The time unit of the maxWait parameter 22 | * @throws Exception If the time limit expires before the task evaluates to true 23 | */ 24 | public static void waitFor(Callable task, long maxWait, TimeUnit unit) 25 | throws Exception { 26 | long maxWaitMillis = TimeUnit.MILLISECONDS.convert(maxWait, unit); 27 | long pollTime = System.currentTimeMillis(); 28 | long curTime; 29 | while (!task.call() && maxWaitMillis >= 0) { 30 | curTime = System.currentTimeMillis(); 31 | maxWaitMillis -= (curTime - pollTime); 32 | pollTime = curTime; 33 | } 34 | if (maxWait < 0) { 35 | throw new TimeoutException("WaitFor timed out before task evaluated to true"); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /test_files/new_format/new_format.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/test_files/new_format/new_format.tar.gz -------------------------------------------------------------------------------- /test_files/new_format/performance-analyzer.properties: -------------------------------------------------------------------------------- 1 | # ======================== OpenSearch performance analyzer plugin config ========================= 2 | 3 | # NOTE: this is an example for Linux. Please modify the config accordingly if you are using it under other OS. 4 | 5 | # Metrics data location 6 | # For test only 7 | metrics-location = /tmp/new_format/ 8 | 9 | # Metrics deletion interval (minutes) for metrics data. 10 | # Interval should be between 1 to 60. 11 | metrics-deletion-interval = 1 12 | 13 | # If set to true, the system cleans up the files behind it. So at any point, we should expect only 2 14 | # metrics-db-file-prefix-path files. If set to false, no files are cleaned up. This can be useful, if you are archiving 15 | # the files and wouldn't like for them to be cleaned up. 16 | cleanup-metrics-db-files = true 17 | 18 | # WebService exposed by App's port 19 | webservice-listener-port = 9600 20 | 21 | # Metric DB File Prefix Path location 22 | metrics-db-file-prefix-path = /tmp/metricsdb_ 23 | 24 | https-enabled = false 25 | 26 | #Setup the correct path for certificates 27 | certificate-file-path = specify_path 28 | 29 | private-key-file-path = specify_path 30 | 31 | # WebService bind host; default to all interfaces 32 | #webservice-bind-host = 33 | 34 | # Plugin Stats Metadata file name, expected to be in the same location 35 | plugin-stats-metadata = plugin-stats-metadata 36 | 37 | # Agent Stats Metadata file name, expected to be in the same location 38 | agent-stats-metadata = agent-stats-metadata 39 | 40 | -------------------------------------------------------------------------------- /test_files/old_format/old_format.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/test_files/old_format/old_format.tar.gz -------------------------------------------------------------------------------- /test_files/old_format/performance-analyzer.properties: -------------------------------------------------------------------------------- 1 | # ======================== OpenSearch performance analyzer plugin config ========================= 2 | 3 | # NOTE: this is an example for Linux. Please modify the config accordingly if you are using it under other OS. 4 | 5 | # Metrics data location 6 | # for tests only 7 | metrics-location = /tmp/old_format/ 8 | 9 | # Metrics deletion interval (minutes) for metrics data. 10 | # Interval should be between 1 to 60. 11 | metrics-deletion-interval = 1 12 | 13 | # If set to true, the system cleans up the files behind it. So at any point, we should expect only 2 14 | # metrics-db-file-prefix-path files. If set to false, no files are cleaned up. This can be useful, if you are archiving 15 | # the files and wouldn't like for them to be cleaned up. 16 | cleanup-metrics-db-files = true 17 | 18 | # WebService exposed by App's port 19 | webservice-listener-port = 9600 20 | 21 | # Metric DB File Prefix Path location 22 | metrics-db-file-prefix-path = /tmp/metricsdb_ 23 | 24 | https-enabled = false 25 | 26 | #Setup the correct path for certificates 27 | certificate-file-path = specify_path 28 | 29 | private-key-file-path = specify_path 30 | 31 | # WebService bind host; default to all interfaces 32 | #webservice-bind-host = 33 | 34 | # Plugin Stats Metadata file name, expected to be in the same location 35 | plugin-stats-metadata = plugin-stats-metadata 36 | 37 | # Agent Stats Metadata file name, expected to be in the same location 38 | agent-stats-metadata = agent-stats-metadata 39 | 40 | -------------------------------------------------------------------------------- /test_files/shm.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/performance-analyzer/c49d550e31f11627030ebd245150110c9ac578b6/test_files/shm.tar.gz --------------------------------------------------------------------------------