protected Table getTableWithHeader()

in x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/cat/RestCatJobsAction.java [73:368]


    protected Table getTableWithHeader(RestRequest request) {
        Table table = new Table();
        table.startHeaders();

        // Job Info
        table.addCell("id", TableColumnAttributeBuilder.builder("the job_id").build());
        table.addCell(
            "state",
            TableColumnAttributeBuilder.builder("the job state")
                .setAliases("s")
                .setTextAlignment(TableColumnAttributeBuilder.TextAlign.RIGHT)
                .build()
        );
        table.addCell(
            "opened_time",
            TableColumnAttributeBuilder.builder("the amount of time the job has been opened", false).setAliases("ot").build()
        );
        table.addCell(
            "assignment_explanation",
            TableColumnAttributeBuilder.builder("why the job is or is not assigned to a node", false).setAliases("ae").build()
        );

        // Data Counts
        table.addCell(
            "data.processed_records",
            TableColumnAttributeBuilder.builder("number of processed records").setAliases("dpr", "dataProcessedRecords").build()
        );
        table.addCell(
            "data.processed_fields",
            TableColumnAttributeBuilder.builder("number of processed fields", false).setAliases("dpf", "dataProcessedFields").build()
        );
        table.addCell(
            "data.input_bytes",
            TableColumnAttributeBuilder.builder("total input bytes", false).setAliases("dib", "dataInputBytes").build()
        );
        table.addCell(
            "data.input_records",
            TableColumnAttributeBuilder.builder("total record count", false).setAliases("dir", "dataInputRecords").build()
        );
        table.addCell(
            "data.input_fields",
            TableColumnAttributeBuilder.builder("total field count", false).setAliases("dif", "dataInputFields").build()
        );
        table.addCell(
            "data.invalid_dates",
            TableColumnAttributeBuilder.builder("number of records with invalid dates", false).setAliases("did", "dataInvalidDates").build()
        );
        table.addCell(
            "data.missing_fields",
            TableColumnAttributeBuilder.builder("number of records with missing fields", false)
                .setAliases("dmf", "dataMissingFields")
                .build()
        );
        table.addCell(
            "data.out_of_order_timestamps",
            TableColumnAttributeBuilder.builder("number of records handled out of order", false)
                .setAliases("doot", "dataOutOfOrderTimestamps")
                .build()
        );
        table.addCell(
            "data.empty_buckets",
            TableColumnAttributeBuilder.builder("number of empty buckets", false).setAliases("deb", "dataEmptyBuckets").build()
        );
        table.addCell(
            "data.sparse_buckets",
            TableColumnAttributeBuilder.builder("number of sparse buckets", false).setAliases("dsb", "dataSparseBuckets").build()
        );
        table.addCell(
            "data.buckets",
            TableColumnAttributeBuilder.builder("total bucket count", false).setAliases("db", "dataBuckets").build()
        );
        table.addCell(
            "data.earliest_record",
            TableColumnAttributeBuilder.builder("earliest record time", false).setAliases("der", "dataEarliestRecord").build()
        );
        table.addCell(
            "data.latest_record",
            TableColumnAttributeBuilder.builder("latest record time", false).setAliases("dlr", "dataLatestRecord").build()
        );
        table.addCell(
            "data.last",
            TableColumnAttributeBuilder.builder("last time data was seen", false).setAliases("dl", "dataLast").build()
        );
        table.addCell(
            "data.last_empty_bucket",
            TableColumnAttributeBuilder.builder("last time an empty bucket occurred", false)
                .setAliases("dleb", "dataLastEmptyBucket")
                .build()
        );
        table.addCell(
            "data.last_sparse_bucket",
            TableColumnAttributeBuilder.builder("last time a sparse bucket occurred", false)
                .setAliases("dlsb", "dataLastSparseBucket")
                .build()
        );

        // Model Size stats
        table.addCell("model.bytes", TableColumnAttributeBuilder.builder("model size").setAliases("mb", "modelBytes").build());
        table.addCell(
            "model.memory_status",
            TableColumnAttributeBuilder.builder("current memory status")
                .setAliases("mms", "modelMemoryStatus")
                .setTextAlignment(TableColumnAttributeBuilder.TextAlign.RIGHT)
                .build()
        );
        table.addCell(
            "model.bytes_exceeded",
            TableColumnAttributeBuilder.builder("how much the model has exceeded the limit", false)
                .setAliases("mbe", "modelBytesExceeded")
                .build()
        );
        table.addCell(
            "model.memory_limit",
            TableColumnAttributeBuilder.builder("model memory limit", false).setAliases("mml", "modelMemoryLimit").build()
        );
        table.addCell(
            "model.by_fields",
            TableColumnAttributeBuilder.builder("count of 'by' fields", false).setAliases("mbf", "modelByFields").build()
        );
        table.addCell(
            "model.over_fields",
            TableColumnAttributeBuilder.builder("count of 'over' fields", false).setAliases("mof", "modelOverFields").build()
        );
        table.addCell(
            "model.partition_fields",
            TableColumnAttributeBuilder.builder("count of 'partition' fields", false).setAliases("mpf", "modelPartitionFields").build()
        );
        table.addCell(
            "model.bucket_allocation_failures",
            TableColumnAttributeBuilder.builder("number of bucket allocation failures", false)
                .setAliases("mbaf", "modelBucketAllocationFailures")
                .build()
        );
        table.addCell(
            "model.output_memory_allocator_bytes",
            TableColumnAttributeBuilder.builder("how many bytes have been used to output the model documents", false)
                .setAliases("momab", "modelOutputMemoryAllocatorBytes")
                .build()
        );
        table.addCell(
            "model.categorization_status",
            TableColumnAttributeBuilder.builder("current categorization status", false)
                .setAliases("mcs", "modelCategorizationStatus")
                .setTextAlignment(TableColumnAttributeBuilder.TextAlign.RIGHT)
                .build()
        );
        table.addCell(
            "model.categorized_doc_count",
            TableColumnAttributeBuilder.builder("count of categorized documents", false)
                .setAliases("mcdc", "modelCategorizedDocCount")
                .build()
        );
        table.addCell(
            "model.total_category_count",
            TableColumnAttributeBuilder.builder("count of categories", false).setAliases("mtcc", "modelTotalCategoryCount").build()
        );
        table.addCell(
            "model.frequent_category_count",
            TableColumnAttributeBuilder.builder("count of frequent categories", false)
                .setAliases("mfcc", "modelFrequentCategoryCount")
                .build()
        );
        table.addCell(
            "model.rare_category_count",
            TableColumnAttributeBuilder.builder("count of rare categories", false).setAliases("mrcc", "modelRareCategoryCount").build()
        );
        table.addCell(
            "model.dead_category_count",
            TableColumnAttributeBuilder.builder("count of dead categories", false).setAliases("mdcc", "modelDeadCategoryCount").build()
        );
        table.addCell(
            "model.failed_category_count",
            TableColumnAttributeBuilder.builder("count of failed categories", false).setAliases("mfcc", "modelFailedCategoryCount").build()
        );
        table.addCell(
            "model.log_time",
            TableColumnAttributeBuilder.builder("when the model stats were gathered", false).setAliases("mlt", "modelLogTime").build()
        );
        table.addCell(
            "model.timestamp",
            TableColumnAttributeBuilder.builder("the time of the last record when the model stats were gathered", false)
                .setAliases("mt", "modelTimestamp")
                .build()
        );

        // Forecast Stats
        table.addCell(
            "forecasts." + ForecastStats.Fields.TOTAL,
            TableColumnAttributeBuilder.builder("total number of forecasts").setAliases("ft", "forecastsTotal").build()
        );
        table.addCell(
            "forecasts.memory.min",
            TableColumnAttributeBuilder.builder("minimum memory used by forecasts", false).setAliases("fmmin", "forecastsMemoryMin").build()
        );
        table.addCell(
            "forecasts.memory.max",
            TableColumnAttributeBuilder.builder("maximum memory used by forecasts", false).setAliases("fmmax", "forecastsMemoryMax").build()
        );
        table.addCell(
            "forecasts.memory.avg",
            TableColumnAttributeBuilder.builder("average memory used by forecasts", false).setAliases("fmavg", "forecastsMemoryAvg").build()
        );
        table.addCell(
            "forecasts.memory.total",
            TableColumnAttributeBuilder.builder("total memory used by all forecasts", false)
                .setAliases("fmt", "forecastsMemoryTotal")
                .build()
        );
        table.addCell(
            "forecasts." + ForecastStats.Fields.RECORDS + ".min",
            TableColumnAttributeBuilder.builder("minimum record count for forecasts", false)
                .setAliases("frmin", "forecastsRecordsMin")
                .build()
        );
        table.addCell(
            "forecasts." + ForecastStats.Fields.RECORDS + ".max",
            TableColumnAttributeBuilder.builder("maximum record count for forecasts", false)
                .setAliases("frmax", "forecastsRecordsMax")
                .build()
        );
        table.addCell(
            "forecasts." + ForecastStats.Fields.RECORDS + ".avg",
            TableColumnAttributeBuilder.builder("average record count for forecasts", false)
                .setAliases("fravg", "forecastsRecordsAvg")
                .build()
        );
        table.addCell(
            "forecasts." + ForecastStats.Fields.RECORDS + ".total",
            TableColumnAttributeBuilder.builder("total record count for all forecasts", false)
                .setAliases("frt", "forecastsRecordsTotal")
                .build()
        );
        table.addCell(
            "forecasts.time.min",
            TableColumnAttributeBuilder.builder("minimum runtime for forecasts", false).setAliases("ftmin", "forecastsTimeMin").build()
        );
        table.addCell(
            "forecasts.time.max",
            TableColumnAttributeBuilder.builder("maximum run time for forecasts", false).setAliases("ftmax", "forecastsTimeMax").build()
        );
        table.addCell(
            "forecasts.time.avg",
            TableColumnAttributeBuilder.builder("average runtime for all forecasts (milliseconds)", false)
                .setAliases("ftavg", "forecastsTimeAvg")
                .build()
        );
        table.addCell(
            "forecasts.time.total",
            TableColumnAttributeBuilder.builder("total runtime for all forecasts", false).setAliases("ftt", "forecastsTimeTotal").build()
        );

        // Node info
        table.addCell("node.id", TableColumnAttributeBuilder.builder("id of the assigned node", false).setAliases("ni", "nodeId").build());
        table.addCell(
            "node.name",
            TableColumnAttributeBuilder.builder("name of the assigned node", false).setAliases("nn", "nodeName").build()
        );
        table.addCell(
            "node.ephemeral_id",
            TableColumnAttributeBuilder.builder("ephemeral id of the assigned node", false).setAliases("ne", "nodeEphemeralId").build()
        );
        table.addCell(
            "node.address",
            TableColumnAttributeBuilder.builder("network address of the assigned node", false).setAliases("na", "nodeAddress").build()
        );

        // Timing Stats
        table.addCell("buckets.count", TableColumnAttributeBuilder.builder("bucket count").setAliases("bc", "bucketsCount").build());
        table.addCell(
            "buckets.time.total",
            TableColumnAttributeBuilder.builder("total bucket processing time", false).setAliases("btt", "bucketsTimeTotal").build()
        );
        table.addCell(
            "buckets.time.min",
            TableColumnAttributeBuilder.builder("minimum bucket processing time", false).setAliases("btmin", "bucketsTimeMin").build()
        );
        table.addCell(
            "buckets.time.max",
            TableColumnAttributeBuilder.builder("maximum bucket processing time", false).setAliases("btmax", "bucketsTimeMax").build()
        );
        table.addCell(
            "buckets.time.exp_avg",
            TableColumnAttributeBuilder.builder("exponential average bucket processing time (milliseconds)", false)
                .setAliases("btea", "bucketsTimeExpAvg")
                .build()
        );
        table.addCell(
            "buckets.time.exp_avg_hour",
            TableColumnAttributeBuilder.builder("exponential average bucket processing time by hour (milliseconds)", false)
                .setAliases("bteah", "bucketsTimeExpAvgHour")
                .build()
        );

        table.endHeaders();
        return table;
    }