[Transform] fixing naming in HLRC and _cat to match API content (#54300) (#54408)

Fixing the naming of the HLRC values to match the ToXContent field names (i.e. the field names returned from an API call).

Also fixes the names in the _cat API as well.

closes #53946
This commit is contained in:
Benjamin Trent 2020-03-30 08:57:02 -04:00 committed by GitHub
parent 12cfdc24b0
commit 374e76d7cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 260 additions and 96 deletions

View File

@ -24,7 +24,6 @@ import org.elasticsearch.common.ParseField;
import java.util.Objects; import java.util.Objects;
public abstract class IndexerJobStats { public abstract class IndexerJobStats {
public static final String NAME = "data_frame_indexer_transform_stats";
public static ParseField NUM_PAGES = new ParseField("pages_processed"); public static ParseField NUM_PAGES = new ParseField("pages_processed");
public static ParseField NUM_INPUT_DOCUMENTS = new ParseField("documents_processed"); public static ParseField NUM_INPUT_DOCUMENTS = new ParseField("documents_processed");
public static ParseField NUM_OUTPUT_DOCUMENTS = new ParseField("documents_indexed"); public static ParseField NUM_OUTPUT_DOCUMENTS = new ParseField("documents_indexed");

View File

@ -19,7 +19,6 @@
package org.elasticsearch.client.transform.transforms; package org.elasticsearch.client.transform.transforms;
import org.elasticsearch.client.core.IndexerJobStats;
import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.xcontent.ConstructingObjectParser; import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser;
@ -29,11 +28,24 @@ import java.util.Objects;
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg; import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
public class TransformIndexerStats extends IndexerJobStats { public class TransformIndexerStats {
public static final String NAME = "transform_indexer_stats";
static ParseField EXPONENTIAL_AVG_CHECKPOINT_DURATION_MS = new ParseField("exponential_avg_checkpoint_duration_ms"); static ParseField EXPONENTIAL_AVG_CHECKPOINT_DURATION_MS = new ParseField("exponential_avg_checkpoint_duration_ms");
static ParseField EXPONENTIAL_AVG_DOCUMENTS_INDEXED = new ParseField("exponential_avg_documents_indexed"); static ParseField EXPONENTIAL_AVG_DOCUMENTS_INDEXED = new ParseField("exponential_avg_documents_indexed");
static ParseField EXPONENTIAL_AVG_DOCUMENTS_PROCESSED = new ParseField("exponential_avg_documents_processed"); static ParseField EXPONENTIAL_AVG_DOCUMENTS_PROCESSED = new ParseField("exponential_avg_documents_processed");
static ParseField PAGES_PROCESSED = new ParseField("pages_processed");
static ParseField DOCUMENTS_PROCESSED = new ParseField("documents_processed");
static ParseField DOCUMENTS_INDEXED = new ParseField("documents_indexed");
static ParseField TRIGGER_COUNT = new ParseField("trigger_count");
static ParseField INDEX_TIME_IN_MS = new ParseField("index_time_in_ms");
static ParseField SEARCH_TIME_IN_MS = new ParseField("search_time_in_ms");
static ParseField PROCESSING_TIME_IN_MS = new ParseField("processing_time_in_ms");
static ParseField INDEX_TOTAL = new ParseField("index_total");
static ParseField SEARCH_TOTAL = new ParseField("search_total");
static ParseField PROCESSING_TOTAL = new ParseField("processing_total");
static ParseField SEARCH_FAILURES = new ParseField("search_failures");
static ParseField INDEX_FAILURES = new ParseField("index_failures");
public static final ConstructingObjectParser<TransformIndexerStats, Void> LENIENT_PARSER = new ConstructingObjectParser<>( public static final ConstructingObjectParser<TransformIndexerStats, Void> LENIENT_PARSER = new ConstructingObjectParser<>(
NAME, NAME,
@ -58,10 +70,10 @@ public class TransformIndexerStats extends IndexerJobStats {
); );
static { static {
LENIENT_PARSER.declareLong(optionalConstructorArg(), NUM_PAGES); LENIENT_PARSER.declareLong(optionalConstructorArg(), PAGES_PROCESSED);
LENIENT_PARSER.declareLong(optionalConstructorArg(), NUM_INPUT_DOCUMENTS); LENIENT_PARSER.declareLong(optionalConstructorArg(), DOCUMENTS_PROCESSED);
LENIENT_PARSER.declareLong(optionalConstructorArg(), NUM_OUTPUT_DOCUMENTS); LENIENT_PARSER.declareLong(optionalConstructorArg(), DOCUMENTS_INDEXED);
LENIENT_PARSER.declareLong(optionalConstructorArg(), NUM_INVOCATIONS); LENIENT_PARSER.declareLong(optionalConstructorArg(), TRIGGER_COUNT);
LENIENT_PARSER.declareLong(optionalConstructorArg(), INDEX_TIME_IN_MS); LENIENT_PARSER.declareLong(optionalConstructorArg(), INDEX_TIME_IN_MS);
LENIENT_PARSER.declareLong(optionalConstructorArg(), SEARCH_TIME_IN_MS); LENIENT_PARSER.declareLong(optionalConstructorArg(), SEARCH_TIME_IN_MS);
LENIENT_PARSER.declareLong(optionalConstructorArg(), PROCESSING_TIME_IN_MS); LENIENT_PARSER.declareLong(optionalConstructorArg(), PROCESSING_TIME_IN_MS);
@ -82,12 +94,24 @@ public class TransformIndexerStats extends IndexerJobStats {
private final double expAvgCheckpointDurationMs; private final double expAvgCheckpointDurationMs;
private final double expAvgDocumentsIndexed; private final double expAvgDocumentsIndexed;
private final double expAvgDocumentsProcessed; private final double expAvgDocumentsProcessed;
private final long pagesProcessed;
private final long documentsProcessed;
private final long documentsIndexed;
private final long triggerCount;
private final long indexTime;
private final long indexTotal;
private final long searchTime;
private final long searchTotal;
private final long processingTime;
private final long processingTotal;
private final long indexFailures;
private final long searchFailures;
public TransformIndexerStats( public TransformIndexerStats(
long numPages, long pagesProcessed,
long numInputDocuments, long documentsProcessed,
long numOuputDocuments, long documentsIndexed,
long numInvocations, long triggerCount,
long indexTime, long indexTime,
long searchTime, long searchTime,
long processingTime, long processingTime,
@ -100,20 +124,18 @@ public class TransformIndexerStats extends IndexerJobStats {
double expAvgDocumentsIndexed, double expAvgDocumentsIndexed,
double expAvgDocumentsProcessed double expAvgDocumentsProcessed
) { ) {
super( this.pagesProcessed = pagesProcessed;
numPages, this.documentsProcessed = documentsProcessed;
numInputDocuments, this.documentsIndexed = documentsIndexed;
numOuputDocuments, this.triggerCount = triggerCount;
numInvocations, this.indexTime = indexTime;
indexTime, this.indexTotal = indexTotal;
searchTime, this.searchTime = searchTime;
processingTime, this.searchTotal = searchTotal;
indexTotal, this.processingTime = processingTime;
searchTotal, this.processingTotal = processingTotal;
processingTotal, this.indexFailures = indexFailures;
indexFailures, this.searchFailures = searchFailures;
searchFailures
);
this.expAvgCheckpointDurationMs = expAvgCheckpointDurationMs; this.expAvgCheckpointDurationMs = expAvgCheckpointDurationMs;
this.expAvgDocumentsIndexed = expAvgDocumentsIndexed; this.expAvgDocumentsIndexed = expAvgDocumentsIndexed;
this.expAvgDocumentsProcessed = expAvgDocumentsProcessed; this.expAvgDocumentsProcessed = expAvgDocumentsProcessed;
@ -131,6 +153,127 @@ public class TransformIndexerStats extends IndexerJobStats {
return expAvgDocumentsProcessed; return expAvgDocumentsProcessed;
} }
/**
* The number of pages read from the input indices
*/
public long getPagesProcessed() {
return pagesProcessed;
}
/**
* The number of documents read from the input indices
*/
public long getDocumentsProcessed() {
return documentsProcessed;
}
/**
* Number of times that the job woke up to write documents
*/
public long getTriggerCount() {
return triggerCount;
}
/**
* Number of documents written
*/
public long getDocumentsIndexed() {
return documentsIndexed;
}
/**
* The number of pages read from the input indices
* Deprecated, use {@link TransformIndexerStats#getPagesProcessed()} instead
*/
@Deprecated
public long getNumPages() {
return getPagesProcessed();
}
/**
* The number of documents read from the input indices
* Deprecated, use {@link TransformIndexerStats#getDocumentsProcessed()} instead
*/
@Deprecated
public long getNumDocuments() {
return getDocumentsProcessed();
}
/**
* Number of times that the job woke up to write documents
* Deprecated, use {@link TransformIndexerStats#getTriggerCount()} instead
*/
@Deprecated
public long getNumInvocations() {
return getTriggerCount();
}
/**
* Number of documents written
* Deprecated, use {@link TransformIndexerStats#getDocumentsIndexed()} instead
*/
@Deprecated
public long getOutputDocuments() {
return getDocumentsIndexed();
}
/**
* Number of index failures that have occurred
*/
public long getIndexFailures() {
return indexFailures;
}
/**
* Number of failures that have occurred
*/
public long getSearchFailures() {
return searchFailures;
}
/**
* Returns the time spent indexing (cumulative) in milliseconds
*/
public long getIndexTime() {
return indexTime;
}
/**
* Returns the time spent searching (cumulative) in milliseconds
*/
public long getSearchTime() {
return searchTime;
}
/**
* Returns the time spent processing (cumulative) in milliseconds
*/
public long getProcessingTime() {
return processingTime;
}
/**
* Returns the total number of indexing requests that have been processed
* (Note: this is not the number of _documents_ that have been indexed)
*/
public long getIndexTotal() {
return indexTotal;
}
/**
* Returns the total number of search requests that have been made
*/
public long getSearchTotal() {
return searchTotal;
}
/**
* Returns the total number of processing runs that have been made
*/
public long getProcessingTotal() {
return processingTotal;
}
@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
@ -143,10 +286,10 @@ public class TransformIndexerStats extends IndexerJobStats {
TransformIndexerStats that = (TransformIndexerStats) other; TransformIndexerStats that = (TransformIndexerStats) other;
return Objects.equals(this.numPages, that.numPages) return Objects.equals(this.pagesProcessed, that.pagesProcessed)
&& Objects.equals(this.numInputDocuments, that.numInputDocuments) && Objects.equals(this.documentsProcessed, that.documentsProcessed)
&& Objects.equals(this.numOuputDocuments, that.numOuputDocuments) && Objects.equals(this.documentsIndexed, that.documentsIndexed)
&& Objects.equals(this.numInvocations, that.numInvocations) && Objects.equals(this.triggerCount, that.triggerCount)
&& Objects.equals(this.indexTime, that.indexTime) && Objects.equals(this.indexTime, that.indexTime)
&& Objects.equals(this.searchTime, that.searchTime) && Objects.equals(this.searchTime, that.searchTime)
&& Objects.equals(this.processingTime, that.processingTime) && Objects.equals(this.processingTime, that.processingTime)
@ -163,10 +306,10 @@ public class TransformIndexerStats extends IndexerJobStats {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( return Objects.hash(
numPages, pagesProcessed,
numInputDocuments, documentsProcessed,
numOuputDocuments, documentsIndexed,
numInvocations, triggerCount,
indexTime, indexTime,
searchTime, searchTime,
processingTime, processingTime,

View File

@ -19,7 +19,6 @@
package org.elasticsearch.client.transform.transforms; package org.elasticsearch.client.transform.transforms;
import org.elasticsearch.client.core.IndexerJobStats;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.ESTestCase;
@ -61,18 +60,18 @@ public class TransformIndexerStatsTests extends ESTestCase {
public static void toXContent(TransformIndexerStats stats, XContentBuilder builder) throws IOException { public static void toXContent(TransformIndexerStats stats, XContentBuilder builder) throws IOException {
builder.startObject(); builder.startObject();
if (randomBoolean()) { if (randomBoolean()) {
builder.field(IndexerJobStats.NUM_PAGES.getPreferredName(), stats.getNumPages()); builder.field(TransformIndexerStats.PAGES_PROCESSED.getPreferredName(), stats.getPagesProcessed());
builder.field(IndexerJobStats.NUM_INPUT_DOCUMENTS.getPreferredName(), stats.getNumDocuments()); builder.field(TransformIndexerStats.DOCUMENTS_PROCESSED.getPreferredName(), stats.getDocumentsProcessed());
builder.field(IndexerJobStats.NUM_OUTPUT_DOCUMENTS.getPreferredName(), stats.getOutputDocuments()); builder.field(TransformIndexerStats.DOCUMENTS_INDEXED.getPreferredName(), stats.getDocumentsIndexed());
builder.field(IndexerJobStats.NUM_INVOCATIONS.getPreferredName(), stats.getNumInvocations()); builder.field(TransformIndexerStats.TRIGGER_COUNT.getPreferredName(), stats.getTriggerCount());
builder.field(IndexerJobStats.INDEX_TIME_IN_MS.getPreferredName(), stats.getIndexTime()); builder.field(TransformIndexerStats.INDEX_TIME_IN_MS.getPreferredName(), stats.getIndexTime());
builder.field(IndexerJobStats.INDEX_TOTAL.getPreferredName(), stats.getIndexTotal()); builder.field(TransformIndexerStats.INDEX_TOTAL.getPreferredName(), stats.getIndexTotal());
builder.field(IndexerJobStats.INDEX_FAILURES.getPreferredName(), stats.getIndexFailures()); builder.field(TransformIndexerStats.INDEX_FAILURES.getPreferredName(), stats.getIndexFailures());
builder.field(IndexerJobStats.SEARCH_TIME_IN_MS.getPreferredName(), stats.getSearchTime()); builder.field(TransformIndexerStats.SEARCH_TIME_IN_MS.getPreferredName(), stats.getSearchTime());
builder.field(IndexerJobStats.SEARCH_TOTAL.getPreferredName(), stats.getSearchTotal()); builder.field(TransformIndexerStats.SEARCH_TOTAL.getPreferredName(), stats.getSearchTotal());
builder.field(IndexerJobStats.PROCESSING_TIME_IN_MS.getPreferredName(), stats.getProcessingTime()); builder.field(TransformIndexerStats.PROCESSING_TIME_IN_MS.getPreferredName(), stats.getProcessingTime());
builder.field(IndexerJobStats.PROCESSING_TOTAL.getPreferredName(), stats.getProcessingTotal()); builder.field(TransformIndexerStats.PROCESSING_TOTAL.getPreferredName(), stats.getProcessingTotal());
builder.field(IndexerJobStats.SEARCH_FAILURES.getPreferredName(), stats.getSearchFailures()); builder.field(TransformIndexerStats.SEARCH_FAILURES.getPreferredName(), stats.getSearchFailures());
builder.field( builder.field(
TransformIndexerStats.EXPONENTIAL_AVG_CHECKPOINT_DURATION_MS.getPreferredName(), TransformIndexerStats.EXPONENTIAL_AVG_CHECKPOINT_DURATION_MS.getPreferredName(),
stats.getExpAvgCheckpointDurationMs() stats.getExpAvgCheckpointDurationMs()
@ -84,18 +83,18 @@ public class TransformIndexerStatsTests extends ESTestCase {
); );
} else { } else {
// a toXContent version which leaves out field with value 0 (simulating the case that an older version misses a field) // a toXContent version which leaves out field with value 0 (simulating the case that an older version misses a field)
xContentFieldIfNotZero(builder, IndexerJobStats.NUM_PAGES.getPreferredName(), stats.getNumPages()); xContentFieldIfNotZero(builder, TransformIndexerStats.PAGES_PROCESSED.getPreferredName(), stats.getPagesProcessed());
xContentFieldIfNotZero(builder, IndexerJobStats.NUM_INPUT_DOCUMENTS.getPreferredName(), stats.getNumDocuments()); xContentFieldIfNotZero(builder, TransformIndexerStats.DOCUMENTS_PROCESSED.getPreferredName(), stats.getDocumentsProcessed());
xContentFieldIfNotZero(builder, IndexerJobStats.NUM_OUTPUT_DOCUMENTS.getPreferredName(), stats.getOutputDocuments()); xContentFieldIfNotZero(builder, TransformIndexerStats.DOCUMENTS_INDEXED.getPreferredName(), stats.getDocumentsIndexed());
xContentFieldIfNotZero(builder, IndexerJobStats.NUM_INVOCATIONS.getPreferredName(), stats.getNumInvocations()); xContentFieldIfNotZero(builder, TransformIndexerStats.TRIGGER_COUNT.getPreferredName(), stats.getTriggerCount());
xContentFieldIfNotZero(builder, IndexerJobStats.INDEX_TIME_IN_MS.getPreferredName(), stats.getIndexTime()); xContentFieldIfNotZero(builder, TransformIndexerStats.INDEX_TIME_IN_MS.getPreferredName(), stats.getIndexTime());
xContentFieldIfNotZero(builder, IndexerJobStats.INDEX_TOTAL.getPreferredName(), stats.getIndexTotal()); xContentFieldIfNotZero(builder, TransformIndexerStats.INDEX_TOTAL.getPreferredName(), stats.getIndexTotal());
xContentFieldIfNotZero(builder, IndexerJobStats.INDEX_FAILURES.getPreferredName(), stats.getIndexFailures()); xContentFieldIfNotZero(builder, TransformIndexerStats.INDEX_FAILURES.getPreferredName(), stats.getIndexFailures());
xContentFieldIfNotZero(builder, IndexerJobStats.SEARCH_TIME_IN_MS.getPreferredName(), stats.getSearchTime()); xContentFieldIfNotZero(builder, TransformIndexerStats.SEARCH_TIME_IN_MS.getPreferredName(), stats.getSearchTime());
xContentFieldIfNotZero(builder, IndexerJobStats.SEARCH_TOTAL.getPreferredName(), stats.getSearchTotal()); xContentFieldIfNotZero(builder, TransformIndexerStats.SEARCH_TOTAL.getPreferredName(), stats.getSearchTotal());
xContentFieldIfNotZero(builder, IndexerJobStats.PROCESSING_TIME_IN_MS.getPreferredName(), stats.getProcessingTime()); xContentFieldIfNotZero(builder, TransformIndexerStats.PROCESSING_TIME_IN_MS.getPreferredName(), stats.getProcessingTime());
xContentFieldIfNotZero(builder, IndexerJobStats.PROCESSING_TOTAL.getPreferredName(), stats.getProcessingTotal()); xContentFieldIfNotZero(builder, TransformIndexerStats.PROCESSING_TOTAL.getPreferredName(), stats.getProcessingTotal());
xContentFieldIfNotZero(builder, IndexerJobStats.SEARCH_FAILURES.getPreferredName(), stats.getSearchFailures()); xContentFieldIfNotZero(builder, TransformIndexerStats.SEARCH_FAILURES.getPreferredName(), stats.getSearchFailures());
xContentFieldIfNotZero( xContentFieldIfNotZero(
builder, builder,
TransformIndexerStats.EXPONENTIAL_AVG_CHECKPOINT_DURATION_MS.getPreferredName(), TransformIndexerStats.EXPONENTIAL_AVG_CHECKPOINT_DURATION_MS.getPreferredName(),

View File

@ -153,13 +153,13 @@ public class TransformStatsTests extends AbstractResponseTestCase<
assertThat(serverTestInstance.getExpAvgCheckpointDurationMs(), equalTo(clientInstance.getExpAvgCheckpointDurationMs())); assertThat(serverTestInstance.getExpAvgCheckpointDurationMs(), equalTo(clientInstance.getExpAvgCheckpointDurationMs()));
assertThat(serverTestInstance.getExpAvgDocumentsProcessed(), equalTo(clientInstance.getExpAvgDocumentsProcessed())); assertThat(serverTestInstance.getExpAvgDocumentsProcessed(), equalTo(clientInstance.getExpAvgDocumentsProcessed()));
assertThat(serverTestInstance.getExpAvgDocumentsIndexed(), equalTo(clientInstance.getExpAvgDocumentsIndexed())); assertThat(serverTestInstance.getExpAvgDocumentsIndexed(), equalTo(clientInstance.getExpAvgDocumentsIndexed()));
assertThat(serverTestInstance.getNumPages(), equalTo(clientInstance.getNumPages())); assertThat(serverTestInstance.getNumPages(), equalTo(clientInstance.getPagesProcessed()));
assertThat(serverTestInstance.getIndexFailures(), equalTo(clientInstance.getIndexFailures())); assertThat(serverTestInstance.getIndexFailures(), equalTo(clientInstance.getIndexFailures()));
assertThat(serverTestInstance.getIndexTime(), equalTo(clientInstance.getIndexTime())); assertThat(serverTestInstance.getIndexTime(), equalTo(clientInstance.getIndexTime()));
assertThat(serverTestInstance.getIndexTotal(), equalTo(clientInstance.getIndexTotal())); assertThat(serverTestInstance.getIndexTotal(), equalTo(clientInstance.getIndexTotal()));
assertThat(serverTestInstance.getNumDocuments(), equalTo(clientInstance.getNumDocuments())); assertThat(serverTestInstance.getNumDocuments(), equalTo(clientInstance.getDocumentsProcessed()));
assertThat(serverTestInstance.getNumInvocations(), equalTo(clientInstance.getNumInvocations())); assertThat(serverTestInstance.getNumInvocations(), equalTo(clientInstance.getTriggerCount()));
assertThat(serverTestInstance.getOutputDocuments(), equalTo(clientInstance.getOutputDocuments())); assertThat(serverTestInstance.getOutputDocuments(), equalTo(clientInstance.getDocumentsIndexed()));
assertThat(serverTestInstance.getSearchFailures(), equalTo(clientInstance.getSearchFailures())); assertThat(serverTestInstance.getSearchFailures(), equalTo(clientInstance.getSearchFailures()));
assertThat(serverTestInstance.getSearchTime(), equalTo(clientInstance.getSearchTime())); assertThat(serverTestInstance.getSearchTime(), equalTo(clientInstance.getSearchTime()));
assertThat(serverTestInstance.getSearchTotal(), equalTo(clientInstance.getSearchTotal())); assertThat(serverTestInstance.getSearchTotal(), equalTo(clientInstance.getSearchTotal()));

View File

@ -74,7 +74,10 @@ The description of the {transform}.
(Default) (Default)
include::{docdir}/rest-api/common-parms.asciidoc[tag=dest-index] include::{docdir}/rest-api/common-parms.asciidoc[tag=dest-index]
`document_total`, `dt`::: `documents_indexed`, `doci`:::
include::{docdir}/rest-api/common-parms.asciidoc[tag=docs-indexed]
`documents_processed`, `docp`:::
include::{docdir}/rest-api/common-parms.asciidoc[tag=docs-processed] include::{docdir}/rest-api/common-parms.asciidoc[tag=docs-processed]
`frequency`, `f`::: `frequency`, `f`:::
@ -97,14 +100,11 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=index-total]
`indexed_documents_exp_avg`, `idea`::: `indexed_documents_exp_avg`, `idea`:::
include::{docdir}/rest-api/common-parms.asciidoc[tag=exponential-avg-documents-indexed] include::{docdir}/rest-api/common-parms.asciidoc[tag=exponential-avg-documents-indexed]
`invocation_total`, `itotal`:::
include::{docdir}/rest-api/common-parms.asciidoc[tag=trigger-count]
`max_page_search_size`, `mpsz`::: `max_page_search_size`, `mpsz`:::
(Default) (Default)
include::{docdir}/rest-api/common-parms.asciidoc[tag=pivot-max-page-search-size] include::{docdir}/rest-api/common-parms.asciidoc[tag=pivot-max-page-search-size]
`page_total`, `pt`::: `pages_processed`, `pp`:::
include::{docdir}/rest-api/common-parms.asciidoc[tag=pages-processed] include::{docdir}/rest-api/common-parms.asciidoc[tag=pages-processed]
`pipeline`, `p`::: `pipeline`, `p`:::
@ -114,6 +114,9 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=dest-pipeline]
`processed_documents_exp_avg`, `pdea`::: `processed_documents_exp_avg`, `pdea`:::
include::{docdir}/rest-api/common-parms.asciidoc[tag=exponential-avg-documents-processed] include::{docdir}/rest-api/common-parms.asciidoc[tag=exponential-avg-documents-processed]
`processing_time`, `pt`:::
The total time spent processing documents.
`reason`, `r`::: `reason`, `r`:::
include::{docdir}/rest-api/common-parms.asciidoc[tag=state-transform-reason] include::{docdir}/rest-api/common-parms.asciidoc[tag=state-transform-reason]
@ -138,6 +141,9 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=state-transform]
(Default) (Default)
Indicates the type of {transform}: `batch` or `continuous`. Indicates the type of {transform}: `batch` or `continuous`.
`trigger_count`, `tc`:::
include::{docdir}/rest-api/common-parms.asciidoc[tag=trigger-count]
`version`, `v`::: `version`, `v`:::
(Default) (Default)
The version of {es} that existed on the node when the {transform} was The version of {es} that existed on the node when the {transform} was

View File

@ -192,6 +192,11 @@ is based on Lucene documents. {es} reclaims the disk space of deleted Lucene
documents when a segment is merged. documents when a segment is merged.
end::docs-deleted[] end::docs-deleted[]
tag::docs-indexed[]
The number of documents that have been indexed into the destination index
for the {transform}.
end::docs-indexed[]
tag::docs-processed[] tag::docs-processed[]
The number of documents that have been processed from the source index of The number of documents that have been processed from the source index of
the {transform}. the {transform}.

View File

@ -137,8 +137,8 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=state-transform]
`stats`:: `stats`::
(object) An object that provides statistical information about the {transform}. (object) An object that provides statistical information about the {transform}.
`stats`.`documents_indexed`::: `stats`.`documents_indexed`:::
(long) The number of documents that have been indexed into the destination index (long)
for the {transform}. include::{docdir}/rest-api/common-parms.asciidoc[tag=docs-indexed]
`stats`.`documents_processed`::: `stats`.`documents_processed`:::
(long) (long)
include::{docdir}/rest-api/common-parms.asciidoc[tag=docs-processed] include::{docdir}/rest-api/common-parms.asciidoc[tag=docs-processed]

View File

@ -64,10 +64,10 @@ teardown:
cat.transform: cat.transform:
transform_id: "airline-transform-stats" transform_id: "airline-transform-stats"
v: true v: true
h: id,version,source_index,dest_index,search_total,index_total,dt,cdtea,indexed_documents_exp_avg h: id,version,source_index,dest_index,search_total,index_total,docp,cdtea,indexed_documents_exp_avg
- match: - match:
$body: | $body: |
/^ id \s+ version \s+ source_index \s+ dest_index \s+ search_total \s+ index_total \s+ dt \s+ cdtea \s+ indexed_documents_exp_avg \n /^ id \s+ version \s+ source_index \s+ dest_index \s+ search_total \s+ index_total \s+ docp \s+ cdtea \s+ indexed_documents_exp_avg \n
(airline\-transform-stats \s+ [^\s]+ \s+ airline-data \s+ airline-data-by-airline \s+ 0 \s+ 0 \s+ 0 \s+ 0.0 \s+ 0.0 \n)+ $/ (airline\-transform-stats \s+ [^\s]+ \s+ airline-data \s+ airline-data-by-airline \s+ 0 \s+ 0 \s+ 0 \s+ 0.0 \s+ 0.0 \n)+ $/

View File

@ -109,7 +109,7 @@ public class TransformIT extends TransformIntegTestCase {
waitUntilCheckpoint(config.getId(), 1L); waitUntilCheckpoint(config.getId(), 1L);
assertThat(getTransformStats(config.getId()).getTransformsStats().get(0).getState(), equalTo(TransformStats.State.STARTED)); assertThat(getTransformStats(config.getId()).getTransformsStats().get(0).getState(), equalTo(TransformStats.State.STARTED));
long docsIndexed = getTransformStats(config.getId()).getTransformsStats().get(0).getIndexerStats().getNumDocuments(); long docsIndexed = getTransformStats(config.getId()).getTransformsStats().get(0).getIndexerStats().getDocumentsIndexed();
TransformConfig storedConfig = getTransform(config.getId()).getTransformConfigurations().get(0); TransformConfig storedConfig = getTransform(config.getId()).getTransformConfigurations().get(0);
assertThat(storedConfig.getVersion(), equalTo(Version.CURRENT)); assertThat(storedConfig.getVersion(), equalTo(Version.CURRENT));
@ -124,7 +124,7 @@ public class TransformIT extends TransformIntegTestCase {
// Assert that we wrote the new docs // Assert that we wrote the new docs
assertThat( assertThat(
getTransformStats(config.getId()).getTransformsStats().get(0).getIndexerStats().getNumDocuments(), getTransformStats(config.getId()).getTransformsStats().get(0).getIndexerStats().getDocumentsIndexed(),
greaterThan(docsIndexed) greaterThan(docsIndexed)
); );
@ -158,7 +158,7 @@ public class TransformIT extends TransformIntegTestCase {
oneOf(TransformStats.State.STARTED, TransformStats.State.INDEXING) oneOf(TransformStats.State.STARTED, TransformStats.State.INDEXING)
); );
long docsIndexed = getTransformStats(config.getId()).getTransformsStats().get(0).getIndexerStats().getNumDocuments(); long docsIndexed = getTransformStats(config.getId()).getTransformsStats().get(0).getIndexerStats().getDocumentsIndexed();
TransformConfig storedConfig = getTransform(config.getId()).getTransformConfigurations().get(0); TransformConfig storedConfig = getTransform(config.getId()).getTransformConfigurations().get(0);
assertThat(storedConfig.getVersion(), equalTo(Version.CURRENT)); assertThat(storedConfig.getVersion(), equalTo(Version.CURRENT));
@ -197,7 +197,7 @@ public class TransformIT extends TransformIntegTestCase {
// Since updates are loaded on checkpoint start, we should see the updated config on this next run // Since updates are loaded on checkpoint start, we should see the updated config on this next run
waitUntilCheckpoint(config.getId(), 2L); waitUntilCheckpoint(config.getId(), 2L);
long numDocsAfterCp2 = getTransformStats(config.getId()).getTransformsStats().get(0).getIndexerStats().getNumDocuments(); long numDocsAfterCp2 = getTransformStats(config.getId()).getTransformsStats().get(0).getIndexerStats().getDocumentsIndexed();
assertThat(numDocsAfterCp2, greaterThan(docsIndexed)); assertThat(numDocsAfterCp2, greaterThan(docsIndexed));
final SearchRequest searchRequest = new SearchRequest(dest).source( final SearchRequest searchRequest = new SearchRequest(dest).source(
@ -251,7 +251,7 @@ public class TransformIT extends TransformIntegTestCase {
assertBusy(() -> { assertBusy(() -> {
TransformStats stateAndStats = getTransformStats(config.getId()).getTransformsStats().get(0); TransformStats stateAndStats = getTransformStats(config.getId()).getTransformsStats().get(0);
assertThat(stateAndStats.getState(), equalTo(TransformStats.State.STOPPED)); assertThat(stateAndStats.getState(), equalTo(TransformStats.State.STOPPED));
assertThat(stateAndStats.getIndexerStats().getNumDocuments(), equalTo(1000L)); assertThat(stateAndStats.getIndexerStats().getDocumentsIndexed(), equalTo(1000L));
}); });
stopTransform(config.getId()); stopTransform(config.getId());

View File

@ -138,7 +138,7 @@ public class RestCatTransformAction extends AbstractCatAction {
.setAliases("f") .setAliases("f")
.build()) .build())
.addCell("max_page_search_size", .addCell("max_page_search_size",
TableColumnAttributeBuilder.builder("max page search size ") TableColumnAttributeBuilder.builder("max page search size")
.setAliases("mpsz") .setAliases("mpsz")
.build()) .build())
@ -149,7 +149,7 @@ public class RestCatTransformAction extends AbstractCatAction {
.setTextAlignment(TableColumnAttributeBuilder.TextAlign.RIGHT) .setTextAlignment(TableColumnAttributeBuilder.TextAlign.RIGHT)
.build()) .build())
.addCell("reason", .addCell("reason",
TableColumnAttributeBuilder.builder("reason", false) TableColumnAttributeBuilder.builder("reason for the current state", false)
.setAliases("r", "reason") .setAliases("r", "reason")
.build()) .build())
.addCell("changes_last_detection_time", .addCell("changes_last_detection_time",
@ -157,7 +157,7 @@ public class RestCatTransformAction extends AbstractCatAction {
.setAliases("cldt") .setAliases("cldt")
.build()) .build())
.addCell("search_total", .addCell("search_total",
TableColumnAttributeBuilder.builder("total number of searches", false) TableColumnAttributeBuilder.builder("total number of search phases", false)
.setAliases("st") .setAliases("st")
.build()) .build())
.addCell("search_failure", .addCell("search_failure",
@ -165,11 +165,11 @@ public class RestCatTransformAction extends AbstractCatAction {
.setAliases("sf") .setAliases("sf")
.build()) .build())
.addCell("search_time", .addCell("search_time",
TableColumnAttributeBuilder.builder("search time", false) TableColumnAttributeBuilder.builder("total search time", false)
.setAliases("stime") .setAliases("stime")
.build()) .build())
.addCell("index_total", .addCell("index_total",
TableColumnAttributeBuilder.builder("total number of indices", false) TableColumnAttributeBuilder.builder("total number of index phases done by the transform", false)
.setAliases("it") .setAliases("it")
.build()) .build())
.addCell("index_failure", .addCell("index_failure",
@ -177,19 +177,29 @@ public class RestCatTransformAction extends AbstractCatAction {
.setAliases("if") .setAliases("if")
.build()) .build())
.addCell("index_time", .addCell("index_time",
TableColumnAttributeBuilder.builder("index time", false) TableColumnAttributeBuilder.builder("total time spent indexing documents", false)
.setAliases("itime") .setAliases("itime")
.build()) .build())
.addCell("document_total", .addCell("documents_processed",
TableColumnAttributeBuilder.builder("total number of documents", false) TableColumnAttributeBuilder.builder("the number of documents read from source indices and processed",
.setAliases("dt") false)
.setAliases("docp")
.build()) .build())
.addCell("invocation_total", .addCell("documents_indexed",
TableColumnAttributeBuilder.builder("total number of invocations", false) TableColumnAttributeBuilder.builder("the number of documents index to the destination index",
.setAliases("itotal") false)
.setAliases("doci")
.build()) .build())
.addCell("page_total", .addCell("trigger_count",
TableColumnAttributeBuilder.builder("total number of pages", false) TableColumnAttributeBuilder.builder("the number of times the transform has been triggered", false)
.setAliases("tc")
.build())
.addCell("pages_processed",
TableColumnAttributeBuilder.builder("the number of pages processed", false)
.setAliases("pp")
.build())
.addCell("processing_time",
TableColumnAttributeBuilder.builder("the total time spent processing documents", false)
.setAliases("pt") .setAliases("pt")
.build()) .build())
.addCell("checkpoint_duration_time_exp_avg", .addCell("checkpoint_duration_time_exp_avg",
@ -246,8 +256,10 @@ public class RestCatTransformAction extends AbstractCatAction {
.addCell(transformIndexerStats == null ? null : TimeValue.timeValueMillis(transformIndexerStats.getIndexTime())) .addCell(transformIndexerStats == null ? null : TimeValue.timeValueMillis(transformIndexerStats.getIndexTime()))
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getNumDocuments()) .addCell(transformIndexerStats == null ? null : transformIndexerStats.getNumDocuments())
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getOutputDocuments())
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getNumInvocations()) .addCell(transformIndexerStats == null ? null : transformIndexerStats.getNumInvocations())
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getNumPages()) .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.getExpAvgCheckpointDurationMs())
.addCell(transformIndexerStats == null ? null : transformIndexerStats.getExpAvgDocumentsIndexed()) .addCell(transformIndexerStats == null ? null : transformIndexerStats.getExpAvgDocumentsIndexed())

View File

@ -197,8 +197,8 @@ public class TransformSurvivesUpgradeIT extends AbstractUpgradeTestCase {
assertBusy(() -> { assertBusy(() -> {
TransformStats stateAndStats = getTransformStats(CONTINUOUS_TRANSFORM_ID); TransformStats stateAndStats = getTransformStats(CONTINUOUS_TRANSFORM_ID);
assertThat(stateAndStats.getIndexerStats().getOutputDocuments(), equalTo((long)ENTITIES.size())); assertThat(stateAndStats.getIndexerStats().getDocumentsIndexed(), equalTo((long)ENTITIES.size()));
assertThat(stateAndStats.getIndexerStats().getNumDocuments(), equalTo(totalDocsWritten)); assertThat(stateAndStats.getIndexerStats().getDocumentsProcessed(), equalTo(totalDocsWritten));
// Even if we get back to started, we may periodically get set back to `indexing` when triggered. // Even if we get back to started, we may periodically get set back to `indexing` when triggered.
// Though short lived due to no changes on the source indices, it could result in flaky test behavior // Though short lived due to no changes on the source indices, it could result in flaky test behavior
assertThat(stateAndStats.getState(), oneOf(TransformStats.State.STARTED, TransformStats.State.INDEXING)); assertThat(stateAndStats.getState(), oneOf(TransformStats.State.STARTED, TransformStats.State.INDEXING));
@ -236,8 +236,8 @@ public class TransformSurvivesUpgradeIT extends AbstractUpgradeTestCase {
waitUntilAfterCheckpoint(CONTINUOUS_TRANSFORM_ID, expectedLastCheckpoint); waitUntilAfterCheckpoint(CONTINUOUS_TRANSFORM_ID, expectedLastCheckpoint);
assertBusy(() -> assertThat( assertBusy(() -> assertThat(
getTransformStats(CONTINUOUS_TRANSFORM_ID).getIndexerStats().getNumDocuments(), getTransformStats(CONTINUOUS_TRANSFORM_ID).getIndexerStats().getDocumentsProcessed(),
greaterThanOrEqualTo(docs + previousStateAndStats.getIndexerStats().getNumDocuments())), greaterThanOrEqualTo(docs + previousStateAndStats.getIndexerStats().getDocumentsProcessed())),
120, 120,
TimeUnit.SECONDS); TimeUnit.SECONDS);
TransformStats stateAndStats = getTransformStats(CONTINUOUS_TRANSFORM_ID); TransformStats stateAndStats = getTransformStats(CONTINUOUS_TRANSFORM_ID);
@ -249,9 +249,9 @@ public class TransformSurvivesUpgradeIT extends AbstractUpgradeTestCase {
responseBody)) responseBody))
.get(0); .get(0);
assertThat((Integer)indexerStats.get("documents_indexed"), assertThat((Integer)indexerStats.get("documents_indexed"),
greaterThan(Long.valueOf(previousStateAndStats.getIndexerStats().getOutputDocuments()).intValue())); greaterThan(Long.valueOf(previousStateAndStats.getIndexerStats().getDocumentsIndexed()).intValue()));
assertThat((Integer)indexerStats.get("documents_processed"), assertThat((Integer)indexerStats.get("documents_processed"),
greaterThan(Long.valueOf(previousStateAndStats.getIndexerStats().getNumDocuments()).intValue())); greaterThan(Long.valueOf(previousStateAndStats.getIndexerStats().getDocumentsProcessed()).intValue()));
}); });
} }