Skip to content

Commit

Permalink
Merge pull request #10 from ajaymovva/pitsegmentsrest
Browse files Browse the repository at this point in the history
Addded Rest Layer Changes for Point In Time Stats
  • Loading branch information
bharath-techie committed Aug 12, 2022
2 parents 9482b59 + 3acaa7f commit 64f55a8
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,21 @@ protected Table getTableWithHeader(final RestRequest request) {
);
table.addCell("pri.search.scroll_total", "default:false;text-align:right;desc:completed scroll contexts");

table.addCell("search.point_in_time_current", "sibling:pri;alias:scc,searchPointInTimeCurrent;default:false;text-align:right;desc:open pit contexts");
table.addCell("pri.search.point_in_time_current", "default:false;text-align:right;desc:open pit contexts");

table.addCell(
"search.point_in_time_time",
"sibling:pri;alias:scti,searchPointInTimeTime;default:false;text-align:right;desc:time pit contexts held open"
);
table.addCell("pri.search.point_in_time_time", "default:false;text-align:right;desc:time pit contexts held open");

table.addCell(
"search.point_in_time_total",
"sibling:pri;alias:scto,searchPointInTimeTotal;default:false;text-align:right;desc:completed pit contexts"
);
table.addCell("pri.search.point_in_time_total", "default:false;text-align:right;desc:completed pit contexts");

table.addCell("segments.count", "sibling:pri;alias:sc,segmentsCount;default:false;text-align:right;desc:number of segments");
table.addCell("pri.segments.count", "default:false;text-align:right;desc:number of segments");

Expand Down Expand Up @@ -878,6 +893,15 @@ Table buildTable(
table.addCell(totalStats.getSearch() == null ? null : totalStats.getSearch().getTotal().getScrollCount());
table.addCell(primaryStats.getSearch() == null ? null : primaryStats.getSearch().getTotal().getScrollCount());

table.addCell(totalStats.getSearch() == null ? null : totalStats.getSearch().getTotal().getPitCurrent());
table.addCell(primaryStats.getSearch() == null ? null : primaryStats.getSearch().getTotal().getPitCurrent());

table.addCell(totalStats.getSearch() == null ? null : totalStats.getSearch().getTotal().getPitTime());
table.addCell(primaryStats.getSearch() == null ? null : primaryStats.getSearch().getTotal().getPitTime());

table.addCell(totalStats.getSearch() == null ? null : totalStats.getSearch().getTotal().getPitCount());
table.addCell(primaryStats.getSearch() == null ? null : primaryStats.getSearch().getTotal().getPitCount());

table.addCell(totalStats.getSegments() == null ? null : totalStats.getSegments().getCount());
table.addCell(primaryStats.getSegments() == null ? null : primaryStats.getSegments().getCount());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ protected Table getTableWithHeader(final RestRequest request) {
);
table.addCell("search.scroll_total", "alias:scto,searchScrollTotal;default:false;text-align:right;desc:completed scroll contexts");

table.addCell("search.point_in_time_current", "alias:scc,searchPointInTimeCurrent;default:false;text-align:right;desc:open pit contexts");
table.addCell("search.point_in_time_time", "alias:scti,searchPointInTimeTime;default:false;text-align:right;desc:time pit contexts held open");
table.addCell("search.point_in_time_total", "alias:scto,searchPointInTimeTotal;default:false;text-align:right;desc:completed pit contexts");

table.addCell("segments.count", "alias:sc,segmentsCount;default:false;text-align:right;desc:number of segments");
table.addCell("segments.memory", "alias:sm,segmentsMemory;default:false;text-align:right;desc:memory used by segments");
table.addCell(
Expand Down Expand Up @@ -519,6 +523,9 @@ Table buildTable(
table.addCell(searchStats == null ? null : searchStats.getTotal().getScrollCurrent());
table.addCell(searchStats == null ? null : searchStats.getTotal().getScrollTime());
table.addCell(searchStats == null ? null : searchStats.getTotal().getScrollCount());
table.addCell(searchStats == null ? null : searchStats.getTotal().getPitCurrent());
table.addCell(searchStats == null ? null : searchStats.getTotal().getPitTime());
table.addCell(searchStats == null ? null : searchStats.getTotal().getPitCount());

SegmentsStats segmentsStats = indicesStats == null ? null : indicesStats.getSegments();
table.addCell(segmentsStats == null ? null : segmentsStats.getCount());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
import static java.util.Collections.unmodifiableList;
import static org.opensearch.rest.RestRequest.Method.GET;

/**
* Rest action for pit segments
*/
public class RestPitSegmentsAction extends AbstractCatAction {
@Override
public List<RestHandler.Route> routes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ protected Table getTableWithHeader(final RestRequest request) {
);
table.addCell("search.scroll_total", "alias:scto,searchScrollTotal;default:false;text-align:right;desc:completed scroll contexts");

table.addCell("search.point_in_time_current", "alias:spc,searchPointInTimeCurrent;default:false;text-align:right;desc:open pit contexts");
table.addCell("search.point_in_time_time", "alias:spti,searchPointInTimeTime;default:false;text-align:right;desc:time pit contexts held open");
table.addCell("search.point_in_time_total", "alias:spto,searchPointInTimeTotal;default:false;text-align:right;desc:completed pit contexts");

table.addCell("segments.count", "alias:sc,segmentsCount;default:false;text-align:right;desc:number of segments");
table.addCell("segments.memory", "alias:sm,segmentsMemory;default:false;text-align:right;desc:memory used by segments");
table.addCell(
Expand Down Expand Up @@ -390,6 +394,9 @@ Table buildTable(RestRequest request, ClusterStateResponse state, IndicesStatsRe
table.addCell(getOrNull(commonStats, CommonStats::getSearch, i -> i.getTotal().getScrollCurrent()));
table.addCell(getOrNull(commonStats, CommonStats::getSearch, i -> i.getTotal().getScrollTime()));
table.addCell(getOrNull(commonStats, CommonStats::getSearch, i -> i.getTotal().getScrollCount()));
table.addCell(getOrNull(commonStats, CommonStats::getSearch, i -> i.getTotal().getPitCurrent()));
table.addCell(getOrNull(commonStats, CommonStats::getSearch, i -> i.getTotal().getPitTime()));
table.addCell(getOrNull(commonStats, CommonStats::getSearch, i -> i.getTotal().getPitCount()));

table.addCell(getOrNull(commonStats, CommonStats::getSegments, SegmentsStats::getCount));
table.addCell(getOrNull(commonStats, CommonStats::getSegments, SegmentsStats::getZeroMemory));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ public void testBuildTable() {
assertThat(row.get(3).value, equalTo(shardRouting.state()));
assertThat(row.get(6).value, equalTo(localNode.getHostAddress()));
assertThat(row.get(7).value, equalTo(localNode.getId()));
assertThat(row.get(69).value, equalTo(shardStats.getDataPath()));
assertThat(row.get(70).value, equalTo(shardStats.getStatePath()));
assertThat(row.get(72).value, equalTo(shardStats.getDataPath()));
assertThat(row.get(73).value, equalTo(shardStats.getStatePath()));
}
}
}

0 comments on commit 64f55a8

Please sign in to comment.