Skip to content

Commit

Permalink
[ML] Fix the file upload telemetry (#157888)
Browse files Browse the repository at this point in the history
## Summary

Fixes the usage collector for the file upload plugin. According to the
git history it hasn't been working since
#60418.

The saved objects repository required for retrieving telemetry data
wasn't provided, causing telemetry to fall back to
`index_creation_count: 0` after each check.


### How to test 

Execute the following request in the Dev Console.

```
POST kbn:/api/telemetry/v2/clusters/_stats
{ "unencrypted": true }
```


[`mlUsage`](https://github.com/elastic/kibana/blob/9047d69d574225212996ea9dbcd15dddc607d11e/x-pack/plugins/file_upload/server/telemetry/usage_collector.ts#L36)
shouldn't be `null`.
  • Loading branch information
darnautov committed May 17, 2023
1 parent 4eccf31 commit 57af98f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CoreSetup } from '@kbn/core/server';
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
import { getTelemetry, initTelemetry, Telemetry } from './telemetry';
import { telemetryMappingsType } from './mappings';
import { setInternalRepository } from './internal_repository';
import { getInternalRepository, setInternalRepository } from './internal_repository';

export function initFileUploadTelemetry(
coreSetup: CoreSetup,
Expand All @@ -33,7 +33,7 @@ function registerUsageCollector(usageCollectionSetup: UsageCollectionSetup): voi
},
},
fetch: async () => {
const mlUsage = await getTelemetry();
const mlUsage = await getTelemetry(getInternalRepository()!);
if (!mlUsage) {
return initTelemetry();
}
Expand Down

0 comments on commit 57af98f

Please sign in to comment.