-
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
[Telemetry] Remove all usages of any
#98338
Conversation
7685387
to
efa6e35
Compare
any
any
in @kbn/analytics
and src/plugins/kibana_usage_collection
any
in @kbn/analytics
and src/plugins/kibana_usage_collection
any
23805d8
to
208437a
Compare
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.
Self-review
{ | ||
files: [ | ||
'packages/kbn-analytics/**', | ||
// 'packages/kbn-telemetry-tools/**', |
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.
Leaving this one for a PR on its own, since it requires a lot of changes.
import { UiCounterMetricType } from '@kbn/analytics'; | ||
import { UiSettingsType, StringValidation, ImageValidation } from '../../../../core/public'; | ||
|
||
export interface FieldSetting { | ||
displayName: string; | ||
name: string; | ||
value: unknown; | ||
description?: string; | ||
description?: string | ReactElement; |
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 change may become handy for #56498. The logic already handles both types, it was just the types that was outdated:
private async getStats(config: UnencryptedStatsGetterConfig): Promise<UsageStatsPayload[]>; | ||
private async getStats(config: EncryptedStatsGetterConfig): Promise<string[]>; |
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 overload helps in getting the right expected type depending on the usage.
@@ -55,9 +60,9 @@ export function registerStatsRoute({ | |||
}) { | |||
const getUsage = async ( | |||
esClient: ElasticsearchClient, | |||
savedObjectsClient: SavedObjectsClientContract | ISavedObjectsRepository, | |||
savedObjectsClient: SavedObjectsClientContract, |
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 don't know why TS didn't complain earlier. We migrated to SavedObjectsClientContract
-only way back in #93289 🤷
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.
LGTM. I've walked through the changes over github but haven't pulled the code locally. Thanks this is a huge effort
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.
Did not review the change as a whole, but the small addition to Kibana App code LGTM. Please update the description of this PR to indicate that you've followed the template.
💔 Backport failed
To backport manually run: |
# Conflicts: # src/plugins/telemetry/server/collectors/usage/ensure_deep_object.ts
💚 Build SucceededMetrics [docs]Public APIs missing comments
Any counts in public APIs
Public APIs missing exports
Page load bundle
History
To update your PR or re-run it, just comment with: cc @afharo |
Summary
Part of #93183: it removes all usages of
any
in favour of more explicit type definitions.As a side effect, the Advanced Settings
Field
component had its types updated to match the running logic:settings.description
can also be a React component.Checklist
For maintainers