mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Connection Details] Adds telemetry for user actions (#183265)
## Summary Closes https://github.com/elastic/kibana/issues/180869 Add tracking for the following user actions: - [x] "Learn more" click - [x] Tab switches - [x] Copy endpoint - [x] Show cloud ID - [x] Copy cloud ID - [x] Create API key - [x] "Manage API keys" click - [x] Key encoding change - [x] API key copy The emitted telemetry events are as follows: - `connection_details_learn_more_clicked` - `connection_details_tab_switched` - Has `tab` paramter - `connection_details_copy_endpoint_url_clicked` - `connection_details_show_cloud_id_toggled` - `connection_details_copy_cloud_id_clicked` - `connection_details_new_api_key_created` - `connection_details_manage_api_keys_clicked` - `connection_details_key_encoding_changed` - Has `format` paramter - `connection_details_copy_api_key_clicked` - Has `format` paramter ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### Risk Matrix Delete this section if it is not applicable to this PR. Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release. When forming the risk matrix, consider some of the following examples and how they may potentially impact the change: | Risk | Probability | Severity | Mitigation/Notes | |---------------------------|-------------|----------|-------------------------| | Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
297b5bd557
commit
012d62fe09
16 changed files with 214 additions and 28 deletions
|
@ -12,9 +12,10 @@ import { i18n } from '@kbn/i18n';
|
|||
|
||||
export interface CopyInputProps {
|
||||
value: string;
|
||||
onCopyClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
||||
}
|
||||
|
||||
export const CopyInput: React.FC<CopyInputProps> = ({ value }) => {
|
||||
export const CopyInput: React.FC<CopyInputProps> = ({ value, onCopyClick }) => {
|
||||
const textRef = React.useRef<HTMLSpanElement>(null);
|
||||
|
||||
return (
|
||||
|
@ -52,7 +53,10 @@ export const CopyInput: React.FC<CopyInputProps> = ({ value }) => {
|
|||
<EuiCopy textToCopy={value}>
|
||||
{(copy) => (
|
||||
<EuiButtonIcon
|
||||
onClick={copy}
|
||||
onClick={(event: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
onCopyClick?.(event);
|
||||
copy();
|
||||
}}
|
||||
iconType="copyClipboard"
|
||||
size="m"
|
||||
color={'text'}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import { EuiFlyout } from '@elastic/eui';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import {
|
||||
StoriesProvider,
|
||||
StoriesProviderKeyCreationError,
|
||||
|
@ -22,7 +23,7 @@ export default {
|
|||
export const Default = () => {
|
||||
return (
|
||||
<EuiFlyout size="s" onClose={() => {}}>
|
||||
<StoriesProvider>
|
||||
<StoriesProvider onTelemetryEvent={action('onTelemetryEvent')}>
|
||||
<ConnectionDetailsFlyoutContent />
|
||||
</StoriesProvider>
|
||||
</EuiFlyout>
|
||||
|
|
|
@ -17,11 +17,12 @@ import {
|
|||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { ConnectionDetails } from './connection_details';
|
||||
import { useConnectionDetailsOpts } from './context';
|
||||
import { useConnectionDetailsOpts, useConnectionDetailsService } from './context';
|
||||
import { Tabs } from './tabs';
|
||||
|
||||
export const ConnectionDetailsFlyoutContent: React.FC = () => {
|
||||
const ctx = useConnectionDetailsOpts();
|
||||
const service = useConnectionDetailsService();
|
||||
|
||||
const header = (
|
||||
<EuiFlyoutHeader hasBorder>
|
||||
|
@ -39,7 +40,15 @@ export const ConnectionDetailsFlyoutContent: React.FC = () => {
|
|||
defaultMessage: 'Connect to the Elasticsearch API by using the following details.',
|
||||
})}{' '}
|
||||
{!!ctx.links?.learnMore && (
|
||||
<EuiLink external href={ctx.links.learnMore} target="_blank">
|
||||
// Below onClick is used only for telemetry, but `href` is the real
|
||||
// semantic action.
|
||||
// eslint-disable-next-line @elastic/eui/href-or-on-click
|
||||
<EuiLink
|
||||
external
|
||||
href={ctx.links.learnMore}
|
||||
target="_blank"
|
||||
onClick={() => service.emitTelemetryEvent(['learn_more_clicked'])}
|
||||
>
|
||||
{i18n.translate('cloud.connectionDetails.learnMoreButtonLabel', {
|
||||
defaultMessage: 'Learn more',
|
||||
})}
|
||||
|
|
|
@ -19,6 +19,7 @@ export interface ConnectionDetailsGlobalDependencies {
|
|||
http: CoreStart['http'];
|
||||
application: CoreStart['application'];
|
||||
overlays: CoreStart['overlays'];
|
||||
analytics?: CoreStart['analytics'];
|
||||
};
|
||||
plugins: {
|
||||
cloud?: CloudStart;
|
||||
|
|
|
@ -17,7 +17,7 @@ import { useAsyncMemo } from '../hooks/use_async_memo';
|
|||
|
||||
const createOpts = async (props: KibanaConnectionDetailsProviderProps) => {
|
||||
const { options, start } = props;
|
||||
const { http, docLinks } = start.core;
|
||||
const { http, docLinks, analytics } = start.core;
|
||||
const locator = start.plugins?.share?.url?.locators.get('MANAGEMENT_APP_LOCATOR');
|
||||
const manageKeysLink = await locator?.getUrl({ sectionId: 'security', appId: 'api_keys' });
|
||||
const result: ConnectionDetailsOpts = {
|
||||
|
@ -68,6 +68,51 @@ const createOpts = async (props: KibanaConnectionDetailsProviderProps) => {
|
|||
hasPermission: async () => true,
|
||||
...options?.apiKeys,
|
||||
},
|
||||
onTelemetryEvent: (event) => {
|
||||
if (!analytics) return;
|
||||
switch (event[0]) {
|
||||
case 'learn_more_clicked': {
|
||||
analytics.reportEvent('connection_details_learn_more_clicked', {});
|
||||
break;
|
||||
}
|
||||
case 'tab_switched': {
|
||||
analytics.reportEvent('connection_details_tab_switched', { tab: event[1]!.tab });
|
||||
break;
|
||||
}
|
||||
case 'copy_endpoint_url_clicked': {
|
||||
analytics.reportEvent('connection_details_copy_endpoint_url_clicked', {});
|
||||
break;
|
||||
}
|
||||
case 'show_cloud_id_toggled': {
|
||||
analytics.reportEvent('connection_details_show_cloud_id_toggled', {});
|
||||
break;
|
||||
}
|
||||
case 'copy_cloud_id_clicked': {
|
||||
analytics.reportEvent('connection_details_copy_cloud_id_clicked', {});
|
||||
break;
|
||||
}
|
||||
case 'new_api_key_created': {
|
||||
analytics.reportEvent('connection_details_new_api_key_created', {});
|
||||
break;
|
||||
}
|
||||
case 'manage_api_keys_clicked': {
|
||||
analytics.reportEvent('connection_details_manage_api_keys_clicked', {});
|
||||
break;
|
||||
}
|
||||
case 'key_encoding_changed': {
|
||||
analytics.reportEvent('connection_details_key_encoding_changed', {
|
||||
format: event[1]!.format,
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'copy_api_key_clicked': {
|
||||
analytics.reportEvent('connection_details_copy_api_key_clicked', {
|
||||
format: event[1]!.format,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return result;
|
||||
|
@ -83,6 +128,7 @@ export interface KibanaConnectionDetailsProviderProps {
|
|||
theme: CoreStart['theme'];
|
||||
http?: CoreStart['http'];
|
||||
application?: CoreStart['application'];
|
||||
analytics?: CoreStart['analytics'];
|
||||
};
|
||||
plugins?: {
|
||||
cloud?: CloudStart;
|
||||
|
|
|
@ -10,7 +10,7 @@ import { BehaviorSubject } from 'rxjs';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { ApiKey } from './tabs/api_keys_tab/views/success_form/types';
|
||||
import type { Format } from './tabs/api_keys_tab/views/success_form/format_select';
|
||||
import type { ConnectionDetailsOpts, TabID } from './types';
|
||||
import type { ConnectionDetailsOpts, TabID, ConnectionDetailsTelemetryEvents } from './types';
|
||||
|
||||
export class ConnectionDetailsService {
|
||||
public readonly tabId$ = new BehaviorSubject<TabID>('endpoints');
|
||||
|
@ -39,6 +39,7 @@ export class ConnectionDetailsService {
|
|||
};
|
||||
|
||||
public readonly toggleShowCloudId = () => {
|
||||
this.emitTelemetryEvent(['show_cloud_id_toggled']);
|
||||
this.showCloudId$.next(!this.showCloudId$.getValue());
|
||||
};
|
||||
|
||||
|
@ -48,6 +49,7 @@ export class ConnectionDetailsService {
|
|||
};
|
||||
|
||||
public readonly setApiKeyFormat = (format: Format) => {
|
||||
this.emitTelemetryEvent(['key_encoding_changed', { format }]);
|
||||
this.apiKeyFormat$.next(format);
|
||||
};
|
||||
|
||||
|
@ -76,6 +78,7 @@ export class ConnectionDetailsService {
|
|||
name: this.apiKeyName$.getValue(),
|
||||
});
|
||||
this.apiKey$.next(apiKey);
|
||||
this.emitTelemetryEvent(['new_api_key_created']);
|
||||
} catch (error) {
|
||||
this.apiKeyError$.next(error);
|
||||
} finally {
|
||||
|
@ -88,4 +91,13 @@ export class ConnectionDetailsService {
|
|||
this.apiKeyError$.next(error);
|
||||
});
|
||||
};
|
||||
|
||||
public readonly emitTelemetryEvent = (event: ConnectionDetailsTelemetryEvents) => {
|
||||
try {
|
||||
this.opts.onTelemetryEvent?.(event);
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Error emitting telemetry event', error);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -41,8 +41,15 @@ const defaultOpts: ConnectionDetailsOpts = {
|
|||
},
|
||||
};
|
||||
|
||||
export const StoriesProvider: React.FC = ({ children }) => {
|
||||
return <ConnectionDetailsOptsProvider {...defaultOpts}>{children}</ConnectionDetailsOptsProvider>;
|
||||
export const StoriesProvider: React.FC<Partial<ConnectionDetailsOpts>> = ({
|
||||
children,
|
||||
...rest
|
||||
}) => {
|
||||
return (
|
||||
<ConnectionDetailsOptsProvider {...{ ...defaultOpts, ...rest }}>
|
||||
{children}
|
||||
</ConnectionDetailsOptsProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export const StoriesProviderKeyCreationError: React.FC = ({ children }) => {
|
||||
|
|
|
@ -21,7 +21,10 @@ export const ManageKeysLink: React.FC = () => {
|
|||
return (
|
||||
<SpaNoRouterLink
|
||||
url={link}
|
||||
go={service.opts?.navigateToUrl}
|
||||
go={() => {
|
||||
service.emitTelemetryEvent(['manage_api_keys_clicked']);
|
||||
service.opts?.navigateToUrl?.(link);
|
||||
}}
|
||||
data-test-subj={'connectionDetailsManageApiKeysLink'}
|
||||
>
|
||||
{i18n.translate('cloud.connectionDetails.apiKeys.managerLinkLabel', {
|
||||
|
|
|
@ -23,6 +23,7 @@ export const SuccessForm: React.FC = () => {
|
|||
apiKey={apiKey}
|
||||
format={format}
|
||||
onFormatChange={service.setApiKeyFormat}
|
||||
onCopyClick={() => service.emitTelemetryEvent(['copy_api_key_clicked', { format }])}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -18,12 +18,14 @@ export interface SuccessFormControlledProps {
|
|||
apiKey: ApiKey;
|
||||
format: Format;
|
||||
onFormatChange: (format: Format) => void;
|
||||
onCopyClick?: () => void;
|
||||
}
|
||||
|
||||
export const SuccessFormControlled: React.FC<SuccessFormControlledProps> = ({
|
||||
apiKey,
|
||||
format,
|
||||
onFormatChange,
|
||||
onCopyClick,
|
||||
}) => {
|
||||
const keyValue = format === 'encoded' ? apiKey.encoded : `${apiKey.id}:${apiKey.key}`;
|
||||
|
||||
|
@ -62,7 +64,7 @@ export const SuccessFormControlled: React.FC<SuccessFormControlledProps> = ({
|
|||
fullWidth
|
||||
data-test-subj={'connectionDetailsApiKeyValueRow'}
|
||||
>
|
||||
<CopyInput value={keyValue} />
|
||||
<CopyInput value={keyValue} onCopyClick={onCopyClick} />
|
||||
</EuiFormRow>
|
||||
</EuiCallOut>
|
||||
|
||||
|
|
|
@ -8,19 +8,35 @@
|
|||
|
||||
import { EuiForm } from '@elastic/eui';
|
||||
import * as React from 'react';
|
||||
import { useConnectionDetailsOpts } from '../../context';
|
||||
import { useConnectionDetailsOpts, useConnectionDetailsService } from '../../context';
|
||||
import { useBehaviorSubject } from '../../hooks/use_behavior_subject';
|
||||
import { CloudIdRow } from './rows/cloud_id_row';
|
||||
import { EndpointUrlRow } from './rows/endpoints_url_row';
|
||||
|
||||
export const EndpointsTab: React.FC = () => {
|
||||
const { endpoints } = useConnectionDetailsOpts();
|
||||
const service = useConnectionDetailsService();
|
||||
const showCloudId = useBehaviorSubject(service.showCloudId$);
|
||||
|
||||
if (!endpoints) return null;
|
||||
|
||||
return (
|
||||
<EuiForm component="div">
|
||||
{!!endpoints?.url && <EndpointUrlRow url={endpoints.url} />}
|
||||
{!!endpoints?.id && <CloudIdRow value={endpoints.id} />}
|
||||
{!!endpoints?.url && (
|
||||
<EndpointUrlRow
|
||||
url={endpoints.url}
|
||||
onCopyClick={() => service.emitTelemetryEvent(['copy_endpoint_url_clicked'])}
|
||||
/>
|
||||
)}
|
||||
{!!endpoints?.id && (
|
||||
<CloudIdRow
|
||||
value={endpoints.id}
|
||||
showCloudId={showCloudId}
|
||||
learnMoreUrl={service.opts.endpoints?.cloudIdLearMoreLink}
|
||||
onShowCloudIdToggle={service.toggleShowCloudId}
|
||||
onCopyClick={() => service.emitTelemetryEvent(['copy_cloud_id_clicked'])}
|
||||
/>
|
||||
)}
|
||||
</EuiForm>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -10,18 +10,23 @@ import * as React from 'react';
|
|||
import { EuiFormRow, EuiSpacer, EuiSwitch } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { CopyInput } from '../../../../components/copy_input';
|
||||
import { useConnectionDetailsService } from '../../../../context';
|
||||
import { useBehaviorSubject } from '../../../../hooks/use_behavior_subject';
|
||||
import { Label } from './label';
|
||||
|
||||
export interface CloudIdRowProps {
|
||||
value: string;
|
||||
showCloudId: boolean;
|
||||
learnMoreUrl?: string;
|
||||
onShowCloudIdToggle: () => void;
|
||||
onCopyClick?: () => void;
|
||||
}
|
||||
|
||||
export const CloudIdRow: React.FC<CloudIdRowProps> = ({ value }) => {
|
||||
const service = useConnectionDetailsService();
|
||||
const showCloudId = useBehaviorSubject(service.showCloudId$);
|
||||
|
||||
export const CloudIdRow: React.FC<CloudIdRowProps> = ({
|
||||
value,
|
||||
showCloudId,
|
||||
learnMoreUrl,
|
||||
onShowCloudIdToggle,
|
||||
onCopyClick,
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<EuiSpacer size="l" />
|
||||
|
@ -31,7 +36,7 @@ export const CloudIdRow: React.FC<CloudIdRowProps> = ({ value }) => {
|
|||
defaultMessage: 'Show Cloud ID',
|
||||
})}
|
||||
checked={showCloudId}
|
||||
onChange={service.toggleShowCloudId}
|
||||
onChange={() => onShowCloudIdToggle()}
|
||||
data-test-subj="connectionDetailsCloudIdSwitch"
|
||||
/>
|
||||
|
||||
|
@ -39,7 +44,7 @@ export const CloudIdRow: React.FC<CloudIdRowProps> = ({ value }) => {
|
|||
|
||||
{showCloudId && (
|
||||
<EuiFormRow
|
||||
label={<Label learnMoreUrl={service.opts.endpoints?.cloudIdLearMoreLink} />}
|
||||
label={<Label learnMoreUrl={learnMoreUrl} />}
|
||||
helpText={i18n.translate('cloud.connectionDetails.tab.endpoints.cloudIdField.helpText', {
|
||||
defaultMessage:
|
||||
'Specific client libraries and connectors can use this unique identifier specific to Elastic Cloud.',
|
||||
|
@ -47,7 +52,7 @@ export const CloudIdRow: React.FC<CloudIdRowProps> = ({ value }) => {
|
|||
fullWidth
|
||||
data-test-subj="connectionDetailsCloudId"
|
||||
>
|
||||
<CopyInput value={value} />
|
||||
<CopyInput value={value} onCopyClick={() => onCopyClick?.()} />
|
||||
</EuiFormRow>
|
||||
)}
|
||||
</>
|
||||
|
|
|
@ -13,9 +13,10 @@ import { CopyInput } from '../../../components/copy_input';
|
|||
|
||||
export interface EndpointUrlProps {
|
||||
url: string;
|
||||
onCopyClick?: () => void;
|
||||
}
|
||||
|
||||
export const EndpointUrlRow: React.FC<EndpointUrlProps> = ({ url }) => {
|
||||
export const EndpointUrlRow: React.FC<EndpointUrlProps> = ({ url, onCopyClick }) => {
|
||||
return (
|
||||
<EuiFormRow
|
||||
label={i18n.translate('cloud.connectionDetails.tab.endpoints.endpointField.label', {
|
||||
|
@ -27,7 +28,7 @@ export const EndpointUrlRow: React.FC<EndpointUrlProps> = ({ url }) => {
|
|||
fullWidth
|
||||
data-test-subj="connectionDetailsEsUrl"
|
||||
>
|
||||
<CopyInput value={url} />
|
||||
<CopyInput value={url} onCopyClick={() => onCopyClick?.()} />
|
||||
</EuiFormRow>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -13,6 +13,7 @@ export interface ConnectionDetailsOpts {
|
|||
endpoints?: ConnectionDetailsOptsEndpoints;
|
||||
apiKeys?: ConnectionDetailsOptsApiKeys;
|
||||
navigateToUrl?: (url: string) => void;
|
||||
onTelemetryEvent?: (event: ConnectionDetailsTelemetryEvents) => void;
|
||||
}
|
||||
|
||||
export interface ConnectionDetailsOptsLinks {
|
||||
|
@ -33,4 +34,20 @@ export interface ConnectionDetailsOptsApiKeys {
|
|||
hasPermission: () => Promise<boolean>;
|
||||
}
|
||||
|
||||
export type ConnectionDetailsTelemetryEvent<EventId extends string, EventPayload = void> = [
|
||||
id: EventId,
|
||||
payload?: EventPayload
|
||||
];
|
||||
|
||||
export type ConnectionDetailsTelemetryEvents =
|
||||
| ConnectionDetailsTelemetryEvent<'learn_more_clicked'>
|
||||
| ConnectionDetailsTelemetryEvent<'tab_switched', { tab: string }>
|
||||
| ConnectionDetailsTelemetryEvent<'copy_endpoint_url_clicked'>
|
||||
| ConnectionDetailsTelemetryEvent<'show_cloud_id_toggled'>
|
||||
| ConnectionDetailsTelemetryEvent<'copy_cloud_id_clicked'>
|
||||
| ConnectionDetailsTelemetryEvent<'new_api_key_created'>
|
||||
| ConnectionDetailsTelemetryEvent<'manage_api_keys_clicked'>
|
||||
| ConnectionDetailsTelemetryEvent<'key_encoding_changed', { format: string }>
|
||||
| ConnectionDetailsTelemetryEvent<'copy_api_key_clicked', { format: string }>;
|
||||
|
||||
export type TabID = 'endpoints' | 'apiKeys';
|
||||
|
|
|
@ -26,7 +26,7 @@ describe('Cloud Links Plugin - public', () => {
|
|||
|
||||
describe('start', () => {
|
||||
beforeEach(() => {
|
||||
plugin.setup();
|
||||
plugin.setup(coreMock.createSetup());
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import type { CoreStart, Plugin } from '@kbn/core/public';
|
||||
import type { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import type { CloudSetup, CloudStart } from '@kbn/cloud-plugin/public';
|
||||
import type { SecurityPluginSetup, SecurityPluginStart } from '@kbn/security-plugin/public';
|
||||
import type { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public';
|
||||
|
@ -30,7 +30,68 @@ interface CloudLinksDepsStart {
|
|||
export class CloudLinksPlugin
|
||||
implements Plugin<void, void, CloudLinksDepsSetup, CloudLinksDepsStart>
|
||||
{
|
||||
public setup() {}
|
||||
public setup({ analytics }: CoreSetup) {
|
||||
analytics.registerEventType({
|
||||
eventType: 'connection_details_learn_more_clicked',
|
||||
schema: {},
|
||||
});
|
||||
analytics.registerEventType({
|
||||
eventType: 'connection_details_tab_switched',
|
||||
schema: {
|
||||
tab: {
|
||||
type: 'keyword',
|
||||
_meta: {
|
||||
description: 'Connection details tab that was switched to.',
|
||||
optional: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
analytics.registerEventType({
|
||||
eventType: 'connection_details_copy_endpoint_url_clicked',
|
||||
schema: {},
|
||||
});
|
||||
analytics.registerEventType({
|
||||
eventType: 'connection_details_show_cloud_id_toggled',
|
||||
schema: {},
|
||||
});
|
||||
analytics.registerEventType({
|
||||
eventType: 'connection_details_copy_cloud_id_clicked',
|
||||
schema: {},
|
||||
});
|
||||
analytics.registerEventType({
|
||||
eventType: 'connection_details_new_api_key_created',
|
||||
schema: {},
|
||||
});
|
||||
analytics.registerEventType({
|
||||
eventType: 'connection_details_manage_api_keys_clicked',
|
||||
schema: {},
|
||||
});
|
||||
analytics.registerEventType({
|
||||
eventType: 'connection_details_key_encoding_changed',
|
||||
schema: {
|
||||
format: {
|
||||
type: 'keyword',
|
||||
_meta: {
|
||||
description: 'The format of the API key that was changed to.',
|
||||
optional: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
analytics.registerEventType({
|
||||
eventType: 'connection_details_copy_api_key_clicked',
|
||||
schema: {
|
||||
format: {
|
||||
type: 'keyword',
|
||||
_meta: {
|
||||
description: 'The format of the API key that was copied.',
|
||||
optional: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
public start(core: CoreStart, plugins: CloudLinksDepsStart) {
|
||||
const { cloud, security, guidedOnboarding, share } = plugins;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue