mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[skip-ci] Fix README in usageCollection (#61137)
* Fix README in usageCollection * savedObjectsRepository instead of savedObjectsClient
This commit is contained in:
parent
be1953a4dc
commit
ec8ac301dd
1 changed files with 6 additions and 6 deletions
|
@ -83,14 +83,14 @@ import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
|
|||
import { CoreSetup, CoreStart } from 'kibana/server';
|
||||
|
||||
class Plugin {
|
||||
private savedObjectsClient?: ISavedObjectsRepository;
|
||||
private savedObjectsRepository?: ISavedObjectsRepository;
|
||||
|
||||
public setup(core: CoreSetup, plugins: { usageCollection?: UsageCollectionSetup }) {
|
||||
registerMyPluginUsageCollector(() => this.savedObjectsClient, plugins.usageCollection);
|
||||
registerMyPluginUsageCollector(() => this.savedObjectsRepository, plugins.usageCollection);
|
||||
}
|
||||
|
||||
public start(core: CoreStart) {
|
||||
this.savedObjectsClient = core.savedObjects.client
|
||||
this.savedObjectsRepository = core.savedObjects.createInternalRepository();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -101,7 +101,7 @@ import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
|
|||
import { ISavedObjectsRepository } from 'kibana/server';
|
||||
|
||||
export function registerMyPluginUsageCollector(
|
||||
getSavedObjectsClient: () => ISavedObjectsRepository | undefined,
|
||||
getSavedObjectsRepository: () => ISavedObjectsRepository | undefined,
|
||||
usageCollection?: UsageCollectionSetup
|
||||
): void {
|
||||
// usageCollection is an optional dependency, so make sure to return if it is not registered.
|
||||
|
@ -112,9 +112,9 @@ export function registerMyPluginUsageCollector(
|
|||
// create usage collector
|
||||
const myCollector = usageCollection.makeUsageCollector({
|
||||
type: MY_USAGE_TYPE,
|
||||
isReady: () => typeof getSavedObjectsClient() !== 'undefined',
|
||||
isReady: () => typeof getSavedObjectsRepository() !== 'undefined',
|
||||
fetch: async () => {
|
||||
const savedObjectsClient = getSavedObjectsClient()!;
|
||||
const savedObjectsRepository = getSavedObjectsRepository()!;
|
||||
// get something from the savedObjects
|
||||
|
||||
return { my_objects };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue