|
@@ -26,7 +26,9 @@ import org.elasticsearch.xpack.core.transform.transforms.TransformIndexerStats;
|
|
|
import org.elasticsearch.xpack.core.transform.transforms.TransformStats;
|
|
|
import org.elasticsearch.xpack.transform.Transform;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -94,22 +96,8 @@ public class RestCatTransformAction extends AbstractCatAction {
|
|
|
|
|
|
private static Table getTableWithHeader() {
|
|
|
return new Table().startHeaders()
|
|
|
- // Transform config info
|
|
|
+ // default columns
|
|
|
.addCell("id", TableColumnAttributeBuilder.builder("the id").build())
|
|
|
- .addCell("create_time", TableColumnAttributeBuilder.builder("transform creation time").setAliases("ct", "createTime").build())
|
|
|
- .addCell(
|
|
|
- "version",
|
|
|
- TableColumnAttributeBuilder.builder("the version of Elasticsearch when the transform was created").setAliases("v").build()
|
|
|
- )
|
|
|
- .addCell("source_index", TableColumnAttributeBuilder.builder("source index").setAliases("si", "sourceIndex").build())
|
|
|
- .addCell("dest_index", TableColumnAttributeBuilder.builder("destination index").setAliases("di", "destIndex").build())
|
|
|
- .addCell("pipeline", TableColumnAttributeBuilder.builder("transform pipeline").setAliases("p").build())
|
|
|
- .addCell("description", TableColumnAttributeBuilder.builder("description").setAliases("d").build())
|
|
|
- .addCell("transform_type", TableColumnAttributeBuilder.builder("batch or continuous transform").setAliases("tt").build())
|
|
|
- .addCell("frequency", TableColumnAttributeBuilder.builder("frequency of transform").setAliases("f").build())
|
|
|
- .addCell("max_page_search_size", TableColumnAttributeBuilder.builder("max page search size").setAliases("mpsz").build())
|
|
|
- .addCell("docs_per_second", TableColumnAttributeBuilder.builder("docs per second").setAliases("dps").build())
|
|
|
- // Transform stats info
|
|
|
.addCell(
|
|
|
"state",
|
|
|
TableColumnAttributeBuilder.builder("transform state")
|
|
@@ -117,11 +105,48 @@ public class RestCatTransformAction extends AbstractCatAction {
|
|
|
.setTextAlignment(TableColumnAttributeBuilder.TextAlign.RIGHT)
|
|
|
.build()
|
|
|
)
|
|
|
- .addCell("reason", TableColumnAttributeBuilder.builder("reason for the current state", false).setAliases("r", "reason").build())
|
|
|
+ .addCell("checkpoint", TableColumnAttributeBuilder.builder("checkpoint").setAliases("c").build())
|
|
|
+ .addCell(
|
|
|
+ "documents_processed",
|
|
|
+ TableColumnAttributeBuilder.builder("the number of documents read from source indices and processed")
|
|
|
+ .setAliases("docp", "documentsProcessed")
|
|
|
+ .build()
|
|
|
+ )
|
|
|
+ .addCell(
|
|
|
+ "checkpoint_progress",
|
|
|
+ TableColumnAttributeBuilder.builder("progress of the checkpoint").setAliases("cp", "checkpointProgress").build()
|
|
|
+ )
|
|
|
+ .addCell(
|
|
|
+ "last_search_time",
|
|
|
+ TableColumnAttributeBuilder.builder("last time transform searched for updates").setAliases("lst", "lastSearchTime").build()
|
|
|
+ )
|
|
|
.addCell(
|
|
|
"changes_last_detection_time",
|
|
|
- TableColumnAttributeBuilder.builder("changes last detected time", false).setAliases("cldt").build()
|
|
|
+ TableColumnAttributeBuilder.builder("changes last detected time").setAliases("cldt").build()
|
|
|
+ )
|
|
|
+
|
|
|
+ // optional columns
|
|
|
+ .addCell(
|
|
|
+ "create_time",
|
|
|
+ TableColumnAttributeBuilder.builder("transform creation time", false).setAliases("ct", "createTime").build()
|
|
|
+ )
|
|
|
+ .addCell(
|
|
|
+ "version",
|
|
|
+ TableColumnAttributeBuilder.builder("the version of Elasticsearch when the transform was created", false)
|
|
|
+ .setAliases("v")
|
|
|
+ .build()
|
|
|
)
|
|
|
+ .addCell("source_index", TableColumnAttributeBuilder.builder("source index", false).setAliases("si", "sourceIndex").build())
|
|
|
+ .addCell("dest_index", TableColumnAttributeBuilder.builder("destination index", false).setAliases("di", "destIndex").build())
|
|
|
+ .addCell("pipeline", TableColumnAttributeBuilder.builder("transform pipeline", false).setAliases("p").build())
|
|
|
+ .addCell("description", TableColumnAttributeBuilder.builder("description", false).setAliases("d").build())
|
|
|
+ .addCell("transform_type", TableColumnAttributeBuilder.builder("batch or continuous transform", false).setAliases("tt").build())
|
|
|
+ .addCell("frequency", TableColumnAttributeBuilder.builder("frequency of transform", false).setAliases("f").build())
|
|
|
+ .addCell("max_page_search_size", TableColumnAttributeBuilder.builder("max page search size", false).setAliases("mpsz").build())
|
|
|
+ .addCell("docs_per_second", TableColumnAttributeBuilder.builder("docs per second", false).setAliases("dps").build())
|
|
|
+
|
|
|
+ .addCell("reason", TableColumnAttributeBuilder.builder("reason for the current state", false).setAliases("r", "reason").build())
|
|
|
+
|
|
|
.addCell("search_total", TableColumnAttributeBuilder.builder("total number of search phases", false).setAliases("st").build())
|
|
|
.addCell(
|
|
|
"search_failure",
|
|
@@ -137,15 +162,9 @@ public class RestCatTransformAction extends AbstractCatAction {
|
|
|
"index_time",
|
|
|
TableColumnAttributeBuilder.builder("total time spent indexing documents", false).setAliases("itime").build()
|
|
|
)
|
|
|
- .addCell(
|
|
|
- "documents_processed",
|
|
|
- TableColumnAttributeBuilder.builder("the number of documents read from source indices and processed", false)
|
|
|
- .setAliases("docp")
|
|
|
- .build()
|
|
|
- )
|
|
|
.addCell(
|
|
|
"documents_indexed",
|
|
|
- TableColumnAttributeBuilder.builder("the number of documents index to the destination index", false)
|
|
|
+ TableColumnAttributeBuilder.builder("the number of documents written to the destination index", false)
|
|
|
.setAliases("doci")
|
|
|
.build()
|
|
|
)
|
|
@@ -199,9 +218,30 @@ public class RestCatTransformAction extends AbstractCatAction {
|
|
|
: config.getPivotConfig().getMaxPageSearchSize()
|
|
|
: config.getSettings().getMaxPageSearchSize();
|
|
|
|
|
|
+ Double progress = checkpointingInfo == null ? null
|
|
|
+ : checkpointingInfo.getNext().getCheckpointProgress() == null ? null
|
|
|
+ : checkpointingInfo.getNext().getCheckpointProgress().getPercentComplete();
|
|
|
+
|
|
|
table.startRow()
|
|
|
+ // default columns
|
|
|
.addCell(config.getId())
|
|
|
- .addCell(config.getCreateTime())
|
|
|
+ .addCell(stats == null ? null : stats.getState().toString())
|
|
|
+ .addCell(checkpointingInfo == null ? null : checkpointingInfo.getLast().getCheckpoint())
|
|
|
+ .addCell(transformIndexerStats == null ? null : transformIndexerStats.getNumDocuments())
|
|
|
+ .addCell(progress == null ? null : String.format(Locale.ROOT, "%.2f", progress))
|
|
|
+ .addCell(
|
|
|
+ checkpointingInfo == null ? null
|
|
|
+ : checkpointingInfo.getLastSearchTime() == null ? null
|
|
|
+ : Date.from(checkpointingInfo.getLastSearchTime())
|
|
|
+ )
|
|
|
+ .addCell(
|
|
|
+ checkpointingInfo == null ? null
|
|
|
+ : checkpointingInfo.getChangesLastDetectedAt() == null ? null
|
|
|
+ : Date.from(checkpointingInfo.getChangesLastDetectedAt())
|
|
|
+ )
|
|
|
+
|
|
|
+ // optional columns
|
|
|
+ .addCell(config.getCreateTime() == null ? null : Date.from(config.getCreateTime()))
|
|
|
.addCell(config.getVersion())
|
|
|
.addCell(String.join(",", config.getSource().getIndex()))
|
|
|
.addCell(config.getDestination().getIndex())
|
|
@@ -215,9 +255,7 @@ public class RestCatTransformAction extends AbstractCatAction {
|
|
|
? "-"
|
|
|
: config.getSettings().getDocsPerSecond()
|
|
|
)
|
|
|
- .addCell(stats == null ? null : stats.getState())
|
|
|
.addCell(stats == null ? null : stats.getReason())
|
|
|
- .addCell(checkpointingInfo == null ? null : checkpointingInfo.getChangesLastDetectedAt())
|
|
|
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getSearchTotal())
|
|
|
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getSearchFailures())
|
|
|
.addCell(transformIndexerStats == null ? null : TimeValue.timeValueMillis(transformIndexerStats.getSearchTime()))
|
|
@@ -226,15 +264,26 @@ public class RestCatTransformAction extends AbstractCatAction {
|
|
|
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getIndexFailures())
|
|
|
.addCell(transformIndexerStats == null ? null : TimeValue.timeValueMillis(transformIndexerStats.getIndexTime()))
|
|
|
|
|
|
- .addCell(transformIndexerStats == null ? null : transformIndexerStats.getNumDocuments())
|
|
|
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getOutputDocuments())
|
|
|
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getNumInvocations())
|
|
|
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getNumPages())
|
|
|
.addCell(transformIndexerStats == null ? null : TimeValue.timeValueMillis(transformIndexerStats.getProcessingTime()))
|
|
|
|
|
|
- .addCell(transformIndexerStats == null ? null : transformIndexerStats.getExpAvgCheckpointDurationMs())
|
|
|
- .addCell(transformIndexerStats == null ? null : transformIndexerStats.getExpAvgDocumentsIndexed())
|
|
|
- .addCell(transformIndexerStats == null ? null : transformIndexerStats.getExpAvgDocumentsProcessed())
|
|
|
+ .addCell(
|
|
|
+ transformIndexerStats == null
|
|
|
+ ? null
|
|
|
+ : String.format(Locale.ROOT, "%.2f", transformIndexerStats.getExpAvgCheckpointDurationMs())
|
|
|
+ )
|
|
|
+ .addCell(
|
|
|
+ transformIndexerStats == null
|
|
|
+ ? null
|
|
|
+ : String.format(Locale.ROOT, "%.2f", transformIndexerStats.getExpAvgDocumentsIndexed())
|
|
|
+ )
|
|
|
+ .addCell(
|
|
|
+ transformIndexerStats == null
|
|
|
+ ? null
|
|
|
+ : String.format(Locale.ROOT, "%.2f", transformIndexerStats.getExpAvgDocumentsProcessed())
|
|
|
+ )
|
|
|
.endRow();
|
|
|
});
|
|
|
|