-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add resource usage trackers and resource usage collector service #9890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
sachinpkale
merged 23 commits into
opensearch-project:main
from
bharath-techie:ac-pr-final-1
Oct 16, 2023
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
13c5c90
Add node performance trackers and performance collector service
bharath-techie f861207
addressing comments
bharath-techie 5fb7d51
Addressing comments
bharath-techie f867acf
Merge branch 'main' of github.com:opensearch-project/OpenSearch into …
bharath-techie cdc11f0
Merge branch 'main' of github.com:opensearch-project/OpenSearch into …
bharath-techie 03b58cb
renaming stats class and injecting settings to trackers
bharath-techie 39f4e0c
Merge branch 'main' of github.com:opensearch-project/OpenSearch into …
bharath-techie 320a71f
addressing review comments
bharath-techie 4174432
addressing comments
bharath-techie 12a191f
addressing comments
bharath-techie 7ef52fe
addressing comments
bharath-techie 6a01876
addressing comments, removing perf collector dependency in node perfo…
bharath-techie e7b0c49
Merge branch 'main' of github.com:opensearch-project/OpenSearch into …
bharath-techie 768eea4
Addressing comments
bharath-techie 4e82164
addressing comment
bharath-techie ef42c3d
Merge branch 'main' of github.com:opensearch-project/OpenSearch into …
bharath-techie 6d71414
changing elapsed_time to timestamp
bharath-techie 1ab5ec4
addressing comments
bharath-techie bc3a2cc
Refactoring test back to *Tests format as *IT is not recognized
bharath-techie 6c02a91
Merge branch 'main' of github.com:opensearch-project/OpenSearch into …
bharath-techie 757f9d2
Renaming files and packages to ResourceUsage
bharath-techie 690c168
Merge branch 'main' of github.com:opensearch-project/OpenSearch into …
bharath-techie bf7f65b
Merge branch 'main' of github.com:opensearch-project/OpenSearch into …
bharath-techie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
server/src/main/java/org/opensearch/node/NodeResourceUsageStats.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.node; | ||
|
|
||
| import org.opensearch.core.common.io.stream.StreamInput; | ||
| import org.opensearch.core.common.io.stream.StreamOutput; | ||
| import org.opensearch.core.common.io.stream.Writeable; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Locale; | ||
|
|
||
| /** | ||
| * This represents the resource usage stats of a node along with the timestamp at which the stats object was created | ||
| * in the respective node | ||
| */ | ||
| public class NodeResourceUsageStats implements Writeable { | ||
| final String nodeId; | ||
| long timestamp; | ||
| double cpuUtilizationPercent; | ||
| double memoryUtilizationPercent; | ||
|
|
||
| public NodeResourceUsageStats(String nodeId, long timestamp, double memoryUtilizationPercent, double cpuUtilizationPercent) { | ||
| this.nodeId = nodeId; | ||
| this.timestamp = timestamp; | ||
| this.cpuUtilizationPercent = cpuUtilizationPercent; | ||
| this.memoryUtilizationPercent = memoryUtilizationPercent; | ||
| } | ||
|
|
||
| public NodeResourceUsageStats(StreamInput in) throws IOException { | ||
| this.nodeId = in.readString(); | ||
| this.timestamp = in.readLong(); | ||
| this.cpuUtilizationPercent = in.readDouble(); | ||
| this.memoryUtilizationPercent = in.readDouble(); | ||
| } | ||
|
|
||
| @Override | ||
| public void writeTo(StreamOutput out) throws IOException { | ||
| out.writeString(this.nodeId); | ||
| out.writeLong(this.timestamp); | ||
| out.writeDouble(this.cpuUtilizationPercent); | ||
| out.writeDouble(this.memoryUtilizationPercent); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| StringBuilder sb = new StringBuilder("NodeResourceUsageStats["); | ||
| sb.append(nodeId).append("]("); | ||
| sb.append("Timestamp: ").append(timestamp); | ||
| sb.append(", CPU utilization percent: ").append(String.format(Locale.ROOT, "%.1f", cpuUtilizationPercent)); | ||
| sb.append(", Memory utilization percent: ").append(String.format(Locale.ROOT, "%.1f", memoryUtilizationPercent)); | ||
| sb.append(")"); | ||
| return sb.toString(); | ||
| } | ||
|
|
||
| NodeResourceUsageStats(NodeResourceUsageStats nodeResourceUsageStats) { | ||
| this( | ||
| nodeResourceUsageStats.nodeId, | ||
| nodeResourceUsageStats.timestamp, | ||
| nodeResourceUsageStats.memoryUtilizationPercent, | ||
| nodeResourceUsageStats.cpuUtilizationPercent | ||
| ); | ||
| } | ||
|
|
||
| public double getMemoryUtilizationPercent() { | ||
| return memoryUtilizationPercent; | ||
| } | ||
|
|
||
| public double getCpuUtilizationPercent() { | ||
| return cpuUtilizationPercent; | ||
| } | ||
|
|
||
| public long getTimestamp() { | ||
| return timestamp; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.