src/platform/plugins/shared/telemetry/README.md
Telemetry allows Kibana features to have usage tracked in the wild. The general term "telemetry" refers to multiple things:
This plugin is responsible for sending usage data to the telemetry cluster. For collecting usage data, use the usageCollection plugin
The setup function exposes the following interface:
getTelemetryUrl: () => Promise<URL>:
An async function that resolves into the telemetry Url used to send telemetry. The url is wrapped with node's URL constructor. Here is an example on how to grab the url origin:
const telemetryUrl = await getTelemetryUrl();
> telemetryUrl.origin; // 'https://telemetry.elastic.co'
getTelemetryUrl everytime before using the actual url.The start function exposes the following interface:
async getIsOptedIn(): Promise<boolean>:
An async function that resolves into true if the user has opted into send Elastic usage data.
Resolves to false if the user explicitly opted out of sending usage data to Elastic or did not choose
to opt-in or out yet after a minor or major upgrade (only when previously opted out).To use the exposed plugin start and setup contracts:
telemetry is in your optionalPlugins in the kibana.json file:// <plugin>/kibana.json
{
"id": "...",
"optionalPlugins": ["telemetry"]
}
// <plugin>/server/plugin.ts
import { TelemetryPluginsStart } from '../telemetry/server`;
interface MyPluginStartDeps {
telemetry?: TelemetryPluginsStart;
}
class MyPlugin {
public async start(
core: CoreStart,
{ telemetry }: MyPluginStartDeps
) {
const isOptedIn = await telemetry?.getIsOptedIn();
...
}
}
When developing any EBT events, sometimes, developers are not sure if their event will be as useful as they think. Setting the dev-only configuration telemetry.localShipper: true, all the EBT events will be indexed in the local ES under the indices ebt-kibana-browser and ebt-kibana-server.