forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc44066
commit 642d3f7
Showing
67 changed files
with
786 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ic/kibana-plugin-plugins-data-public.aggfunctionsmapping.aggsinglepercentile.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [AggFunctionsMapping](./kibana-plugin-plugins-data-public.aggfunctionsmapping.md) > [aggSinglePercentile](./kibana-plugin-plugins-data-public.aggfunctionsmapping.aggsinglepercentile.md) | ||
|
||
## AggFunctionsMapping.aggSinglePercentile property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
aggSinglePercentile: ReturnType<typeof aggSinglePercentile>; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...er/kibana-plugin-plugins-data-server.aggfunctionsmapping.aggsinglepercentile.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [AggFunctionsMapping](./kibana-plugin-plugins-data-server.aggfunctionsmapping.md) > [aggSinglePercentile](./kibana-plugin-plugins-data-server.aggfunctionsmapping.aggsinglepercentile.md) | ||
|
||
## AggFunctionsMapping.aggSinglePercentile property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
aggSinglePercentile: ReturnType<typeof aggSinglePercentile>; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
.../src/plugins/data/common/search/aggs/metrics/__snapshots__/single_percentile.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 145 additions & 0 deletions
145
branches/cases_rac_ui/src/plugins/data/common/search/aggs/metrics/single_percentile.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/* | ||
* 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 { AggConfigs, IAggConfigs } from '../agg_configs'; | ||
import { mockAggTypesRegistry } from '../test_helpers'; | ||
import { METRIC_TYPES } from './metric_agg_types'; | ||
|
||
describe('AggTypeMetricSinglePercentileProvider class', () => { | ||
let aggConfigs: IAggConfigs; | ||
|
||
beforeEach(() => { | ||
const typesRegistry = mockAggTypesRegistry(); | ||
const field = { | ||
name: 'bytes', | ||
}; | ||
const indexPattern = { | ||
id: '1234', | ||
title: 'logstash-*', | ||
fields: { | ||
getByName: () => field, | ||
filter: () => [field], | ||
}, | ||
} as any; | ||
|
||
aggConfigs = new AggConfigs( | ||
indexPattern, | ||
[ | ||
{ | ||
id: METRIC_TYPES.SINGLE_PERCENTILE, | ||
type: METRIC_TYPES.SINGLE_PERCENTILE, | ||
schema: 'metric', | ||
params: { | ||
field: 'bytes', | ||
percentile: 95, | ||
}, | ||
}, | ||
], | ||
{ | ||
typesRegistry, | ||
} | ||
); | ||
}); | ||
|
||
it('requests the percentiles aggregation in the Elasticsearch query DSL', () => { | ||
const dsl: Record<string, any> = aggConfigs.toDsl(); | ||
|
||
expect(dsl.single_percentile.percentiles.field).toEqual('bytes'); | ||
expect(dsl.single_percentile.percentiles.percents).toEqual([95]); | ||
}); | ||
|
||
it('points to right value within multi metric for value bucket path', () => { | ||
expect(aggConfigs.byId(METRIC_TYPES.SINGLE_PERCENTILE)!.getValueBucketPath()).toEqual( | ||
`${METRIC_TYPES.SINGLE_PERCENTILE}.95` | ||
); | ||
}); | ||
|
||
it('converts the response', () => { | ||
const agg = aggConfigs.getResponseAggs()[0]; | ||
|
||
expect( | ||
agg.getValue({ | ||
[agg.id]: { | ||
values: { | ||
'95.0': 123, | ||
}, | ||
}, | ||
}) | ||
).toEqual(123); | ||
}); | ||
|
||
it('produces the expected expression ast', () => { | ||
const agg = aggConfigs.getResponseAggs()[0]; | ||
expect(agg.toExpressionAst()).toMatchInlineSnapshot(` | ||
Object { | ||
"chain": Array [ | ||
Object { | ||
"arguments": Object { | ||
"enabled": Array [ | ||
true, | ||
], | ||
"field": Array [ | ||
"bytes", | ||
], | ||
"id": Array [ | ||
"single_percentile", | ||
], | ||
"percentile": Array [ | ||
95, | ||
], | ||
"schema": Array [ | ||
"metric", | ||
], | ||
}, | ||
"function": "aggSinglePercentile", | ||
"type": "function", | ||
}, | ||
], | ||
"type": "expression", | ||
} | ||
`); | ||
}); | ||
|
||
it('supports scripted fields', () => { | ||
const typesRegistry = mockAggTypesRegistry(); | ||
const field = { | ||
name: 'bytes', | ||
scripted: true, | ||
language: 'painless', | ||
script: 'return 456', | ||
}; | ||
const indexPattern = { | ||
id: '1234', | ||
title: 'logstash-*', | ||
fields: { | ||
getByName: () => field, | ||
filter: () => [field], | ||
}, | ||
} as any; | ||
|
||
aggConfigs = new AggConfigs( | ||
indexPattern, | ||
[ | ||
{ | ||
id: METRIC_TYPES.SINGLE_PERCENTILE, | ||
type: METRIC_TYPES.SINGLE_PERCENTILE, | ||
schema: 'metric', | ||
params: { | ||
field: 'bytes', | ||
percentile: 95, | ||
}, | ||
}, | ||
], | ||
{ | ||
typesRegistry, | ||
} | ||
); | ||
|
||
expect(aggConfigs.toDsl()).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.