-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Data table] Add telemetry for table vis split mode #88604
Merged
sulemanof
merged 10 commits into
elastic:master
from
sulemanof:feat/table_vis_telemetry
Jan 25, 2021
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a2e9ece
Add telemetry for table vis
a158b46
Update telemetry schema
4fcaf23
Merge remote-tracking branch 'upstream/master' into feat/table_vis_te…
6ddebee
Add unit tests
c29fce7
Merge remote-tracking branch 'upstream/master' into feat/table_vis_te…
e5aef31
Merge remote-tracking branch 'upstream/master' into feat/table_vis_te…
35f1303
Update license
0fcec9d
Merge remote-tracking branch 'upstream/master' into feat/table_vis_te…
6508fae
Use soClient instead of esClient, update tests
700a9d2
Merge branch 'master' into feat/table_vis_telemetry
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure we want to commit that? My objection is that if all plugins enable coverage generation, this will increase the already long CI execution time. If you feel that we really need it, probably it make sense to do it in a separate PR
also if I'm not wrong with
collectCoverateFrom
we should also usercollectCoverage
:true/false
paramThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This string doesn't affect the CI somehow, since the CI doesn't use
--coverage
flag.This setting is only handy for local testing. So you can open a terminal right in the plugin folder and run
yarn test:jest --coverage
, test coverage will be collected just for thevis_type_table
plugin.If you skip the setting, the global one will be used (
packages/kbn-test/jest-preset.js
), which will collect all of the files, including the plugin's one.