Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Onboarding] Additional auto-detect flow telemetry
Browse files Browse the repository at this point in the history
mykolaharmash committed Jan 22, 2025
1 parent dd37080 commit 6be0e21
Showing 16 changed files with 147 additions and 393 deletions.
Original file line number Diff line number Diff line change
@@ -15,38 +15,44 @@ interface ObservabilityOnboardingIntegrationTelemetryFields {
}

interface FlowEventFields {
flow?: string;
step?: string;
step_status?: string;
flow_type: string;
flow_id: string;
step: string;
step_status: string;
step_message?: string;
uses_legacy_onboarding_page: boolean;
payload?: {
integrations?: ObservabilityOnboardingIntegrationTelemetryFields[];
};
}

type ObservabilityOnboardingTelemetryEvent = EventTypeOpts<FlowEventFields>;

export const OBSERVABILITY_ONBOARDING_TELEMETRY_EVENT: ObservabilityOnboardingTelemetryEvent = {
eventType: 'observability_onboarding',
schema: {
flow: {
flow_type: {
type: 'keyword',
_meta: {
description:
"The current onboarding flow user is going through (e.g. 'system_logs', 'nginx'). If not present, user is on the landing screen.",
optional: true,
"The current onboarding flow type user is going through (e.g. 'autoDetect', 'logFiles', 'kubernetes'). If not present, user is on the landing screen.",
},
},
flow_id: {
type: 'keyword',
_meta: {
description: 'Unique identifier of the current onboarding session',
},
},
step: {
type: 'keyword',
_meta: {
description: 'The current step in the onboarding flow.',
optional: true,
},
},
step_status: {
type: 'keyword',
_meta: {
description: 'The status of the step in the onboarding flow.',
optional: true,
},
},
step_message: {
@@ -56,10 +62,41 @@ export const OBSERVABILITY_ONBOARDING_TELEMETRY_EVENT: ObservabilityOnboardingTe
optional: true,
},
},
uses_legacy_onboarding_page: {
type: 'boolean',
payload: {
properties: {
integrations: {
type: 'array',
items: {
properties: {
installSource: {
type: 'keyword',
_meta: {
description:
'The source of the package used to create the integration. Usually "registry" or "custom".',
},
},
pkgName: {
type: 'keyword',
_meta: {
description: 'The name of the package used to create the integration.',
},
},
pkgVersion: {
type: 'keyword',
_meta: {
description: 'The version of the package used to create the integration.',
},
},
title: { type: 'keyword', _meta: { description: 'The visual name of the package.' } },
},
},
_meta: {
optional: true,
},
},
},
_meta: {
description: 'Whether the user is using the legacy onboarding page or the new one',
optional: true,
},
},
},
@@ -87,48 +124,6 @@ export const OBSERVABILITY_ONBOARDING_FEEDBACK_TELEMETRY_EVENT: EventTypeOpts<{
},
};

type ObservabilityOnboardingAutodetectTelemetryEvent = EventTypeOpts<
FlowEventFields & {
integrations?: ObservabilityOnboardingIntegrationTelemetryFields[];
}
>;

export const OBSERVABILITY_ONBOARDING_AUTODETECT_TELEMETRY_EVENT: ObservabilityOnboardingAutodetectTelemetryEvent =
{
eventType: 'observability_onboarding_autodetect',
schema: {
...OBSERVABILITY_ONBOARDING_TELEMETRY_EVENT.schema,
integrations: {
type: 'array',
items: {
properties: {
installSource: {
type: 'keyword',
_meta: {
description:
'The source of the package used to create the integration. Usually "registry" or "custom".',
},
},
pkgName: {
type: 'keyword',
_meta: {
description: 'The name of the package used to create the integration.',
},
},
pkgVersion: {
type: 'keyword',
_meta: { description: 'The version of the package used to create the integration.' },
},
title: { type: 'keyword', _meta: { description: 'The visual name of the package.' } },
},
},
_meta: {
optional: true,
},
},
},
};

interface OnboardingFirehoseFlowEventContext {
selectedCreateStackOption?: string;
cloudServiceProvider?: string;
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@ import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app';
import { Router } from '@kbn/shared-ux-router';
import React from 'react';
import ReactDOM from 'react-dom';
import { OBSERVABILITY_ONBOARDING_TELEMETRY_EVENT } from '../../common/telemetry_events';
import { AppContext, ConfigSchema, ObservabilityOnboardingAppServices } from '..';
import { ObservabilityOnboardingHeaderActionMenu } from './shared/header_action_menu';
import {
@@ -53,10 +52,6 @@ export function ObservabilityOnboardingAppRoot({
context,
};

core.analytics.reportEvent(OBSERVABILITY_ONBOARDING_TELEMETRY_EVENT.eventType, {
uses_legacy_onboarding_page: false,
});

return (
<KibanaRenderContextProvider {...core}>
<div className={APP_WRAPPER_CLASS}>
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@ import { GetStartedPanel } from '../shared/get_started_panel';
import { isSupportedLogo, LogoIcon } from '../../shared/logo_icon';
import { FeedbackButtons } from '../shared/feedback_buttons';
import { ObservabilityOnboardingContextValue } from '../../../plugin';
import { useAutoDetectTelemetry } from './use_auto_detect_telemetry';
import { SupportedIntegrationsList } from './supported_integrations_list';

export const AutoDetectPanel: FunctionComponent = () => {
@@ -43,16 +42,6 @@ export const AutoDetectPanel: FunctionComponent = () => {
services: { share },
} = useKibana<ObservabilityOnboardingContextValue>();

useAutoDetectTelemetry(
status,
installedIntegrations.map(({ title, pkgName, pkgVersion, installSource }) => ({
title,
pkgName,
pkgVersion,
installSource,
}))
);

if (error) {
return <EmptyPrompt onboardingFlowType="auto-detect" error={error} onRetryClick={refetch} />;
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -9,6 +9,8 @@ import useInterval from 'react-use/lib/useInterval';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import useAsync from 'react-use/lib/useAsync';
import { type AssetSOObject, type GetBulkAssetsResponse } from '@kbn/fleet-plugin/common';
import { useEffect, useState } from 'react';
import { OBSERVABILITY_ONBOARDING_TELEMETRY_EVENT } from '../../../../common/telemetry_events';
import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher';
import { getOnboardingStatus } from './get_onboarding_status';
import { getInstalledIntegrations } from './get_installed_integrations';
@@ -32,8 +34,9 @@ export const DASHBOARDS = {

export function useOnboardingFlow() {
const {
services: { fleet },
services: { fleet, analytics },
} = useKibana<ObservabilityOnboardingContextValue>();
const [dataReceivedTelemetrySent, setDataReceivedTelemetrySent] = useState(false);

// Create onboarding session
const { data, error, refetch } = useFetcher(
@@ -105,6 +108,18 @@ export function useOnboardingFlow() {
progressStatus === FETCH_STATUS.SUCCESS && status !== 'dataReceived' ? 3000 : null
);

useEffect(() => {
if (status === 'dataReceived' && !dataReceivedTelemetrySent) {
setDataReceivedTelemetrySent(true);
analytics.reportEvent(OBSERVABILITY_ONBOARDING_TELEMETRY_EVENT.eventType, {
flow_type: 'autoDetect',
flow_id: onboardingId,
step: 'logs-ingest',
step_status: 'complete',
});
}
}, [analytics, dataReceivedTelemetrySent, onboardingId, status]);

return {
data,
error,
Loading

0 comments on commit 6be0e21

Please sign in to comment.