Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
53ba336
feat: Added UI for AI v2 with a blank page
robester0403 Nov 27, 2025
1f25ea1
Merge branch 'main' into aiv2-ui-setup
robester0403 Nov 27, 2025
0e57071
Changes from node scripts/lint_packages --fix
kibanamachine Nov 27, 2025
a9aeb37
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine Nov 28, 2025
6d5256b
fix: ts errors
robester0403 Nov 28, 2025
1e0386e
Merge origin/aiv2-ui-setup
robester0403 Nov 28, 2025
e0c1e89
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine Nov 28, 2025
045f7ce
Merge branch 'main' into aiv2-ui-setup
robester0403 Nov 28, 2025
77fc2f7
chore: update bundle limits due to adding new plugin
robester0403 Nov 28, 2025
13a7e79
Merge branch 'aiv2-ui-setup' of https://github.com/robester0403/kiban…
robester0403 Nov 28, 2025
da77414
Chore: update limits
robester0403 Nov 28, 2025
13b0633
Merge branch 'main' into aiv2-ui-setup
robester0403 Dec 1, 2025
a580dc2
Chore: Removed changes to fleet folder, renamed create integration to…
robester0403 Dec 1, 2025
10fa931
Merge branch 'main' into aiv2-ui-setup
robester0403 Dec 1, 2025
ea6c5e6
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine Dec 1, 2025
48793db
feat: added telemetry and prospective list of events to be used.
robester0403 Dec 2, 2025
744d6bd
Merge upstream/main into feature branch
robester0403 Dec 3, 2025
1f49afc
fix: merge linter issues
robester0403 Dec 3, 2025
c4b7821
Fix: Revert unneeded changes from merge
robester0403 Dec 3, 2025
e64f7c2
Fix: removed unneeded optimizer changes
robester0403 Dec 3, 2025
553b79d
Merge branch 'main' into aiv2-telemetry-context
robester0403 Dec 3, 2025
ce682ae
Changes from node scripts/lint_ts_projects --fix
kibanamachine Dec 3, 2025
ad44adb
Changes from node scripts/regenerate_moon_projects.js --update
kibanamachine Dec 3, 2025
3926f6b
Merge branch 'main' into aiv2-telemetry-context
robester0403 Dec 3, 2025
e8813a1
Chore: update limits
robester0403 Dec 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pageLoadAssetSize:
apm: 38573
apmSourcesAccess: 2278
automaticImport: 12162
automaticImportVTwo: 4694
automaticImportVTwo: 8223
banners: 4087
canvas: 15142
cases: 153204
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependsOn:
- '@kbn/i18n'
- '@kbn/features-plugin'
- '@kbn/task-manager-plugin'
- '@kbn/core-analytics-browser'
tags:
- plugin
- prod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,35 @@ import ReactDOM from 'react-dom';
import type { AppMountParameters, CoreStart } from '@kbn/core/public';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { IntegrationManagement } from './components/integration_management/integration_management';
import { TelemetryContextProvider } from './components/integration_management/telemetry';
import type { Services } from './services/types';
import type { TelemetryService } from './services/telemetry/service';
import type { AutomaticImportPluginStartDependencies } from './types';

export const renderApp = ({
coreStart,
plugins,
params,
telemetry,
}: {
coreStart: CoreStart;
plugins: AutomaticImportPluginStartDependencies;
params: AppMountParameters;
telemetry: TelemetryService;
}) => {
const { element } = params;
const services: Services = {
...coreStart,
...plugins,
telemetry,
};

ReactDOM.render(
coreStart.rendering.addContext(
<KibanaContextProvider services={services}>
<IntegrationManagement />
<TelemetryContextProvider>
<IntegrationManagement />
</TelemetryContextProvider>
</KibanaContextProvider>
),
element
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export { useKibana } from './use_kibana';
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { useKibana as _useKibana } from '@kbn/kibana-react-plugin/public';
import type { Services } from '../../services';

export const useKibana = () => _useKibana<Services>();
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export { useKibana } from './hooks';
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React, { useCallback, useMemo, useRef } from 'react';
import { v4 as uuidV4 } from 'uuid';
import { TelemetryEventType } from '../../services/telemetry/types';
import { useKibana } from '../../common/hooks/use_kibana';

type ReportIntegrationManagementOpen = () => void;

type ReportDataStreamFlyoutOpen = (params: { datastreamName: string }) => void;

type ReportUploadLogsComplete = (params: { datastreamName: string; error?: string }) => void;

type ReportViewResultsFlyoutOpen = (params: {
datastreamName: string;
sampleRows: number;
model: string;
provider: string;
error?: string;
}) => void;

type ReportAutomaticImportComplete = (params: {
integrationName: string;
integrationDescription: string;
dataStreamNames: string[];
inputTypes: string[];
actionTypeId: string;
model: string;
provider: string;
error?: string;
}) => void;

interface TelemetryContextProps {
reportIntegrationManagementOpen: ReportIntegrationManagementOpen;
reportDataStreamFlyoutOpen: ReportDataStreamFlyoutOpen;
reportUploadLogsComplete: ReportUploadLogsComplete;
reportViewResultsFlyoutOpen: ReportViewResultsFlyoutOpen;
reportAutomaticImportComplete: ReportAutomaticImportComplete;
}

const TelemetryContext = React.createContext<TelemetryContextProps | null>(null);

/**
* Hook to easily use telemetry reporting functions.
* Restricted by the events defined in the telemetry service.
* @throws Error if used outside provider
*/
export const useTelemetry = () => {
const context = React.useContext(TelemetryContext);
if (!context) {
throw new Error('useTelemetry must be used within a TelemetryContextProvider');
}
return context;
};

export const TelemetryContextProvider: React.FC<{ children: React.ReactNode }> = React.memo(
({ children }) => {
const sessionData = useRef({ sessionId: uuidV4(), startedAt: Date.now() });
const { telemetry } = useKibana().services;

const reportIntegrationManagementOpen = useCallback<ReportIntegrationManagementOpen>(() => {
const sessionId = uuidV4();
sessionData.current = { sessionId, startedAt: Date.now() };
telemetry.reportEvent(TelemetryEventType.IntegrationManagementOpen, {
sessionId,
});
}, [telemetry]);

const reportDataStreamFlyoutOpen = useCallback<ReportDataStreamFlyoutOpen>(
({ datastreamName }) => {
telemetry.reportEvent(TelemetryEventType.CreateManageDataStreamFlyoutOpen, {
sessionId: sessionData.current.sessionId,
datastreamName,
});
},
[telemetry]
);

const reportUploadLogsComplete = useCallback<ReportUploadLogsComplete>(
({ datastreamName, error }) => {
telemetry.reportEvent(TelemetryEventType.UploadDatastreamLogsZipCompleteData, {
datastreamName,
errorMessage: error,
});
},
[telemetry]
);

const reportViewResultsFlyoutOpen = useCallback<ReportViewResultsFlyoutOpen>(
({ datastreamName, sampleRows, model, provider, error }) => {
telemetry.reportEvent(TelemetryEventType.ViewResultsFlyoutOpen, {
sessionId: sessionData.current.sessionId,
datastreamName,
sampleRows,
model,
provider,
errorMessage: error,
});
},
[telemetry]
);

const reportAutomaticImportComplete = useCallback<ReportAutomaticImportComplete>(
({
integrationName,
integrationDescription,
dataStreamNames,
inputTypes,
actionTypeId,
model,
provider,
error,
}) => {
telemetry.reportEvent(TelemetryEventType.AutomaticImportComplete, {
sessionId: sessionData.current.sessionId,
integrationName,
integrationDescription,
dataStreamNames,
inputTypes,
actionTypeId,
model,
provider,
errorMessage: error,
});
},
[telemetry]
);

const value = useMemo<TelemetryContextProps>(
() => ({
reportIntegrationManagementOpen,
reportDataStreamFlyoutOpen,
reportUploadLogsComplete,
reportViewResultsFlyoutOpen,
reportAutomaticImportComplete,
}),
[
reportIntegrationManagementOpen,
reportDataStreamFlyoutOpen,
reportUploadLogsComplete,
reportViewResultsFlyoutOpen,
reportAutomaticImportComplete,
]
);

return <TelemetryContext.Provider value={value}>{children}</TelemetryContext.Provider>;
}
);
TelemetryContextProvider.displayName = 'TelemetryContextProvider';
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,34 @@ import type {
AutomaticImportPluginStart,
AutomaticImportPluginStartDependencies,
} from './types';
import { Telemetry } from './services/telemetry/service';

export class AutomaticImportPlugin
implements Plugin<AutomaticImportPluginSetup, AutomaticImportPluginStart>
{
private telemetry = new Telemetry();

constructor(_: PluginInitializerContext) {}

public setup(
core: CoreSetup<AutomaticImportPluginStartDependencies, AutomaticImportPluginStart>
): AutomaticImportPluginSetup {
this.telemetry.setup(core.analytics);

const telemetry = this.telemetry;
core.application.register({
id: PLUGIN_ID,
title: PLUGIN_NAME,
visibleIn: [],
async mount(params: AppMountParameters) {
const { renderApp } = await import('./application');
const [coreStart, plugins] = await core.getStartServices();
return renderApp({ coreStart, plugins, params });
return renderApp({
coreStart,
plugins,
params,
telemetry: telemetry.start(),
});
},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export type * from './types';
export { Telemetry } from './telemetry/service';
Loading