forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Segment Replication] Add Segment Replication backpressure rejection …
…stats to _nodes/stats (opensearch-project#10656) * Initial WIP for adding segrep backpressure to node stats. Signed-off-by: Rishikesh1159 <[email protected]> * Bind SegmentReplicarionStatsTracker in Node.java Signed-off-by: Rishikesh1159 <[email protected]> * remove additional segrep backpressure info from node stats Signed-off-by: Rishikesh1159 <[email protected]> * fix metric name in node stats Signed-off-by: Rishikesh1159 <[email protected]> * Fix compile error. Signed-off-by: Rishikesh1159 <[email protected]> * Fix compile errors. Signed-off-by: Rishikesh1159 <[email protected]> * Address comments on PR. Signed-off-by: Rishikesh1159 <[email protected]> * Update java docs. Signed-off-by: Rishikesh1159 <[email protected]> * Address comments on PR and fix compile errors. Signed-off-by: Rishikesh1159 <[email protected]> * Address comments on PR. Signed-off-by: Rishikesh1159 <[email protected]> * Update unit test. Signed-off-by: Rishikesh1159 <[email protected]> --------- Signed-off-by: Rishikesh1159 <[email protected]> Signed-off-by: Rishikesh Pasham <[email protected]>
- Loading branch information
1 parent
21d23e1
commit 2b68ca3
Showing
16 changed files
with
186 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
67 changes: 67 additions & 0 deletions
67
server/src/main/java/org/opensearch/index/SegmentReplicationRejectionStats.java
This file contains 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,67 @@ | ||
/* | ||
* 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.index; | ||
|
||
import org.opensearch.Version; | ||
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 org.opensearch.core.xcontent.ToXContentFragment; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Segment replication rejection stats. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class SegmentReplicationRejectionStats implements Writeable, ToXContentFragment { | ||
|
||
/** | ||
* Total rejections due to segment replication backpressure | ||
*/ | ||
private long totalRejectionCount; | ||
|
||
public SegmentReplicationRejectionStats(final long totalRejectionCount) { | ||
this.totalRejectionCount = totalRejectionCount; | ||
} | ||
|
||
public SegmentReplicationRejectionStats(StreamInput in) throws IOException { | ||
// TODO: change to V_2_12_0 on main after backport to 2.x | ||
if (in.getVersion().onOrAfter(Version.V_3_0_0)) { | ||
this.totalRejectionCount = in.readVLong(); | ||
} | ||
} | ||
|
||
public long getTotalRejectionCount() { | ||
return totalRejectionCount; | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||
builder.startObject("segment_replication_backpressure"); | ||
builder.field("total_rejected_requests", totalRejectionCount); | ||
return builder.endObject(); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
// TODO: change to V_2_12_0 on main after backport to 2.x | ||
if (out.getVersion().onOrAfter(Version.V_3_0_0)) { | ||
out.writeVLong(totalRejectionCount); | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "SegmentReplicationRejectionStats{ totalRejectedRequestCount=" + totalRejectionCount + '}'; | ||
} | ||
|
||
} |
This file contains 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 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 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 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 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 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.