forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 2
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 <rishireddy1159@gmail.com> * Bind SegmentReplicarionStatsTracker in Node.java Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> * remove additional segrep backpressure info from node stats Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> * fix metric name in node stats Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> * Fix compile error. Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> * Fix compile errors. Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> * Address comments on PR. Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> * Update java docs. Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> * Address comments on PR and fix compile errors. Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> * Address comments on PR. Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> * Update unit test. Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> --------- Signed-off-by: Rishikesh1159 <rishireddy1159@gmail.com> Signed-off-by: Rishikesh Pasham <62345295+Rishikesh1159@users.noreply.github.com>
- Loading branch information
1 parent
1e9ec52
commit 51626d0
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.