Chore(TSVB): Replace aggregations lookup with map (#109424) (#110022)

* Chore(TSVB): Replace aggregations lookup with map

* Fix types, update test expected data and remove unused translations

* Correct typo and refactor condition in std_metric

* Fix metric type

* Fix CI and label for Bucket Script

* Update agg_utils.test expected data

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Diana Derevyankina 2021-08-25 15:23:27 +03:00 committed by GitHub
parent abcf965ac3
commit f274289504
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 789 additions and 610 deletions

View file

@ -1,21 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { isBasicAgg } from './agg_lookup';
import { Metric } from './types';
describe('aggLookup', () => {
describe('isBasicAgg(metric)', () => {
test('returns true for a basic metric (count)', () => {
expect(isBasicAgg({ type: 'count' } as Metric)).toEqual(true);
});
test('returns false for a pipeline metric (derivative)', () => {
expect(isBasicAgg({ type: 'derivative' } as Metric)).toEqual(false);
});
});
});

View file

@ -1,122 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { omit, pick, includes } from 'lodash';
import { i18n } from '@kbn/i18n';
import { Metric } from './types';
export const lookup: Record<string, string> = {
count: i18n.translate('visTypeTimeseries.aggLookup.countLabel', { defaultMessage: 'Count' }),
calculation: i18n.translate('visTypeTimeseries.aggLookup.calculationLabel', {
defaultMessage: 'Calculation',
}),
std_deviation: i18n.translate('visTypeTimeseries.aggLookup.deviationLabel', {
defaultMessage: 'Std. Deviation',
}),
variance: i18n.translate('visTypeTimeseries.aggLookup.varianceLabel', {
defaultMessage: 'Variance',
}),
sum_of_squares: i18n.translate('visTypeTimeseries.aggLookup.sumOfSqLabel', {
defaultMessage: 'Sum of Sq.',
}),
avg: i18n.translate('visTypeTimeseries.aggLookup.averageLabel', { defaultMessage: 'Average' }),
max: i18n.translate('visTypeTimeseries.aggLookup.maxLabel', { defaultMessage: 'Max' }),
min: i18n.translate('visTypeTimeseries.aggLookup.minLabel', { defaultMessage: 'Min' }),
sum: i18n.translate('visTypeTimeseries.aggLookup.sumLabel', { defaultMessage: 'Sum' }),
percentile: i18n.translate('visTypeTimeseries.aggLookup.percentileLabel', {
defaultMessage: 'Percentile',
}),
percentile_rank: i18n.translate('visTypeTimeseries.aggLookup.percentileRankLabel', {
defaultMessage: 'Percentile Rank',
}),
cardinality: i18n.translate('visTypeTimeseries.aggLookup.cardinalityLabel', {
defaultMessage: 'Cardinality',
}),
value_count: i18n.translate('visTypeTimeseries.aggLookup.valueCountLabel', {
defaultMessage: 'Value Count',
}),
derivative: i18n.translate('visTypeTimeseries.aggLookup.derivativeLabel', {
defaultMessage: 'Derivative',
}),
cumulative_sum: i18n.translate('visTypeTimeseries.aggLookup.cumulativeSumLabel', {
defaultMessage: 'Cumulative Sum',
}),
moving_average: i18n.translate('visTypeTimeseries.aggLookup.movingAverageLabel', {
defaultMessage: 'Moving Average',
}),
avg_bucket: i18n.translate('visTypeTimeseries.aggLookup.overallAverageLabel', {
defaultMessage: 'Overall Average',
}),
min_bucket: i18n.translate('visTypeTimeseries.aggLookup.overallMinLabel', {
defaultMessage: 'Overall Min',
}),
max_bucket: i18n.translate('visTypeTimeseries.aggLookup.overallMaxLabel', {
defaultMessage: 'Overall Max',
}),
sum_bucket: i18n.translate('visTypeTimeseries.aggLookup.overallSumLabel', {
defaultMessage: 'Overall Sum',
}),
variance_bucket: i18n.translate('visTypeTimeseries.aggLookup.overallVarianceLabel', {
defaultMessage: 'Overall Variance',
}),
sum_of_squares_bucket: i18n.translate('visTypeTimeseries.aggLookup.overallSumOfSqLabel', {
defaultMessage: 'Overall Sum of Sq.',
}),
std_deviation_bucket: i18n.translate('visTypeTimeseries.aggLookup.overallStdDeviationLabel', {
defaultMessage: 'Overall Std. Deviation',
}),
series_agg: i18n.translate('visTypeTimeseries.aggLookup.seriesAggLabel', {
defaultMessage: 'Series Agg',
}),
math: i18n.translate('visTypeTimeseries.aggLookup.mathLabel', { defaultMessage: 'Math' }),
serial_diff: i18n.translate('visTypeTimeseries.aggLookup.serialDifferenceLabel', {
defaultMessage: 'Serial Difference',
}),
filter_ratio: i18n.translate('visTypeTimeseries.aggLookup.filterRatioLabel', {
defaultMessage: 'Filter Ratio',
}),
positive_only: i18n.translate('visTypeTimeseries.aggLookup.positiveOnlyLabel', {
defaultMessage: 'Positive Only',
}),
static: i18n.translate('visTypeTimeseries.aggLookup.staticValueLabel', {
defaultMessage: 'Static Value',
}),
top_hit: i18n.translate('visTypeTimeseries.aggLookup.topHitLabel', { defaultMessage: 'Top Hit' }),
positive_rate: i18n.translate('visTypeTimeseries.aggLookup.positiveRateLabel', {
defaultMessage: 'Counter Rate',
}),
};
const pipeline = [
'calculation',
'derivative',
'cumulative_sum',
'moving_average',
'avg_bucket',
'min_bucket',
'max_bucket',
'sum_bucket',
'variance_bucket',
'sum_of_squares_bucket',
'std_deviation_bucket',
'series_agg',
'math',
'serial_diff',
'positive_only',
];
const byType = {
_all: lookup,
pipeline,
basic: omit(lookup, pipeline),
metrics: pick(lookup, ['count', 'avg', 'min', 'max', 'sum', 'cardinality', 'value_count']),
};
export function isBasicAgg(item: Metric) {
return includes(Object.keys(byType.basic), item.type);
}

View file

@ -0,0 +1,187 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import {
getMetricLabel,
isBasicAgg,
getAggByPredicate,
getAggsByPredicate,
getAggsByType,
} from './agg_utils';
import { METRIC_TYPES } from '../../data/common';
import { TSVB_METRIC_TYPES } from './enums';
import type { Metric } from './types';
describe('agg utils', () => {
describe('isBasicAgg(metric)', () => {
it('returns true for a basic metric (count)', () => {
expect(isBasicAgg({ type: 'count' } as Metric)).toEqual(true);
});
it('returns false for a pipeline metric (derivative)', () => {
expect(isBasicAgg({ type: 'derivative' } as Metric)).toEqual(false);
});
});
describe('getMetricLabel(metricType)', () => {
it('should return "Cumulative Sum" for METRIC_TYPES.CUMULATIVE_SUM', () => {
const label = getMetricLabel(METRIC_TYPES.CUMULATIVE_SUM);
expect(label).toBe('Cumulative Sum');
});
it('should return "Static Value" for TSVB_METRIC_TYPES.STATIC', () => {
const label = getMetricLabel(TSVB_METRIC_TYPES.STATIC);
expect(label).toBe('Static Value');
});
});
describe('getAggByPredicate(metricType, metaPredicate)', () => {
it('should be falsy for METRIC_TYPES.SUM with { hasExtendedStats: true } meta predicate', () => {
const actual = getAggByPredicate(METRIC_TYPES.SUM, { hasExtendedStats: true });
expect(actual).toBeFalsy();
});
it('should be truthy for TSVB_METRIC_TYPES.SUM_OF_SQUARES with { hasExtendedStats: true } meta predicate', () => {
const actual = getAggByPredicate(TSVB_METRIC_TYPES.SUM_OF_SQUARES, {
hasExtendedStats: true,
});
expect(actual).toBeTruthy();
});
});
describe('getAggsByPredicate(predicate)', () => {
it('should return actual array of aggs with { meta: { hasExtendedStats: true } } predicate', () => {
const commonProperties = {
type: 'metric',
isFieldRequired: true,
isFilterRatioSupported: false,
isHistogramSupported: false,
hasExtendedStats: true,
};
const expected = [
{
id: TSVB_METRIC_TYPES.STD_DEVIATION,
meta: {
label: 'Std. Deviation',
...commonProperties,
},
},
{
id: TSVB_METRIC_TYPES.SUM_OF_SQUARES,
meta: {
label: 'Sum of Squares',
...commonProperties,
},
},
{
id: TSVB_METRIC_TYPES.VARIANCE,
meta: {
label: 'Variance',
...commonProperties,
},
},
];
const actual = getAggsByPredicate({ meta: { hasExtendedStats: true } });
expect(actual).toEqual(expected);
});
it('should return actual array of aggs with { meta: { isFieldRequired: false } } predicate', () => {
const commonProperties = {
isFieldRequired: false,
isFilterRatioSupported: false,
isHistogramSupported: false,
hasExtendedStats: false,
};
const expected = [
{
id: METRIC_TYPES.COUNT,
meta: {
type: 'metric',
label: 'Count',
...commonProperties,
isFilterRatioSupported: true,
isHistogramSupported: true,
},
},
{
id: TSVB_METRIC_TYPES.FILTER_RATIO,
meta: {
type: 'metric',
label: 'Filter Ratio',
...commonProperties,
},
},
{
id: TSVB_METRIC_TYPES.STATIC,
meta: {
type: 'metric',
label: 'Static Value',
...commonProperties,
},
},
{
id: TSVB_METRIC_TYPES.SERIES_AGG,
meta: {
type: 'special',
label: 'Series Agg',
...commonProperties,
},
},
];
const actual = getAggsByPredicate({ meta: { isFieldRequired: false } });
expect(actual).toEqual(expected);
});
});
describe('getAggsByType(mapFn)', () => {
it('should return object with actual aggs labels separated by type', () => {
const expected = {
metric: [
'Average',
'Cardinality',
'Count',
'Filter Ratio',
'Counter Rate',
'Max',
'Min',
'Percentile',
'Percentile Rank',
'Static Value',
'Std. Deviation',
'Sum',
'Sum of Squares',
'Top Hit',
'Value Count',
'Variance',
],
parent_pipeline: [
'Bucket Script',
'Cumulative Sum',
'Derivative',
'Moving Average',
'Positive Only',
'Serial Difference',
],
sibling_pipeline: [
'Overall Average',
'Overall Max',
'Overall Min',
'Overall Std. Deviation',
'Overall Sum',
'Overall Sum of Squares',
'Overall Variance',
],
special: ['Series Agg', 'Math'],
};
const actual = getAggsByType((agg) => agg.meta.label);
expect(actual).toEqual(expected);
});
});
});

View file

@ -0,0 +1,382 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { i18n } from '@kbn/i18n';
import { filter } from 'lodash';
import { Assign } from 'utility-types';
import { METRIC_TYPES } from '../../data/common';
import { TSVB_METRIC_TYPES } from './enums';
import type { Metric, MetricType } from './types';
export enum AGG_TYPE {
METRIC = 'metric',
PARENT_PIPELINE = 'parent_pipeline',
SIBLING_PIPELINE = 'sibling_pipeline',
SPECIAL = 'special',
}
export interface Agg {
id: MetricType;
meta: {
type: AGG_TYPE;
label: string;
isFieldRequired: boolean;
isFilterRatioSupported: boolean;
isHistogramSupported: boolean;
hasExtendedStats: boolean;
};
}
const aggDefaultMeta = {
type: AGG_TYPE.METRIC,
isFieldRequired: true,
isFilterRatioSupported: false,
isHistogramSupported: false,
hasExtendedStats: false,
};
export const aggs: Agg[] = [
{
id: METRIC_TYPES.AVG,
meta: {
...aggDefaultMeta,
isFilterRatioSupported: true,
isHistogramSupported: true,
label: i18n.translate('visTypeTimeseries.aggUtils.averageLabel', {
defaultMessage: 'Average',
}),
},
},
{
id: METRIC_TYPES.CARDINALITY,
meta: {
...aggDefaultMeta,
isFilterRatioSupported: true,
label: i18n.translate('visTypeTimeseries.aggUtils.cardinalityLabel', {
defaultMessage: 'Cardinality',
}),
},
},
{
id: METRIC_TYPES.COUNT,
meta: {
...aggDefaultMeta,
isFieldRequired: false,
isFilterRatioSupported: true,
isHistogramSupported: true,
label: i18n.translate('visTypeTimeseries.aggUtils.countLabel', { defaultMessage: 'Count' }),
},
},
{
id: TSVB_METRIC_TYPES.FILTER_RATIO,
meta: {
...aggDefaultMeta,
isFieldRequired: false,
label: i18n.translate('visTypeTimeseries.aggUtils.filterRatioLabel', {
defaultMessage: 'Filter Ratio',
}),
},
},
{
id: TSVB_METRIC_TYPES.POSITIVE_RATE,
meta: {
...aggDefaultMeta,
isFilterRatioSupported: true,
label: i18n.translate('visTypeTimeseries.aggUtils.positiveRateLabel', {
defaultMessage: 'Counter Rate',
}),
},
},
{
id: METRIC_TYPES.MAX,
meta: {
...aggDefaultMeta,
isFilterRatioSupported: true,
isHistogramSupported: true,
label: i18n.translate('visTypeTimeseries.aggUtils.maxLabel', { defaultMessage: 'Max' }),
},
},
{
id: METRIC_TYPES.MIN,
meta: {
...aggDefaultMeta,
isFilterRatioSupported: true,
isHistogramSupported: true,
label: i18n.translate('visTypeTimeseries.aggUtils.minLabel', { defaultMessage: 'Min' }),
},
},
{
id: TSVB_METRIC_TYPES.PERCENTILE,
meta: {
...aggDefaultMeta,
label: i18n.translate('visTypeTimeseries.aggUtils.percentileLabel', {
defaultMessage: 'Percentile',
}),
},
},
{
id: TSVB_METRIC_TYPES.PERCENTILE_RANK,
meta: {
...aggDefaultMeta,
label: i18n.translate('visTypeTimeseries.aggUtils.percentileRankLabel', {
defaultMessage: 'Percentile Rank',
}),
},
},
{
id: TSVB_METRIC_TYPES.STATIC,
meta: {
...aggDefaultMeta,
isFieldRequired: false,
label: i18n.translate('visTypeTimeseries.aggUtils.staticValueLabel', {
defaultMessage: 'Static Value',
}),
},
},
{
id: TSVB_METRIC_TYPES.STD_DEVIATION,
meta: {
...aggDefaultMeta,
hasExtendedStats: true,
label: i18n.translate('visTypeTimeseries.aggUtils.deviationLabel', {
defaultMessage: 'Std. Deviation',
}),
},
},
{
id: METRIC_TYPES.SUM,
meta: {
...aggDefaultMeta,
isFilterRatioSupported: true,
isHistogramSupported: true,
label: i18n.translate('visTypeTimeseries.aggUtils.sumLabel', { defaultMessage: 'Sum' }),
},
},
{
id: TSVB_METRIC_TYPES.SUM_OF_SQUARES,
meta: {
...aggDefaultMeta,
hasExtendedStats: true,
label: i18n.translate('visTypeTimeseries.aggUtils.sumOfSquaresLabel', {
defaultMessage: 'Sum of Squares',
}),
},
},
{
id: TSVB_METRIC_TYPES.TOP_HIT,
meta: {
...aggDefaultMeta,
label: i18n.translate('visTypeTimeseries.aggUtils.topHitLabel', {
defaultMessage: 'Top Hit',
}),
},
},
{
id: TSVB_METRIC_TYPES.VALUE_COUNT,
meta: {
...aggDefaultMeta,
isFilterRatioSupported: true,
isHistogramSupported: true,
label: i18n.translate('visTypeTimeseries.aggUtils.valueCountLabel', {
defaultMessage: 'Value Count',
}),
},
},
{
id: TSVB_METRIC_TYPES.VARIANCE,
meta: {
...aggDefaultMeta,
hasExtendedStats: true,
label: i18n.translate('visTypeTimeseries.aggUtils.varianceLabel', {
defaultMessage: 'Variance',
}),
},
},
{
id: TSVB_METRIC_TYPES.CALCULATION,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.PARENT_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.bucketScriptLabel', {
defaultMessage: 'Bucket Script',
}),
},
},
{
id: METRIC_TYPES.CUMULATIVE_SUM,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.PARENT_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.cumulativeSumLabel', {
defaultMessage: 'Cumulative Sum',
}),
},
},
{
id: METRIC_TYPES.DERIVATIVE,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.PARENT_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.derivativeLabel', {
defaultMessage: 'Derivative',
}),
},
},
{
id: TSVB_METRIC_TYPES.MOVING_AVERAGE,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.PARENT_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.movingAverageLabel', {
defaultMessage: 'Moving Average',
}),
},
},
{
id: TSVB_METRIC_TYPES.POSITIVE_ONLY,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.PARENT_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.positiveOnlyLabel', {
defaultMessage: 'Positive Only',
}),
},
},
{
id: METRIC_TYPES.SERIAL_DIFF,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.PARENT_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.serialDifferenceLabel', {
defaultMessage: 'Serial Difference',
}),
},
},
{
id: METRIC_TYPES.AVG_BUCKET,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.SIBLING_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.overallAverageLabel', {
defaultMessage: 'Overall Average',
}),
},
},
{
id: METRIC_TYPES.MAX_BUCKET,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.SIBLING_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.overallMaxLabel', {
defaultMessage: 'Overall Max',
}),
},
},
{
id: METRIC_TYPES.MIN_BUCKET,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.SIBLING_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.overallMinLabel', {
defaultMessage: 'Overall Min',
}),
},
},
{
id: TSVB_METRIC_TYPES.STD_DEVIATION_BUCKET,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.SIBLING_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.overallStdDeviationLabel', {
defaultMessage: 'Overall Std. Deviation',
}),
},
},
{
id: METRIC_TYPES.SUM_BUCKET,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.SIBLING_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.overallSumLabel', {
defaultMessage: 'Overall Sum',
}),
},
},
{
id: TSVB_METRIC_TYPES.SUM_OF_SQUARES_BUCKET,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.SIBLING_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.overallSumOfSquaresLabel', {
defaultMessage: 'Overall Sum of Squares',
}),
},
},
{
id: TSVB_METRIC_TYPES.VARIANCE_BUCKET,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.SIBLING_PIPELINE,
label: i18n.translate('visTypeTimeseries.aggUtils.overallVarianceLabel', {
defaultMessage: 'Overall Variance',
}),
},
},
{
id: TSVB_METRIC_TYPES.SERIES_AGG,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.SPECIAL,
isFieldRequired: false,
label: i18n.translate('visTypeTimeseries.aggUtils.seriesAggLabel', {
defaultMessage: 'Series Agg',
}),
},
},
{
id: TSVB_METRIC_TYPES.MATH,
meta: {
...aggDefaultMeta,
type: AGG_TYPE.SPECIAL,
label: i18n.translate('visTypeTimeseries.aggUtils.mathLabel', { defaultMessage: 'Math' }),
},
},
];
export const getAggsByPredicate = (
predicate: Assign<Partial<Agg>, { meta?: Partial<Agg['meta']> }>
) => filter(aggs, predicate) as Agg[];
export const getAggByPredicate = (metricType: MetricType, metaPredicate?: Partial<Agg['meta']>) => {
const predicate = {
id: metricType,
...(metaPredicate && {
meta: metaPredicate,
}),
};
return getAggsByPredicate(predicate)[0];
};
export const getMetricLabel = (metricType: MetricType) => getAggByPredicate(metricType)?.meta.label;
export const isBasicAgg = (metric: Metric) =>
Boolean(getAggByPredicate(metric.type, { type: AGG_TYPE.METRIC }));
export const getAggsByType = <TMapValue = unknown>(mapFn: (agg: Agg) => TMapValue) =>
aggs.reduce(
(acc, agg) => {
acc[agg.meta.type].push(mapFn(agg));
return acc;
},
{
[AGG_TYPE.METRIC]: [],
[AGG_TYPE.PARENT_PIPELINE]: [],
[AGG_TYPE.SIBLING_PIPELINE]: [],
[AGG_TYPE.SPECIAL]: [],
} as Record<AGG_TYPE, TMapValue[]>
);

View file

@ -8,9 +8,11 @@
import { includes, startsWith } from 'lodash';
import { i18n } from '@kbn/i18n';
import { lookup } from './agg_lookup';
import { Metric, SanitizedFieldType } from './types';
import { getMetricLabel } from './agg_utils';
import { extractFieldLabel } from './fields_utils';
import { METRIC_TYPES } from '../../data/common';
import { TSVB_METRIC_TYPES } from './enums';
import type { Metric, SanitizedFieldType } from './types';
const paths = [
'cumulative_sum',
@ -42,43 +44,42 @@ export const calculateLabel = (
return metric.alias;
}
if (metric.type === 'count') {
return i18n.translate('visTypeTimeseries.calculateLabel.countLabel', {
defaultMessage: 'Count',
});
}
if (metric.type === 'calculation') {
return i18n.translate('visTypeTimeseries.calculateLabel.bucketScriptsLabel', {
defaultMessage: 'Bucket Script',
});
}
if (metric.type === 'math') {
return i18n.translate('visTypeTimeseries.calculateLabel.mathLabel', { defaultMessage: 'Math' });
}
if (metric.type === 'series_agg') {
return i18n.translate('visTypeTimeseries.calculateLabel.seriesAggLabel', {
defaultMessage: 'Series Agg ({metricFunction})',
values: { metricFunction: metric.function },
});
}
if (metric.type === 'filter_ratio') {
return i18n.translate('visTypeTimeseries.calculateLabel.filterRatioLabel', {
defaultMessage: 'Filter Ratio',
});
}
if (metric.type === 'positive_rate') {
return i18n.translate('visTypeTimeseries.calculateLabel.positiveRateLabel', {
defaultMessage: 'Counter Rate of {field}',
values: { field: extractFieldLabel(fields, metric.field!, isThrowErrorOnFieldNotFound) },
});
}
if (metric.type === 'static') {
return i18n.translate('visTypeTimeseries.calculateLabel.staticValueLabel', {
defaultMessage: 'Static Value of {metricValue}',
values: { metricValue: metric.value },
});
switch (metric.type) {
case METRIC_TYPES.COUNT:
return i18n.translate('visTypeTimeseries.calculateLabel.countLabel', {
defaultMessage: 'Count',
});
case TSVB_METRIC_TYPES.CALCULATION:
return i18n.translate('visTypeTimeseries.calculateLabel.bucketScriptsLabel', {
defaultMessage: 'Bucket Script',
});
case TSVB_METRIC_TYPES.MATH:
return i18n.translate('visTypeTimeseries.calculateLabel.mathLabel', {
defaultMessage: 'Math',
});
case TSVB_METRIC_TYPES.SERIES_AGG:
return i18n.translate('visTypeTimeseries.calculateLabel.seriesAggLabel', {
defaultMessage: 'Series Agg ({metricFunction})',
values: { metricFunction: metric.function },
});
case TSVB_METRIC_TYPES.FILTER_RATIO:
return i18n.translate('visTypeTimeseries.calculateLabel.filterRatioLabel', {
defaultMessage: 'Filter Ratio',
});
case TSVB_METRIC_TYPES.POSITIVE_RATE:
return i18n.translate('visTypeTimeseries.calculateLabel.positiveRateLabel', {
defaultMessage: 'Counter Rate of {field}',
values: { field: extractFieldLabel(fields, metric.field!, isThrowErrorOnFieldNotFound) },
});
case TSVB_METRIC_TYPES.STATIC:
return i18n.translate('visTypeTimeseries.calculateLabel.staticValueLabel', {
defaultMessage: 'Static Value of {metricValue}',
values: { metricValue: metric.value },
});
}
const metricTypeLabel = getMetricLabel(metric.type);
if (includes(paths, metric.type)) {
const targetMetric = metrics.find((m) => startsWith(metric.field!, m.id));
const targetLabel = calculateLabel(targetMetric!, metrics, fields);
@ -91,11 +92,11 @@ export const calculateLabel = (
const matches = metric.field!.match(percentileValueMatch);
if (matches) {
return i18n.translate(
'visTypeTimeseries.calculateLabel.lookupMetricTypeOfTargetWithAdditionalLabel',
'visTypeTimeseries.calculateLabel.metricTypeOfTargetWithAdditionalLabel',
{
defaultMessage: '{lookupMetricType} of {targetLabel} ({additionalLabel})',
defaultMessage: '{metricTypeLabel} of {targetLabel} ({additionalLabel})',
values: {
lookupMetricType: lookup[metric.type],
metricTypeLabel,
targetLabel,
additionalLabel: matches[1],
},
@ -103,16 +104,16 @@ export const calculateLabel = (
);
}
}
return i18n.translate('visTypeTimeseries.calculateLabel.lookupMetricTypeOfTargetLabel', {
defaultMessage: '{lookupMetricType} of {targetLabel}',
values: { lookupMetricType: lookup[metric.type], targetLabel },
return i18n.translate('visTypeTimeseries.calculateLabel.metricTypeOfTargetLabel', {
defaultMessage: '{metricTypeLabel} of {targetLabel}',
values: { metricTypeLabel, targetLabel },
});
}
return i18n.translate('visTypeTimeseries.calculateLabel.lookupMetricTypeOfMetricFieldRankLabel', {
defaultMessage: '{lookupMetricType} of {metricField}',
return i18n.translate('visTypeTimeseries.calculateLabel.metricTypeOfMetricFieldRankLabel', {
defaultMessage: '{metricTypeLabel} of {metricField}',
values: {
lookupMetricType: lookup[metric.type],
metricTypeLabel,
metricField: extractFieldLabel(fields, metric.field!, isThrowErrorOnFieldNotFound),
},
});

View file

@ -8,7 +8,7 @@
export { PANEL_TYPES } from './panel_types';
export { MODEL_TYPES } from './model_types';
export { METRIC_TYPES, BUCKET_TYPES, EXTENDED_STATS_TYPES } from './metric_types';
export { TSVB_METRIC_TYPES, BUCKET_TYPES } from './metric_types';
export { TIME_RANGE_DATA_MODES, TIME_RANGE_MODE_KEY } from './timerange_data_modes';
export enum PALETTES {

View file

@ -7,21 +7,25 @@
*/
// We should probably use METRIC_TYPES from data plugin in future.
export enum METRIC_TYPES {
export enum TSVB_METRIC_TYPES {
FILTER_RATIO = 'filter_ratio',
POSITIVE_RATE = 'positive_rate',
PERCENTILE = 'percentile',
PERCENTILE_RANK = 'percentile_rank',
TOP_HIT = 'top_hit',
COUNT = 'count',
DERIVATIVE = 'derivative',
STATIC = 'static',
STD_DEVIATION = 'std_deviation',
VARIANCE = 'variance',
SUM_OF_SQUARES = 'sum_of_squares',
CARDINALITY = 'cardinality',
TOP_HIT = 'top_hit',
VALUE_COUNT = 'value_count',
AVERAGE = 'avg',
SUM = 'sum',
MIN = 'min',
MAX = 'max',
VARIANCE = 'variance',
CALCULATION = 'calculation',
MOVING_AVERAGE = 'moving_average',
POSITIVE_ONLY = 'positive_only',
STD_DEVIATION_BUCKET = 'std_deviation_bucket',
SUM_OF_SQUARES_BUCKET = 'sum_of_squares_bucket',
VARIANCE_BUCKET = 'variance_bucket',
SERIES_AGG = 'series_agg',
MATH = 'math',
}
// We should probably use BUCKET_TYPES from data plugin in future.
@ -29,9 +33,3 @@ export enum BUCKET_TYPES {
TERMS = 'terms',
FILTERS = 'filters',
}
export const EXTENDED_STATS_TYPES = [
METRIC_TYPES.STD_DEVIATION,
METRIC_TYPES.VARIANCE,
METRIC_TYPES.SUM_OF_SQUARES,
];

View file

@ -9,7 +9,7 @@
import { Filter, IndexPattern, Query } from '../../../data/common';
import { Panel } from './panel_model';
export { Metric, Series, Panel } from './panel_model';
export { Metric, Series, Panel, MetricType } from './panel_model';
export { TimeseriesVisData, PanelData, SeriesData, TableData } from './vis_data';
export interface FetchedIndexPattern {

View file

@ -6,8 +6,8 @@
* Side Public License, v 1.
*/
import { Query } from '../../../data/common';
import { PANEL_TYPES, TOOLTIP_MODES } from '../enums';
import { METRIC_TYPES, Query } from '../../../data/common';
import { PANEL_TYPES, TOOLTIP_MODES, TSVB_METRIC_TYPES } from '../enums';
import { IndexPatternValue, Annotation } from './index';
import { ColorRules, BackgroundColorRules, BarColorRules, GaugeColorRules } from './color_rules';
@ -27,6 +27,8 @@ interface Percentile {
color?: string;
}
export type MetricType = METRIC_TYPES | TSVB_METRIC_TYPES;
export interface Metric {
field?: string;
id: string;
@ -50,7 +52,7 @@ export interface Metric {
variables?: MetricVariable[];
numberOfSignificantValueDigits?: number;
percentiles?: Percentile[];
type: string;
type: MetricType;
value?: string;
values?: string[];
colors?: string[];

View file

@ -11,229 +11,28 @@ import { EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
// @ts-ignore
import { isMetricEnabled } from '../../lib/check_ui_restrictions';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
import { getAggsByType, getAggsByPredicate } from '../../../../common/agg_utils';
import type { Agg } from '../../../../common/agg_utils';
import type { Metric } from '../../../../common/types';
import { TimeseriesUIRestrictions } from '../../../../common/ui_restrictions';
type AggSelectOption = EuiComboBoxOptionOption;
const metricAggs: AggSelectOption[] = [
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.averageLabel', {
defaultMessage: 'Average',
}),
value: 'avg',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.cardinalityLabel', {
defaultMessage: 'Cardinality',
}),
value: 'cardinality',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.countLabel', {
defaultMessage: 'Count',
}),
value: 'count',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.filterRatioLabel', {
defaultMessage: 'Filter Ratio',
}),
value: 'filter_ratio',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.positiveRateLabel', {
defaultMessage: 'Counter Rate',
}),
value: 'positive_rate',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.maxLabel', {
defaultMessage: 'Max',
}),
value: 'max',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.minLabel', {
defaultMessage: 'Min',
}),
value: 'min',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.percentileLabel', {
defaultMessage: 'Percentile',
}),
value: 'percentile',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.percentileRankLabel', {
defaultMessage: 'Percentile Rank',
}),
value: 'percentile_rank',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.staticValueLabel', {
defaultMessage: 'Static Value',
}),
value: 'static',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.stdDeviationLabel', {
defaultMessage: 'Std. Deviation',
}),
value: 'std_deviation',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.sumLabel', {
defaultMessage: 'Sum',
}),
value: 'sum',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.sumOfSquaresLabel', {
defaultMessage: 'Sum of Squares',
}),
value: 'sum_of_squares',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.topHitLabel', {
defaultMessage: 'Top Hit',
}),
value: 'top_hit',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.valueCountLabel', {
defaultMessage: 'Value Count',
}),
value: 'value_count',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.metricsAggs.varianceLabel', {
defaultMessage: 'Variance',
}),
value: 'variance',
},
];
const mapAggToSelectOption = ({ id, meta }: Agg) => ({ value: id, label: meta.label });
const pipelineAggs: AggSelectOption[] = [
{
label: i18n.translate('visTypeTimeseries.aggSelect.pipelineAggs.bucketScriptLabel', {
defaultMessage: 'Bucket Script',
}),
value: 'calculation',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.pipelineAggs.cumulativeSumLabel', {
defaultMessage: 'Cumulative Sum',
}),
value: 'cumulative_sum',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.pipelineAggs.derivativeLabel', {
defaultMessage: 'Derivative',
}),
value: 'derivative',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.pipelineAggs.movingAverageLabel', {
defaultMessage: 'Moving Average',
}),
value: 'moving_average',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.pipelineAggs.positiveOnlyLabel', {
defaultMessage: 'Positive Only',
}),
value: 'positive_only',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.pipelineAggs.serialDifferenceLabel', {
defaultMessage: 'Serial Difference',
}),
value: 'serial_diff',
},
];
const siblingAggs: AggSelectOption[] = [
{
label: i18n.translate('visTypeTimeseries.aggSelect.siblingAggs.overallAverageLabel', {
defaultMessage: 'Overall Average',
}),
value: 'avg_bucket',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.siblingAggs.overallMaxLabel', {
defaultMessage: 'Overall Max',
}),
value: 'max_bucket',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.siblingAggs.overallMinLabel', {
defaultMessage: 'Overall Min',
}),
value: 'min_bucket',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.siblingAggs.overallStdDeviationLabel', {
defaultMessage: 'Overall Std. Deviation',
}),
value: 'std_deviation_bucket',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.siblingAggs.overallSumLabel', {
defaultMessage: 'Overall Sum',
}),
value: 'sum_bucket',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.siblingAggs.overallSumOfSquaresLabel', {
defaultMessage: 'Overall Sum of Squares',
}),
value: 'sum_of_squares_bucket',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.siblingAggs.overallVarianceLabel', {
defaultMessage: 'Overall Variance',
}),
value: 'variance_bucket',
},
];
const specialAggs: AggSelectOption[] = [
{
label: i18n.translate('visTypeTimeseries.aggSelect.specialAggs.seriesAggLabel', {
defaultMessage: 'Series Agg',
}),
value: 'series_agg',
},
{
label: i18n.translate('visTypeTimeseries.aggSelect.specialAggs.mathLabel', {
defaultMessage: 'Math',
}),
value: 'math',
},
];
const FILTER_RATIO_AGGS = [
'avg',
'cardinality',
'count',
'positive_rate',
'max',
'min',
'sum',
'value_count',
];
const HISTOGRAM_AGGS = ['avg', 'count', 'sum', 'min', 'max', 'value_count'];
const {
metric: metricAggs,
parent_pipeline: pipelineAggs,
sibling_pipeline: siblingAggs,
special: specialAggs,
} = getAggsByType(mapAggToSelectOption);
const allAggOptions = [...metricAggs, ...pipelineAggs, ...siblingAggs, ...specialAggs];
function filterByPanelType(panelType: string) {
return (agg: AggSelectOption) => {
if (panelType === 'table') return agg.value !== 'series_agg';
return true;
};
return (agg: AggSelectOption) =>
panelType === 'table' ? agg.value !== TSVB_METRIC_TYPES.SERIES_AGG : true;
}
interface AggSelectUiProps {
@ -260,9 +59,13 @@ export function AggSelect(props: AggSelectUiProps) {
if (panelType === 'metrics') {
options = metricAggs;
} else if (panelType === 'filter_ratio') {
options = metricAggs.filter((m) => FILTER_RATIO_AGGS.includes(`${m.value}`));
options = getAggsByPredicate({ meta: { isFilterRatioSupported: true } }).map(
mapAggToSelectOption
);
} else if (panelType === 'histogram') {
options = metricAggs.filter((m) => HISTOGRAM_AGGS.includes(`${m.value}`));
options = getAggsByPredicate({ meta: { isHistogramSupported: true } }).map(
mapAggToSelectOption
);
} else {
const disableSiblingAggs = (agg: AggSelectOption) => ({
...agg,

View file

@ -15,7 +15,7 @@ import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { createTextHandler } from '../lib/create_text_handler';
import { CalculationVars, newVariable } from './vars';
import { METRIC_TYPES } from '../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
import { FormattedMessage } from '@kbn/i18n/react';
import {
@ -91,7 +91,7 @@ export function CalculationAgg(props) {
onChange={handleChange}
name="variables"
model={model}
exclude={[METRIC_TYPES.TOP_HIT]}
exclude={[TSVB_METRIC_TYPES.TOP_HIT]}
/>
</EuiFlexItem>

View file

@ -13,7 +13,7 @@ import { AggSelect } from './agg_select';
import { MetricSelect } from './metric_select';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { METRIC_TYPES } from '../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
import { FormattedMessage } from '@kbn/i18n/react';
import {
htmlIdGenerator,
@ -73,7 +73,7 @@ export function CumulativeSumAgg(props) {
metric={model}
fields={fields[getIndexPatternKey(indexPattern)]}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
exclude={[TSVB_METRIC_TYPES.TOP_HIT]}
/>
</EuiFormRow>
</EuiFlexItem>

View file

@ -14,7 +14,7 @@ import { AggRow } from './agg_row';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { createTextHandler } from '../lib/create_text_handler';
import { METRIC_TYPES } from '../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
import {
htmlIdGenerator,
EuiFlexGroup,
@ -83,7 +83,7 @@ export const DerivativeAgg = (props) => {
metric={model}
fields={fields[getIndexPatternKey(indexPattern)]}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
exclude={[TSVB_METRIC_TYPES.TOP_HIT]}
fullWidth
/>
</EuiFormRow>

View file

@ -15,7 +15,7 @@ import { calculateSiblings } from '../lib/calculate_siblings';
import { calculateLabel } from '../../../../common/calculate_label';
import { basicAggs } from '../../../../common/basic_aggs';
import { toPercentileNumber } from '../../../../common/to_percentile_number';
import { METRIC_TYPES } from '../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
function createTypeFilter(restrict, exclude = []) {
return (metric) => {
@ -73,7 +73,7 @@ export function MetricSelect(props) {
const label = calculateLabel(row, calculatedMetrics, fields, false);
switch (row.type) {
case METRIC_TYPES.PERCENTILE_RANK:
case TSVB_METRIC_TYPES.PERCENTILE_RANK:
(row.values || []).forEach((p) => {
const value = toPercentileNumber(p);
@ -83,7 +83,7 @@ export function MetricSelect(props) {
});
});
case METRIC_TYPES.PERCENTILE:
case TSVB_METRIC_TYPES.PERCENTILE:
(row.percentiles || []).forEach((p) => {
if (p.value) {
const value = toPercentileNumber(p.value);

View file

@ -14,7 +14,7 @@ import { MetricSelect } from './metric_select';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { createNumberHandler } from '../lib/create_number_handler';
import { METRIC_TYPES, MODEL_TYPES } from '../../../../common/enums';
import { TSVB_METRIC_TYPES, MODEL_TYPES } from '../../../../common/enums';
import {
htmlIdGenerator,
EuiFlexGroup,
@ -144,7 +144,7 @@ export const MovingAverageAgg = (props) => {
metric={model}
fields={fields[getIndexPatternKey(indexPattern)]}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
exclude={[TSVB_METRIC_TYPES.TOP_HIT]}
/>
</EuiFormRow>
</EuiFlexItem>

View file

@ -13,7 +13,7 @@ import { MetricSelect } from './metric_select';
import { AggRow } from './agg_row';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { METRIC_TYPES } from '../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
import {
htmlIdGenerator,
EuiFlexGroup,
@ -77,7 +77,7 @@ export const PositiveOnlyAgg = (props) => {
metric={model}
fields={fields[getIndexPatternKey(indexPattern)]}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
exclude={[TSVB_METRIC_TYPES.TOP_HIT]}
/>
</EuiFormRow>
</EuiFlexItem>

View file

@ -14,7 +14,7 @@ import { AggRow } from './agg_row';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { createNumberHandler } from '../lib/create_number_handler';
import { METRIC_TYPES } from '../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
import {
htmlIdGenerator,
EuiFlexGroup,
@ -77,7 +77,7 @@ export const SerialDiffAgg = (props) => {
metric={model}
fields={fields[getIndexPatternKey(indexPattern)]}
value={model.field}
exclude={[METRIC_TYPES.TOP_HIT]}
exclude={[TSVB_METRIC_TYPES.TOP_HIT]}
/>
</EuiFormRow>
</EuiFlexItem>

View file

@ -14,7 +14,7 @@ import { AggSelect } from './agg_select';
import { createChangeHandler } from '../lib/create_change_handler';
import { createSelectHandler } from '../lib/create_select_handler';
import { createTextHandler } from '../lib/create_text_handler';
import { METRIC_TYPES } from '../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
import {
htmlIdGenerator,
@ -146,7 +146,7 @@ const StandardSiblingAggUi = (props) => {
>
<MetricSelect
onChange={handleSelectChange('field')}
exclude={[METRIC_TYPES.PERCENTILE, METRIC_TYPES.TOP_HIT]}
exclude={[TSVB_METRIC_TYPES.PERCENTILE, TSVB_METRIC_TYPES.TOP_HIT]}
metrics={siblings}
fields={fields[getIndexPatternKey(indexPattern)]}
metric={model}

View file

@ -7,15 +7,16 @@
*/
import { KBN_FIELD_TYPES } from '../../../../../../plugins/data/public';
import { METRIC_TYPES } from '../../../../common/enums';
import { METRIC_TYPES } from '../../../../../data/common';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
export function getSupportedFieldsByMetricType(type) {
switch (type) {
case METRIC_TYPES.CARDINALITY:
return Object.values(KBN_FIELD_TYPES).filter((t) => t !== KBN_FIELD_TYPES.HISTOGRAM);
case METRIC_TYPES.VALUE_COUNT:
case TSVB_METRIC_TYPES.VALUE_COUNT:
return Object.values(KBN_FIELD_TYPES);
case METRIC_TYPES.AVERAGE:
case METRIC_TYPES.AVG:
case METRIC_TYPES.SUM:
case METRIC_TYPES.MIN:
case METRIC_TYPES.MAX:

View file

@ -7,11 +7,12 @@
*/
import uuid from 'uuid';
import { METRIC_TYPES } from '../../../../../data/common';
import type { Metric } from '../../../../common/types';
export const newMetricAggFn = (): Metric => {
return {
id: uuid.v1(),
type: 'count',
type: METRIC_TYPES.COUNT,
};
};

View file

@ -7,7 +7,7 @@
*/
import { newMetricAggFn } from './new_metric_agg_fn';
import { isBasicAgg } from '../../../../common/agg_lookup';
import { isBasicAgg } from '../../../../common/agg_utils';
import { handleAdd, handleChange } from './collection_actions';
export const seriesChangeHandler = (props, items) => (doc) => {

View file

@ -6,9 +6,11 @@
* Side Public License, v 1.
*/
import { get, includes, max, min, sum, noop } from 'lodash';
import { get, max, min, sum, noop } from 'lodash';
import { toPercentileNumber } from '../../../../common/to_percentile_number';
import { METRIC_TYPES, EXTENDED_STATS_TYPES } from '../../../../common/enums';
import { METRIC_TYPES } from '../../../../../data/common';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
import { getAggByPredicate } from '../../../../common/agg_utils';
const aggFns = {
max,
@ -21,7 +23,7 @@ const aggFns = {
export const getAggValue = (row, metric) => {
// Extended Stats
if (includes(EXTENDED_STATS_TYPES, metric.type)) {
if (getAggByPredicate(metric.type, { hasExtendedStats: true })) {
const isStdDeviation = /^std_deviation/.test(metric.type);
const modeIsBounds = ~['upper', 'lower'].indexOf(metric.mode);
if (isStdDeviation && modeIsBounds) {
@ -31,15 +33,15 @@ export const getAggValue = (row, metric) => {
}
switch (metric.type) {
case METRIC_TYPES.PERCENTILE:
case TSVB_METRIC_TYPES.PERCENTILE:
const percentileKey = toPercentileNumber(`${metric.percent}`);
return row[metric.id].values[percentileKey];
case METRIC_TYPES.PERCENTILE_RANK:
case TSVB_METRIC_TYPES.PERCENTILE_RANK:
const percentileRankKey = toPercentileNumber(`${metric.value}`);
return row[metric.id] && row[metric.id].values && row[metric.id].values[percentileRankKey];
case METRIC_TYPES.TOP_HIT:
case TSVB_METRIC_TYPES.TOP_HIT:
if (row[metric.id].doc_count === 0) {
return null;
}

View file

@ -8,7 +8,8 @@
import { startsWith } from 'lodash';
import { toPercentileNumber } from '../../../../common/to_percentile_number';
import { METRIC_TYPES } from '../../../../common/enums';
import { METRIC_TYPES } from '../../../../../data/common';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
import type { Metric } from '../../../../common/types';
const percentileTest = /\[[0-9\.]+\]$/;
@ -25,7 +26,7 @@ export const getBucketsPath = (id: string, metrics: Metric[]) => {
// For percentiles we need to breakout the percentile key that the user
// specified. This information is stored in the key using the following pattern
// {metric.id}[{percentile}]
case METRIC_TYPES.PERCENTILE:
case TSVB_METRIC_TYPES.PERCENTILE:
if (percentileTest.test(bucketsPath)) break;
if (metric.percentiles?.length) {
const percent = metric.percentiles[0];
@ -33,13 +34,13 @@ export const getBucketsPath = (id: string, metrics: Metric[]) => {
bucketsPath += `[${toPercentileNumber(percent.value!)}]`;
}
break;
case METRIC_TYPES.PERCENTILE_RANK:
case TSVB_METRIC_TYPES.PERCENTILE_RANK:
if (percentileTest.test(bucketsPath)) break;
bucketsPath += `[${toPercentileNumber(metric.value!)}]`;
break;
case METRIC_TYPES.STD_DEVIATION:
case METRIC_TYPES.VARIANCE:
case METRIC_TYPES.SUM_OF_SQUARES:
case TSVB_METRIC_TYPES.STD_DEVIATION:
case TSVB_METRIC_TYPES.VARIANCE:
case TSVB_METRIC_TYPES.SUM_OF_SQUARES:
if (/^std_deviation/.test(metric.type) && ['upper', 'lower'].includes(metric.mode!)) {
bucketsPath += `[std_${metric.mode}]`;
} else {

View file

@ -7,10 +7,12 @@
*/
import { mapEmptyToZero } from './map_empty_to_zero';
import { METRIC_TYPES } from '../../../../../data/common';
import { TSVB_METRIC_TYPES } from '../../../../common/enums';
describe('mapEmptyToZero(metric, buckets)', () => {
test('returns bucket key and value for basic metric', () => {
const metric = { id: 'AVG', type: 'avg' };
const metric = { id: 'AVG', type: METRIC_TYPES.AVG };
const buckets = [
{
key: 1234,
@ -20,7 +22,7 @@ describe('mapEmptyToZero(metric, buckets)', () => {
expect(mapEmptyToZero(metric, buckets)).toEqual([[1234, 1]]);
});
test('returns bucket key and value for std_deviation', () => {
const metric = { id: 'STDDEV', type: 'std_deviation' };
const metric = { id: 'STDDEV', type: TSVB_METRIC_TYPES.STD_DEVIATION };
const buckets = [
{
key: 1234,
@ -30,7 +32,7 @@ describe('mapEmptyToZero(metric, buckets)', () => {
expect(mapEmptyToZero(metric, buckets)).toEqual([[1234, 1]]);
});
test('returns bucket key and value for percentiles', () => {
const metric = { id: 'PCT', type: 'percentile', percent: 50 };
const metric = { id: 'PCT', type: TSVB_METRIC_TYPES.PERCENTILE, percent: 50 };
const buckets = [
{
key: 1234,
@ -40,7 +42,7 @@ describe('mapEmptyToZero(metric, buckets)', () => {
expect(mapEmptyToZero(metric, buckets)).toEqual([[1234, 1]]);
});
test('returns bucket key and value for derivative', () => {
const metric = { id: 'DERV', type: 'derivative', field: 'io', unit: '1s' };
const metric = { id: 'DERV', type: METRIC_TYPES.DERIVATIVE, field: 'io', unit: '1s' };
const buckets = [
{
key: 1234,

View file

@ -10,13 +10,13 @@ import { getAggValue } from '../../helpers/get_agg_value';
import { getDefaultDecoration } from '../../helpers/get_default_decoration';
import { getSplits } from '../../helpers/get_splits';
import { getLastMetric } from '../../helpers/get_last_metric';
import { METRIC_TYPES } from '../../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../../common/enums';
export function percentile(resp, panel, series, meta, extractFields) {
return (next) => async (results) => {
const metric = getLastMetric(series);
if (metric.type !== METRIC_TYPES.PERCENTILE) {
if (metric.type !== TSVB_METRIC_TYPES.PERCENTILE) {
return next(results);
}

View file

@ -11,13 +11,13 @@ import { getDefaultDecoration } from '../../helpers/get_default_decoration';
import { getSplits } from '../../helpers/get_splits';
import { getLastMetric } from '../../helpers/get_last_metric';
import { toPercentileNumber } from '../../../../../common/to_percentile_number';
import { METRIC_TYPES } from '../../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../../common/enums';
export function percentileRank(resp, panel, series, meta, extractFields) {
return (next) => async (results) => {
const metric = getLastMetric(series);
if (metric.type !== METRIC_TYPES.PERCENTILE_RANK) {
if (metric.type !== TSVB_METRIC_TYPES.PERCENTILE_RANK) {
return next(results);
}

View file

@ -7,12 +7,12 @@
*/
import { getAggValue, getLastMetric, getSplits } from '../../helpers';
import { METRIC_TYPES } from '../../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../../common/enums';
export function stdDeviationBands(resp, panel, series, meta, extractFields) {
return (next) => async (results) => {
const metric = getLastMetric(series);
if (metric.type === METRIC_TYPES.STD_DEVIATION && metric.mode === 'band') {
if (metric.type === TSVB_METRIC_TYPES.STD_DEVIATION && metric.mode === 'band') {
(await getSplits(resp, panel, series, meta, extractFields)).forEach(
({ id, color, label, timeseries }) => {
const data = timeseries.buckets.map((bucket) => [

View file

@ -7,16 +7,16 @@
*/
import { getDefaultDecoration, getSplits, getLastMetric, mapEmptyToZero } from '../../helpers';
import { METRIC_TYPES } from '../../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../../common/enums';
export function stdMetric(resp, panel, series, meta, extractFields) {
return (next) => async (results) => {
const metric = getLastMetric(series);
if (metric.type === METRIC_TYPES.STD_DEVIATION && metric.mode === 'band') {
if (metric.type === TSVB_METRIC_TYPES.STD_DEVIATION && metric.mode === 'band') {
return next(results);
}
if ([METRIC_TYPES.PERCENTILE_RANK, METRIC_TYPES.PERCENTILE].includes(metric.type)) {
if ([TSVB_METRIC_TYPES.PERCENTILE_RANK, TSVB_METRIC_TYPES.PERCENTILE].includes(metric.type)) {
return next(results);
}
if (/_bucket$/.test(metric.type)) return next(results);

View file

@ -9,7 +9,7 @@
import { last } from 'lodash';
import { getSplits, getLastMetric } from '../../helpers';
import { toPercentileNumber } from '../../../../../common/to_percentile_number';
import { METRIC_TYPES } from '../../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../../common/enums';
import type { TableResponseProcessorsFunction } from './types';
import type { PanelDataArray } from '../../../../../common/types/vis_data';
@ -23,7 +23,7 @@ export const percentile: TableResponseProcessorsFunction = ({
}) => (next) => async (results) => {
const metric = getLastMetric(series);
if (metric.type !== METRIC_TYPES.PERCENTILE) {
if (metric.type !== TSVB_METRIC_TYPES.PERCENTILE) {
return next(results);
}

View file

@ -9,7 +9,7 @@
import { last } from 'lodash';
import { getSplits, getAggValue, getLastMetric } from '../../helpers';
import { toPercentileNumber } from '../../../../../common/to_percentile_number';
import { METRIC_TYPES } from '../../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../../common/enums';
import type { TableResponseProcessorsFunction } from './types';
import type { PanelDataArray } from '../../../../../common/types/vis_data';
@ -23,7 +23,7 @@ export const percentileRank: TableResponseProcessorsFunction = ({
}) => (next) => async (results) => {
const metric = getLastMetric(series);
if (metric.type !== METRIC_TYPES.PERCENTILE_RANK) {
if (metric.type !== TSVB_METRIC_TYPES.PERCENTILE_RANK) {
return next(results);
}

View file

@ -7,7 +7,7 @@
*/
import { getSplits, getLastMetric, mapEmptyToZero } from '../../helpers';
import { METRIC_TYPES } from '../../../../../common/enums';
import { TSVB_METRIC_TYPES } from '../../../../../common/enums';
import type { TableResponseProcessorsFunction } from './types';
@ -20,11 +20,15 @@ export const stdMetric: TableResponseProcessorsFunction = ({
}) => (next) => async (results) => {
const metric = getLastMetric(series);
if (metric.type === METRIC_TYPES.STD_DEVIATION && metric.mode === 'band') {
if (metric.type === TSVB_METRIC_TYPES.STD_DEVIATION && metric.mode === 'band') {
return next(results);
}
if (METRIC_TYPES.PERCENTILE_RANK === metric.type || METRIC_TYPES.PERCENTILE === metric.type) {
if (
[TSVB_METRIC_TYPES.PERCENTILE_RANK, TSVB_METRIC_TYPES.PERCENTILE].includes(
metric.type as TSVB_METRIC_TYPES
)
) {
return next(results);
}

View file

@ -275,7 +275,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const topNLabel = await visualBuilder.getTopNLabel();
const topNCount = await visualBuilder.getTopNCount();
expect(topNLabel).to.be('Sum of Sq. of bytes');
expect(topNLabel).to.be('Sum of Squares of bytes');
expect(topNCount).to.be('630,170,001,503');
});

View file

@ -4250,75 +4250,44 @@
"visTypeTimeseries.addDeleteButtons.temporarilyDisableTooltip": "一時的に無効にする",
"visTypeTimeseries.advancedSettings.maxBucketsText": "TSVBヒストグラム密度に影響します。「histogram:maxBars」よりも大きく設定する必要があります。",
"visTypeTimeseries.advancedSettings.maxBucketsTitle": "TSVBバケット制限",
"visTypeTimeseries.aggLookup.averageLabel": "平均",
"visTypeTimeseries.aggLookup.calculationLabel": "計算",
"visTypeTimeseries.aggLookup.cardinalityLabel": "基数",
"visTypeTimeseries.aggLookup.countLabel": "カウント",
"visTypeTimeseries.aggLookup.cumulativeSumLabel": "累積和",
"visTypeTimeseries.aggLookup.derivativeLabel": "派生",
"visTypeTimeseries.aggLookup.deviationLabel": "標準偏差",
"visTypeTimeseries.aggLookup.filterRatioLabel": "フィルターレート",
"visTypeTimeseries.aggLookup.mathLabel": "数学処理",
"visTypeTimeseries.aggLookup.maxLabel": "最高",
"visTypeTimeseries.aggLookup.minLabel": "最低",
"visTypeTimeseries.aggLookup.movingAverageLabel": "移動平均",
"visTypeTimeseries.aggLookup.overallAverageLabel": "全体平均",
"visTypeTimeseries.aggLookup.overallMaxLabel": "全体最高",
"visTypeTimeseries.aggLookup.overallMinLabel": "全体最低",
"visTypeTimeseries.aggLookup.overallStdDeviationLabel": "全体標準偏差",
"visTypeTimeseries.aggLookup.overallSumLabel": "全体合計",
"visTypeTimeseries.aggLookup.overallSumOfSqLabel": "全体平方和",
"visTypeTimeseries.aggLookup.overallVarianceLabel": "全体の相異",
"visTypeTimeseries.aggLookup.percentileLabel": "パーセンタイル",
"visTypeTimeseries.aggLookup.percentileRankLabel": "パーセンタイルランク",
"visTypeTimeseries.aggLookup.positiveOnlyLabel": "プラスのみ",
"visTypeTimeseries.aggLookup.positiveRateLabel": "カウンターレート",
"visTypeTimeseries.aggLookup.serialDifferenceLabel": "連続差",
"visTypeTimeseries.aggLookup.seriesAggLabel": "数列集約",
"visTypeTimeseries.aggLookup.staticValueLabel": "不動値",
"visTypeTimeseries.aggLookup.sumLabel": "合計",
"visTypeTimeseries.aggLookup.sumOfSqLabel": "平方和",
"visTypeTimeseries.aggLookup.topHitLabel": "トップヒット",
"visTypeTimeseries.aggLookup.valueCountLabel": "値カウント",
"visTypeTimeseries.aggLookup.varianceLabel": "相異",
"visTypeTimeseries.aggUtils.averageLabel": "平均",
"visTypeTimeseries.aggUtils.bucketScriptLabel": "バケットスクリプト",
"visTypeTimeseries.aggUtils.cardinalityLabel": "基数",
"visTypeTimeseries.aggUtils.countLabel": "カウント",
"visTypeTimeseries.aggUtils.cumulativeSumLabel": "累積和",
"visTypeTimeseries.aggUtils.derivativeLabel": "派生",
"visTypeTimeseries.aggUtils.deviationLabel": "標準偏差",
"visTypeTimeseries.aggUtils.filterRatioLabel": "フィルターレート",
"visTypeTimeseries.aggUtils.mathLabel": "数学処理",
"visTypeTimeseries.aggUtils.maxLabel": "最高",
"visTypeTimeseries.aggUtils.minLabel": "最低",
"visTypeTimeseries.aggUtils.movingAverageLabel": "移動平均",
"visTypeTimeseries.aggUtils.overallAverageLabel": "全体平均",
"visTypeTimeseries.aggUtils.overallMaxLabel": "全体最高",
"visTypeTimeseries.aggUtils.overallMinLabel": "全体最低",
"visTypeTimeseries.aggUtils.overallStdDeviationLabel": "全体標準偏差",
"visTypeTimeseries.aggUtils.overallSumLabel": "全体合計",
"visTypeTimeseries.aggUtils.overallSumOfSquaresLabel": "全体平方和",
"visTypeTimeseries.aggUtils.overallVarianceLabel": "全体の相異",
"visTypeTimeseries.aggUtils.percentileLabel": "パーセンタイル",
"visTypeTimeseries.aggUtils.percentileRankLabel": "パーセンタイルランク",
"visTypeTimeseries.aggUtils.positiveOnlyLabel": "プラスのみ",
"visTypeTimeseries.aggUtils.positiveRateLabel": "カウンターレート",
"visTypeTimeseries.aggUtils.serialDifferenceLabel": "連続差",
"visTypeTimeseries.aggUtils.seriesAggLabel": "数列集約",
"visTypeTimeseries.aggUtils.staticValueLabel": "不動値",
"visTypeTimeseries.aggUtils.sumLabel": "合計",
"visTypeTimeseries.aggUtils.sumOfSquaresLabel": "平方和",
"visTypeTimeseries.aggUtils.topHitLabel": "トップヒット",
"visTypeTimeseries.aggUtils.valueCountLabel": "値カウント",
"visTypeTimeseries.aggUtils.varianceLabel": "相異",
"visTypeTimeseries.aggRow.addMetricButtonTooltip": "メトリックを追加",
"visTypeTimeseries.aggRow.deleteMetricButtonTooltip": "メトリックを削除",
"visTypeTimeseries.aggSelect.aggGroups.metricAggLabel": "メトリック集約",
"visTypeTimeseries.aggSelect.aggGroups.parentPipelineAggLabel": "親パイプライン集約",
"visTypeTimeseries.aggSelect.aggGroups.siblingPipelineAggLabel": "シブリングパイプライン集約",
"visTypeTimeseries.aggSelect.aggGroups.specialAggLabel": "特殊集約",
"visTypeTimeseries.aggSelect.metricsAggs.averageLabel": "平均",
"visTypeTimeseries.aggSelect.metricsAggs.cardinalityLabel": "基数",
"visTypeTimeseries.aggSelect.metricsAggs.countLabel": "カウント",
"visTypeTimeseries.aggSelect.metricsAggs.filterRatioLabel": "フィルターレート",
"visTypeTimeseries.aggSelect.metricsAggs.maxLabel": "最高",
"visTypeTimeseries.aggSelect.metricsAggs.minLabel": "最低",
"visTypeTimeseries.aggSelect.metricsAggs.percentileLabel": "パーセンタイル",
"visTypeTimeseries.aggSelect.metricsAggs.percentileRankLabel": "パーセンタイルランク",
"visTypeTimeseries.aggSelect.metricsAggs.positiveRateLabel": "カウンターレート",
"visTypeTimeseries.aggSelect.metricsAggs.staticValueLabel": "固定値",
"visTypeTimeseries.aggSelect.metricsAggs.stdDeviationLabel": "標準偏差",
"visTypeTimeseries.aggSelect.metricsAggs.sumLabel": "合計",
"visTypeTimeseries.aggSelect.metricsAggs.sumOfSquaresLabel": "平方和",
"visTypeTimeseries.aggSelect.metricsAggs.topHitLabel": "トップヒット",
"visTypeTimeseries.aggSelect.metricsAggs.valueCountLabel": "値カウント",
"visTypeTimeseries.aggSelect.metricsAggs.varianceLabel": "相異",
"visTypeTimeseries.aggSelect.pipelineAggs.bucketScriptLabel": "バケットスクリプト",
"visTypeTimeseries.aggSelect.pipelineAggs.cumulativeSumLabel": "累積和",
"visTypeTimeseries.aggSelect.pipelineAggs.derivativeLabel": "派生",
"visTypeTimeseries.aggSelect.pipelineAggs.movingAverageLabel": "移動平均",
"visTypeTimeseries.aggSelect.pipelineAggs.positiveOnlyLabel": "プラスのみ",
"visTypeTimeseries.aggSelect.pipelineAggs.serialDifferenceLabel": "連続差",
"visTypeTimeseries.aggSelect.selectAggPlaceholder": "集約を選択",
"visTypeTimeseries.aggSelect.siblingAggs.overallAverageLabel": "全体平均",
"visTypeTimeseries.aggSelect.siblingAggs.overallMaxLabel": "全体最高",
"visTypeTimeseries.aggSelect.siblingAggs.overallMinLabel": "全体最低",
"visTypeTimeseries.aggSelect.siblingAggs.overallStdDeviationLabel": "全体標準偏差",
"visTypeTimeseries.aggSelect.siblingAggs.overallSumLabel": "全体合計",
"visTypeTimeseries.aggSelect.siblingAggs.overallSumOfSquaresLabel": "全体平方和",
"visTypeTimeseries.aggSelect.siblingAggs.overallVarianceLabel": "全体の相異",
"visTypeTimeseries.aggSelect.specialAggs.mathLabel": "数学処理",
"visTypeTimeseries.aggSelect.specialAggs.seriesAggLabel": "数列集約",
"visTypeTimeseries.annotationsEditor.addDataSourceButtonLabel": "データソースを追加",
"visTypeTimeseries.annotationsEditor.dataSourcesLabel": "データソース",
"visTypeTimeseries.annotationsEditor.fieldsLabel": "フィールド (必須 - コンマ区切りのパス) ",
@ -4334,10 +4303,10 @@
"visTypeTimeseries.calculateLabel.bucketScriptsLabel": "バケットスクリプト",
"visTypeTimeseries.calculateLabel.countLabel": "カウント",
"visTypeTimeseries.calculateLabel.filterRatioLabel": "フィルターレート",
"visTypeTimeseries.calculateLabel.lookupMetricTypeOfMetricFieldRankLabel": "{lookupMetricType} of {metricField}",
"visTypeTimeseries.calculateLabel.lookupMetricTypeOfTargetLabel": "{lookupMetricType} of {targetLabel}",
"visTypeTimeseries.calculateLabel.lookupMetricTypeOfTargetWithAdditionalLabel": "{lookupMetricType} of {targetLabel} ({additionalLabel}) ",
"visTypeTimeseries.calculateLabel.mathLabel": "数学処理",
"visTypeTimeseries.calculateLabel.metricTypeOfMetricFieldRankLabel": "{metricTypeLabel} of {metricField}",
"visTypeTimeseries.calculateLabel.metricTypeOfTargetLabel": "{metricTypeLabel} of {targetLabel}",
"visTypeTimeseries.calculateLabel.metricTypeOfTargetWithAdditionalLabel": "{metricTypeLabel} of {targetLabel} ({additionalLabel}) ",
"visTypeTimeseries.calculateLabel.positiveRateLabel": "{field} のカウンターレート",
"visTypeTimeseries.calculateLabel.seriesAggLabel": "数列アグリゲーション ({metricFunction}) ",
"visTypeTimeseries.calculateLabel.staticValueLabel": "{metricValue} の静的値",

View file

@ -4270,75 +4270,44 @@
"visTypeTimeseries.addDeleteButtons.temporarilyDisableTooltip": "暂时禁用",
"visTypeTimeseries.advancedSettings.maxBucketsText": "影响 TSVB 直方图密度。必须设置为高于“histogram:maxBars”。",
"visTypeTimeseries.advancedSettings.maxBucketsTitle": "TSVB 存储桶限制",
"visTypeTimeseries.aggLookup.averageLabel": "平均值",
"visTypeTimeseries.aggLookup.calculationLabel": "计算",
"visTypeTimeseries.aggLookup.cardinalityLabel": "基数",
"visTypeTimeseries.aggLookup.countLabel": "计数",
"visTypeTimeseries.aggLookup.cumulativeSumLabel": "累计和",
"visTypeTimeseries.aggLookup.derivativeLabel": "导数",
"visTypeTimeseries.aggLookup.deviationLabel": "标准偏差",
"visTypeTimeseries.aggLookup.filterRatioLabel": "筛选比",
"visTypeTimeseries.aggLookup.mathLabel": "数学",
"visTypeTimeseries.aggLookup.maxLabel": "最大值",
"visTypeTimeseries.aggLookup.minLabel": "最小值",
"visTypeTimeseries.aggLookup.movingAverageLabel": "移动平均值",
"visTypeTimeseries.aggLookup.overallAverageLabel": "总体平均值",
"visTypeTimeseries.aggLookup.overallMaxLabel": "总体最大值",
"visTypeTimeseries.aggLookup.overallMinLabel": "总体最大值",
"visTypeTimeseries.aggLookup.overallStdDeviationLabel": "总体标准偏差",
"visTypeTimeseries.aggLookup.overallSumLabel": "总和",
"visTypeTimeseries.aggLookup.overallSumOfSqLabel": "总平方和",
"visTypeTimeseries.aggLookup.overallVarianceLabel": "总体方差",
"visTypeTimeseries.aggLookup.percentileLabel": "百分位数",
"visTypeTimeseries.aggLookup.percentileRankLabel": "百分位等级",
"visTypeTimeseries.aggLookup.positiveOnlyLabel": "仅正数",
"visTypeTimeseries.aggLookup.positiveRateLabel": "计数率",
"visTypeTimeseries.aggLookup.serialDifferenceLabel": "序列差分",
"visTypeTimeseries.aggLookup.seriesAggLabel": "序列聚合",
"visTypeTimeseries.aggLookup.staticValueLabel": "静态值",
"visTypeTimeseries.aggLookup.sumLabel": "求和",
"visTypeTimeseries.aggLookup.sumOfSqLabel": "平方和",
"visTypeTimeseries.aggLookup.topHitLabel": "最高命中结果",
"visTypeTimeseries.aggLookup.valueCountLabel": "值计数",
"visTypeTimeseries.aggLookup.varianceLabel": "方差",
"visTypeTimeseries.aggUtils.averageLabel": "平均值",
"visTypeTimeseries.aggUtils.bucketScriptLabel": "存储桶脚本",
"visTypeTimeseries.aggUtils.cardinalityLabel": "基数",
"visTypeTimeseries.aggUtils.countLabel": "计数",
"visTypeTimeseries.aggUtils.cumulativeSumLabel": "累计和",
"visTypeTimeseries.aggUtils.derivativeLabel": "导数",
"visTypeTimeseries.aggUtils.deviationLabel": "标准偏差",
"visTypeTimeseries.aggUtils.filterRatioLabel": "筛选比",
"visTypeTimeseries.aggUtils.mathLabel": "数学",
"visTypeTimeseries.aggUtils.maxLabel": "最大值",
"visTypeTimeseries.aggUtils.minLabel": "最小值",
"visTypeTimeseries.aggUtils.movingAverageLabel": "移动平均值",
"visTypeTimeseries.aggUtils.overallAverageLabel": "总体平均值",
"visTypeTimeseries.aggUtils.overallMaxLabel": "总体最大值",
"visTypeTimeseries.aggUtils.overallMinLabel": "总体最大值",
"visTypeTimeseries.aggUtils.overallStdDeviationLabel": "总体标准偏差",
"visTypeTimeseries.aggUtils.overallSumLabel": "总和",
"visTypeTimeseries.aggUtils.overallSumOfSquaresLabel": "总平方和",
"visTypeTimeseries.aggUtils.overallVarianceLabel": "总体方差",
"visTypeTimeseries.aggUtils.percentileLabel": "百分位数",
"visTypeTimeseries.aggUtils.percentileRankLabel": "百分位等级",
"visTypeTimeseries.aggUtils.positiveOnlyLabel": "仅正数",
"visTypeTimeseries.aggUtils.positiveRateLabel": "计数率",
"visTypeTimeseries.aggUtils.serialDifferenceLabel": "序列差分",
"visTypeTimeseries.aggUtils.seriesAggLabel": "序列聚合",
"visTypeTimeseries.aggUtils.staticValueLabel": "静态值",
"visTypeTimeseries.aggUtils.sumLabel": "求和",
"visTypeTimeseries.aggUtils.sumOfSquaresLabel": "平方和",
"visTypeTimeseries.aggUtils.topHitLabel": "最高命中结果",
"visTypeTimeseries.aggUtils.valueCountLabel": "值计数",
"visTypeTimeseries.aggUtils.varianceLabel": "方差",
"visTypeTimeseries.aggRow.addMetricButtonTooltip": "添加指标",
"visTypeTimeseries.aggRow.deleteMetricButtonTooltip": "删除指标",
"visTypeTimeseries.aggSelect.aggGroups.metricAggLabel": "指标聚合",
"visTypeTimeseries.aggSelect.aggGroups.parentPipelineAggLabel": "父级管道聚合",
"visTypeTimeseries.aggSelect.aggGroups.siblingPipelineAggLabel": "同级管道聚合",
"visTypeTimeseries.aggSelect.aggGroups.specialAggLabel": "特殊聚合",
"visTypeTimeseries.aggSelect.metricsAggs.averageLabel": "平均值",
"visTypeTimeseries.aggSelect.metricsAggs.cardinalityLabel": "基数",
"visTypeTimeseries.aggSelect.metricsAggs.countLabel": "计数",
"visTypeTimeseries.aggSelect.metricsAggs.filterRatioLabel": "筛选比",
"visTypeTimeseries.aggSelect.metricsAggs.maxLabel": "最大值",
"visTypeTimeseries.aggSelect.metricsAggs.minLabel": "最小值",
"visTypeTimeseries.aggSelect.metricsAggs.percentileLabel": "百分位数",
"visTypeTimeseries.aggSelect.metricsAggs.percentileRankLabel": "百分位等级",
"visTypeTimeseries.aggSelect.metricsAggs.positiveRateLabel": "计数率",
"visTypeTimeseries.aggSelect.metricsAggs.staticValueLabel": "静态值",
"visTypeTimeseries.aggSelect.metricsAggs.stdDeviationLabel": "标准偏差",
"visTypeTimeseries.aggSelect.metricsAggs.sumLabel": "求和",
"visTypeTimeseries.aggSelect.metricsAggs.sumOfSquaresLabel": "平方和",
"visTypeTimeseries.aggSelect.metricsAggs.topHitLabel": "最高命中结果",
"visTypeTimeseries.aggSelect.metricsAggs.valueCountLabel": "值计数",
"visTypeTimeseries.aggSelect.metricsAggs.varianceLabel": "方差",
"visTypeTimeseries.aggSelect.pipelineAggs.bucketScriptLabel": "存储桶脚本",
"visTypeTimeseries.aggSelect.pipelineAggs.cumulativeSumLabel": "累计和",
"visTypeTimeseries.aggSelect.pipelineAggs.derivativeLabel": "导数",
"visTypeTimeseries.aggSelect.pipelineAggs.movingAverageLabel": "移动平均值",
"visTypeTimeseries.aggSelect.pipelineAggs.positiveOnlyLabel": "仅正数",
"visTypeTimeseries.aggSelect.pipelineAggs.serialDifferenceLabel": "序列差分",
"visTypeTimeseries.aggSelect.selectAggPlaceholder": "选择聚合",
"visTypeTimeseries.aggSelect.siblingAggs.overallAverageLabel": "总体平均值",
"visTypeTimeseries.aggSelect.siblingAggs.overallMaxLabel": "总体最大值",
"visTypeTimeseries.aggSelect.siblingAggs.overallMinLabel": "总体最大值",
"visTypeTimeseries.aggSelect.siblingAggs.overallStdDeviationLabel": "总体标准偏差",
"visTypeTimeseries.aggSelect.siblingAggs.overallSumLabel": "总和",
"visTypeTimeseries.aggSelect.siblingAggs.overallSumOfSquaresLabel": "总平方和",
"visTypeTimeseries.aggSelect.siblingAggs.overallVarianceLabel": "总体方差",
"visTypeTimeseries.aggSelect.specialAggs.mathLabel": "数学",
"visTypeTimeseries.aggSelect.specialAggs.seriesAggLabel": "序列聚合",
"visTypeTimeseries.annotationsEditor.addDataSourceButtonLabel": "添加数据源",
"visTypeTimeseries.annotationsEditor.dataSourcesLabel": "数据源",
"visTypeTimeseries.annotationsEditor.fieldsLabel": "字段(必填 - 路径以逗号分隔)",
@ -4354,10 +4323,10 @@
"visTypeTimeseries.calculateLabel.bucketScriptsLabel": "存储桶脚本",
"visTypeTimeseries.calculateLabel.countLabel": "计数",
"visTypeTimeseries.calculateLabel.filterRatioLabel": "筛选比",
"visTypeTimeseries.calculateLabel.lookupMetricTypeOfMetricFieldRankLabel": "{metricField} 的 {lookupMetricType}",
"visTypeTimeseries.calculateLabel.lookupMetricTypeOfTargetLabel": "{targetLabel} 的 {lookupMetricType}",
"visTypeTimeseries.calculateLabel.lookupMetricTypeOfTargetWithAdditionalLabel": "{targetLabel} 的 {lookupMetricType} ({additionalLabel})",
"visTypeTimeseries.calculateLabel.mathLabel": "数学",
"visTypeTimeseries.calculateLabel.metricTypeOfMetricFieldRankLabel": "{metricField} 的 {metricTypeLabel}",
"visTypeTimeseries.calculateLabel.metricTypeOfTargetLabel": "{targetLabel} 的 {metricTypeLabel}",
"visTypeTimeseries.calculateLabel.metricTypeOfTargetWithAdditionalLabel": "{targetLabel} 的 {metricTypeLabel} ({additionalLabel})",
"visTypeTimeseries.calculateLabel.positiveRateLabel": "{field} 的计数率",
"visTypeTimeseries.calculateLabel.seriesAggLabel": "序列聚合 ({metricFunction})",
"visTypeTimeseries.calculateLabel.staticValueLabel": "{metricValue} 的静态值",