Skip to content

Commit

Permalink
[Telemetry] Remove ui_metric from the legacy codebase (#65739)
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo committed May 11, 2020
1 parent e67480d commit 49226dd
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 123 deletions.
30 changes: 0 additions & 30 deletions src/legacy/core_plugins/ui_metric/index.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/legacy/core_plugins/ui_metric/package.json

This file was deleted.

21 changes: 0 additions & 21 deletions src/legacy/core_plugins/ui_metric/public/index.ts

This file was deleted.

This file was deleted.

44 changes: 0 additions & 44 deletions src/plugins/usage_collection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,41 +126,6 @@ export function registerMyPluginUsageCollector(
}
```

### Migrating to NP from Legacy Plugins

Pass `usageCollection` to the setup NP plugin setup function under plugins. Inside the `setup` function call the `registerCollector` like what you'd do in the NP example above.

```js
// index.js
export const myPlugin = (kibana: any) => {
return new kibana.Plugin({
init: async function (server) {
const { usageCollection } = server.newPlatform.setup.plugins;
const plugins = {
usageCollection,
};
plugin(initializerContext).setup(core, plugins);
}
});
}
```

### Legacy Plugins

Typically, a plugin will create the collector object and register it with the Telemetry service from the `init` method of the plugin definition, or a helper module called from `init`.

```js
// index.js
export const myPlugin = (kibana: any) => {
return new kibana.Plugin({
init: async function (server) {
const { usageCollection } = server.newPlatform.setup.plugins;
registerMyPluginUsageCollector(usageCollection);
}
});
}
```

## Update the telemetry payload and telemetry cluster field mappings

There is a module in the telemetry service that creates the payload of data that gets sent up to the telemetry cluster.
Expand Down Expand Up @@ -239,15 +204,6 @@ To track a user interaction, use the `reportUiStats` method exposed by the plugi
}
```
Alternatively, in the Legacy world you can still import the `createUiStatsReporter` helper function from UI Metric app:
```js
import { createUiStatsReporter, METRIC_TYPE } from 'relative/path/to/src/legacy/core_plugins/ui_metric/public';
const trackMetric = createUiStatsReporter(`<AppName>`);
trackMetric(METRIC_TYPE.CLICK, `<EventName>`);
trackMetric('click', `<EventName>`);
```
Metric Types:
- `METRIC_TYPE.CLICK` for tracking clicks `trackMetric(METRIC_TYPE.CLICK, 'my_button_clicked');`
Expand Down

0 comments on commit 49226dd

Please sign in to comment.