-
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
[Reporting] Remove any
, improve telemetry schema for completeness
#111212
[Reporting] Remove any
, improve telemetry schema for completeness
#111212
Conversation
Pinging @elastic/kibana-app-services (Team:AppServices) |
Pinging @elastic/kibana-reporting-services (Team:Reporting Services) |
17ac8ca
to
4fea726
Compare
* 2.0. | ||
*/ | ||
|
||
import { DEPRECATED_JOB_TYPES } from '../../common/constants'; |
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.
This file was rewritten and renamed: decorate_range_stats.ts → get_export_stats.ts
Previously, this code had a tangle of type ambiguity in the getAvailableTotalForFeature
function
@@ -117,8 +119,7 @@ export type ReportingUsageType = RangeStats & { | |||
last7Days: RangeStats; | |||
}; | |||
|
|||
export type ExportType = 'csv' | 'csv_searchsource' | 'printable_pdf' | 'PNG'; | |||
export type FeatureAvailabilityMap = { [F in ExportType]: boolean }; | |||
export type FeatureAvailabilityMap = Record<string, boolean>; |
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.
Changed this to be indexed by string
instead ExportType
for easier maintenance.
Instead of keeping a hardcoded list of all the known export types, we can use exportTypesHandler.getJobTypes()
: it returns the jobTypes of all registered export types.
} = rangeStatsInput; | ||
|
||
// combine the known types with any unknown type found in reporting data | ||
const statsForExportType = exportTypesHandler.getJobTypes().reduce((accum, exportType) => { |
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.
exportTypesHandler.getJobTypes()
replaces the need for a hardcoded list of all the job types. See https://github.com/elastic/kibana/pull/111212/files#r702149771
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.
Thanks for cleaning up the types and clearly structured commits and comments 👍🏻
It looks like we need to add csv_searchsource_immediate as another export type to the telemetry schema. I'll approve because everything else looks good.
} | ||
|
||
// FIXME: find a way to get this from exportTypesHandler or common/constants |
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.
👍
@elasticmachine merge upstream |
}, | ||
"app": { | ||
"properties": { | ||
"search": { | ||
"type": "long" | ||
}, |
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.
@Bamieh that's a lot of additions, is that fine with you?
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.
Thanks for raising this @pgayvallet . The main reason why there are so many additions is that adding new export types multiplies what we track with telemetry:
- PNG
- CSV
- PDFv2
- PNGv2
- CSVv2
- CSV Immediate Download
For every export type, there is telemetry tracking for which apps were used, and what the layout options were.
This PR adds all of the V2 types to the schema
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.
I was on holidays this week. It is fine. better than the alternatives!
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
…lastic#111212) * [Reporting] Remove `any`, improve telemetry schema for completeness * remove another any * rename file per exported function * test variable name * use variable for DRY * update reporting telemetry contract * added csv_searchsource_immediate to telemetry * fix types * update jest snapshots * remove tests on large literal objects Co-authored-by: Jean-Louis Leysens <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
…111212) (#111665) * [Reporting] Remove `any`, improve telemetry schema for completeness * remove another any * rename file per exported function * test variable name * use variable for DRY * update reporting telemetry contract * added csv_searchsource_immediate to telemetry * fix types * update jest snapshots * remove tests on large literal objects Co-authored-by: Jean-Louis Leysens <[email protected]> Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Jean-Louis Leysens <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
Summary
Removes type ambiguity when the Reporting usage collector crafts the data for counting by exportType-per-app and layout-per-app.
app
andlayout
fields of the usage data applicable to all the export types, not just PDFsearch
. Or, CSV/PNG could have different layouts. Those use cases aren't supported in Kibana today but there's nothing blocking anyone from working on them.canvas workpad
andsearch
to the set of app names used as indexes in the of per-app usage data.canvas
to the set of layout names used as indexes in the per-layout usage data. (This should have been done in #84959(decorateRangeStats
togetExportStats
to use a better namePreviously, only the PDF export type was the only one to count the
app
andlayout
fields in the usage data. This is hard to maintain from a types point of view. Also, CSV exports could theoretically have been created from different apps, not just Discover.Notes
search
in fields that count the number of CSV reports created.jobType
field and is used to uniquely identify the export type for telemetry.Checklist