-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Data table] Add telemetry for table vis split mode (#88604)
* Add telemetry for table vis * Update telemetry schema * Add unit tests * Update license * Use soClient instead of esClient, update tests Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
2ff5235
commit 72ef3b1
Showing
30 changed files
with
398 additions
and
56 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
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,9 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
export * from './types'; |
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,28 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
export const VIS_TYPE_TABLE = 'table'; | ||
|
||
export enum AggTypes { | ||
SUM = 'sum', | ||
AVG = 'avg', | ||
MIN = 'min', | ||
MAX = 'max', | ||
COUNT = 'count', | ||
} | ||
|
||
export interface TableVisParams { | ||
perPage: number | ''; | ||
showPartialRows: boolean; | ||
showMetricsAtAllLevels: boolean; | ||
showToolbar: boolean; | ||
showTotal: boolean; | ||
totalFunc: AggTypes; | ||
percentageCol: string; | ||
row?: boolean; | ||
} |
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
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
67 changes: 67 additions & 0 deletions
67
src/plugins/vis_type_table/server/usage_collector/get_stats.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,67 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
import { SavedObjectsClientContract } from 'kibana/server'; | ||
import { getStats } from './get_stats'; | ||
|
||
const mockVisualizations = { | ||
saved_objects: [ | ||
{ | ||
attributes: { | ||
visState: | ||
'{"type": "table","aggs": [{ "schema": "metric" }, { "schema": "bucket" }, { "schema": "split", "enabled": true }], "params": { "row": true }}', | ||
}, | ||
}, | ||
{ | ||
attributes: { | ||
visState: | ||
'{"type": "table","aggs": [{ "schema": "metric" }, { "schema": "bucket" }, { "schema": "split", "enabled": false }], "params": { "row": true }}', | ||
}, | ||
}, | ||
{ | ||
attributes: { | ||
visState: | ||
'{"type": "table","aggs": [{ "schema": "metric" }, { "schema": "split", "enabled": true }], "params": { "row": false }}', | ||
}, | ||
}, | ||
{ | ||
attributes: { | ||
visState: '{"type": "table","aggs": [{ "schema": "metric" }, { "schema": "bucket" }]}', | ||
}, | ||
}, | ||
{ | ||
attributes: { visState: '{"type": "histogram"}' }, | ||
}, | ||
], | ||
}; | ||
|
||
describe('vis_type_table getStats', () => { | ||
const mockSoClient = ({ | ||
find: jest.fn().mockResolvedValue(mockVisualizations), | ||
} as unknown) as SavedObjectsClientContract; | ||
|
||
test('Returns stats from saved objects for table vis only', async () => { | ||
const result = await getStats(mockSoClient); | ||
expect(mockSoClient.find).toHaveBeenCalledWith({ | ||
type: 'visualization', | ||
perPage: 10000, | ||
}); | ||
expect(result).toEqual({ | ||
total: 4, | ||
total_split: 3, | ||
split_columns: { | ||
total: 1, | ||
enabled: 1, | ||
}, | ||
split_rows: { | ||
total: 2, | ||
enabled: 1, | ||
}, | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.