[ML] AIOps: Cleanup context/embeddingOrigin (#194442)

## Summary

Part of #187772.

We had a mix of passing around `embeddingOrigin` via props and context.
This PR cleans this up, `embeddingOrigin` is now be required to be
passed in on the outer most component and will then be used internally
via context only.

The PR also renames references to `AppDependencies` to
`AiopsAppContextValue`. Originally, this context was used only to pass
in dependencies to be used via `useKibana`. Over time this changed a bit
and we started passing in other non-changing values, the naming change
now reflects that more properly and brings the name in line with the
other context related vars like `AiopsAppContext.Provider` and
`useAiopsAppContext`.


### Checklist

- [ ] [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
- [x] 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)
This commit is contained in:
Walter Rafelsberger 2024-10-07 17:32:18 +02:00 committed by GitHub
parent 17fcaa5c8e
commit ae36dd5bf2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 243 additions and 264 deletions

View file

@ -12,6 +12,7 @@ import { METRIC_TYPE, UiCounterMetricType } from '@kbn/analytics';
import { type EmbeddablePatternAnalysisInput } from '@kbn/aiops-log-pattern-analysis/embeddable';
import { pick } from 'lodash';
import type { LogCategorizationEmbeddableProps } from '@kbn/aiops-plugin/public/components/log_categorization/log_categorization_for_embeddable/log_categorization_for_discover';
import type { AiopsAppContextValue } from '@kbn/aiops-plugin/public/hooks/use_aiops_app_context';
import { useDiscoverServices } from '../../../../hooks/use_discover_services';
import type { DiscoverStateContainer } from '../../state_management/discover_state';
import { PATTERN_ANALYSIS_LOADED } from './constants';
@ -63,8 +64,11 @@ export const PatternAnalysisTable = (props: PatternAnalysisTableProps) => {
return (
<aiopsService.PatternAnalysisComponent
props={patternAnalysisComponentProps}
deps={services}
embeddingOrigin="discover"
appContextValue={
// TODO We shouldn't cast to `unknown` here, goal is to use feature specific contexts.
// See https://github.com/elastic/kibana/pull/194442
{ embeddingOrigin: 'discover', ...services } as unknown as AiopsAppContextValue
}
/>
);
};

View file

@ -16,9 +16,15 @@ export const AIOPS_API_ENDPOINT = {
CATEGORIZATION_FIELD_VALIDATION: '/internal/aiops/categorization_field_validation',
} as const;
export const AIOPS_TELEMETRY_ID = {
AIOPS_DEFAULT_SOURCE: 'ml_aiops_labs',
AIOPS_ANALYSIS_RUN_ORIGIN: 'aiops-analysis-run-origin',
} as const;
/**
* Used for telemetry purposes to track the origin of the analysis run.
*/
export const AIOPS_ANALYSIS_RUN_ORIGIN = 'aiops-analysis-run-origin';
export const EMBEDDABLE_ORIGIN = 'embeddable';
export const AIOPS_EMBEDDABLE_ORIGIN = {
CASES: 'cases',
DASHBOARD: 'dashboard',
DEFAULT: 'embeddable',
DISCOVER: 'discover',
ML_AIOPS_LABS: 'ml_aiops_labs',
} as const;

View file

@ -24,10 +24,10 @@ import {
mlTimefilterRefresh$,
} from '@kbn/ml-date-picker';
import { UI_SETTINGS } from '@kbn/data-plugin/common';
import { AIOPS_TELEMETRY_ID } from '@kbn/aiops-common/constants';
import { AIOPS_EMBEDDABLE_ORIGIN } from '@kbn/aiops-common/constants';
import { DataSourceContext } from '../../hooks/use_data_source';
import type { AiopsAppDependencies } from '../../hooks/use_aiops_app_context';
import type { AiopsAppContextValue } from '../../hooks/use_aiops_app_context';
import { AiopsAppContext } from '../../hooks/use_aiops_app_context';
import { AIOPS_STORAGE_KEYS } from '../../types/storage';
@ -52,8 +52,8 @@ export interface ChangePointDetectionAppStateProps {
dataView: DataView;
/** The saved search to analyze. */
savedSearch: SavedSearch | null;
/** App dependencies */
appDependencies: AiopsAppDependencies;
/** App context value */
appContextValue: AiopsAppContextValue;
/** Optional flag to indicate whether kibana is running in serverless */
showFrozenDataTierChoice?: boolean;
}
@ -61,11 +61,11 @@ export interface ChangePointDetectionAppStateProps {
export const ChangePointDetectionAppState: FC<ChangePointDetectionAppStateProps> = ({
dataView,
savedSearch,
appDependencies,
appContextValue,
showFrozenDataTierChoice = true,
}) => {
const datePickerDeps: DatePickerDependencies = {
...pick(appDependencies, ['data', 'http', 'notifications', 'theme', 'uiSettings', 'i18n']),
...pick(appContextValue, ['data', 'http', 'notifications', 'theme', 'uiSettings', 'i18n']),
uiSettingsKeys: UI_SETTINGS,
showFrozenDataTierChoice,
};
@ -80,19 +80,19 @@ export const ChangePointDetectionAppState: FC<ChangePointDetectionAppStateProps>
return <>{warning}</>;
}
appDependencies.embeddingOrigin = AIOPS_TELEMETRY_ID.AIOPS_DEFAULT_SOURCE;
appContextValue.embeddingOrigin = AIOPS_EMBEDDABLE_ORIGIN.ML_AIOPS_LABS;
const PresentationContextProvider =
appDependencies.presentationUtil?.ContextProvider ?? React.Fragment;
appContextValue.presentationUtil?.ContextProvider ?? React.Fragment;
const CasesContext = appDependencies.cases?.ui.getCasesContext() ?? React.Fragment;
const casesPermissions = appDependencies.cases?.helpers.canUseCases();
const CasesContext = appContextValue.cases?.ui.getCasesContext() ?? React.Fragment;
const casesPermissions = appContextValue.cases?.helpers.canUseCases();
return (
<PresentationContextProvider>
<KibanaThemeProvider theme={appDependencies.theme}>
<KibanaThemeProvider theme={appContextValue.theme}>
<CasesContext owner={[]} permissions={casesPermissions!}>
<AiopsAppContext.Provider value={appDependencies}>
<AiopsAppContext.Provider value={appContextValue}>
<UrlStateProvider>
<DataSourceContext.Provider value={{ dataView, savedSearch }}>
<StorageContextProvider storage={localStorage} storageKeys={AIOPS_STORAGE_KEYS}>

View file

@ -15,10 +15,9 @@ import { UrlStateProvider } from '@kbn/ml-url-state';
import { Storage } from '@kbn/kibana-utils-plugin/public';
import { DatePickerContextProvider, type DatePickerDependencies } from '@kbn/ml-date-picker';
import { UI_SETTINGS } from '@kbn/data-plugin/common';
import { AIOPS_TELEMETRY_ID } from '@kbn/aiops-common/constants';
import { DataSourceContext } from '../../hooks/use_data_source';
import type { AiopsAppDependencies } from '../../hooks/use_aiops_app_context';
import type { AiopsAppContextValue } from '../../hooks/use_aiops_app_context';
import { AIOPS_STORAGE_KEYS } from '../../types/storage';
import { AiopsAppContext } from '../../hooks/use_aiops_app_context';
@ -35,8 +34,8 @@ export interface LogCategorizationAppStateProps {
dataView: DataView;
/** The saved search to analyze. */
savedSearch: SavedSearch | null;
/** App dependencies */
appDependencies: AiopsAppDependencies;
/** App context value */
appContextValue: AiopsAppContextValue;
/** Optional flag to indicate whether kibana is running in serverless */
showFrozenDataTierChoice?: boolean;
}
@ -44,7 +43,7 @@ export interface LogCategorizationAppStateProps {
export const LogCategorizationAppState: FC<LogCategorizationAppStateProps> = ({
dataView,
savedSearch,
appDependencies,
appContextValue,
showFrozenDataTierChoice = true,
}) => {
if (!dataView) return null;
@ -56,18 +55,18 @@ export const LogCategorizationAppState: FC<LogCategorizationAppStateProps> = ({
}
const datePickerDeps: DatePickerDependencies = {
...pick(appDependencies, ['data', 'http', 'notifications', 'theme', 'uiSettings', 'i18n']),
...pick(appContextValue, ['data', 'http', 'notifications', 'theme', 'uiSettings', 'i18n']),
uiSettingsKeys: UI_SETTINGS,
showFrozenDataTierChoice,
};
return (
<AiopsAppContext.Provider value={appDependencies}>
<AiopsAppContext.Provider value={appContextValue}>
<UrlStateProvider>
<DataSourceContext.Provider value={{ dataView, savedSearch }}>
<StorageContextProvider storage={localStorage} storageKeys={AIOPS_STORAGE_KEYS}>
<DatePickerContextProvider {...datePickerDeps}>
<LogCategorizationPage embeddingOrigin={AIOPS_TELEMETRY_ID.AIOPS_DEFAULT_SOURCE} />
<LogCategorizationPage />
</DatePickerContextProvider>
</StorageContextProvider>
</DataSourceContext.Provider>

View file

@ -19,7 +19,7 @@ import type { FieldValidationResults } from '@kbn/ml-category-validator';
import type { Category } from '@kbn/aiops-log-pattern-analysis/types';
import type { CategorizationAdditionalFilter } from '@kbn/aiops-log-pattern-analysis/create_category_request';
import { AIOPS_TELEMETRY_ID } from '@kbn/aiops-common/constants';
import { AIOPS_ANALYSIS_RUN_ORIGIN } from '@kbn/aiops-common/constants';
import type { EmbeddablePatternAnalysisInput } from '@kbn/aiops-log-pattern-analysis/embeddable';
import { css } from '@emotion/react';
import { useTableState } from '@kbn/ml-in-memory-table/hooks/use_table_state';
@ -270,7 +270,7 @@ export const LogCategorizationDiscover: FC<LogCategorizationEmbeddableProps> = (
searchQuery,
runtimeMappings,
{
[AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin,
[AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin,
}
),
runCategorizeRequest(

View file

@ -7,67 +7,40 @@
import type { FC } from 'react';
import React, { Suspense } from 'react';
import type { ThemeServiceStart } from '@kbn/core-theme-browser';
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import type { IUiSettingsClient } from '@kbn/core/public';
import type { CoreStart } from '@kbn/core/public';
import type { LensPublicStart } from '@kbn/lens-plugin/public';
import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public';
import type { ChartsPluginStart } from '@kbn/charts-plugin/public';
import type { UiActionsStart } from '@kbn/ui-actions-plugin/public';
import { pick } from 'lodash';
import { DatePickerContextProvider } from '@kbn/ml-date-picker';
import { StorageContextProvider } from '@kbn/ml-local-storage';
import { pick } from 'lodash';
import { UI_SETTINGS } from '@kbn/data-plugin/public';
import { Storage } from '@kbn/kibana-utils-plugin/public';
import { AIOPS_STORAGE_KEYS } from '../../../types/storage';
import type { AiopsAppDependencies } from '../../../hooks/use_aiops_app_context';
import { AiopsAppContext } from '../../../hooks/use_aiops_app_context';
import { AiopsAppContext, type AiopsAppContextValue } from '../../../hooks/use_aiops_app_context';
import type { LogCategorizationEmbeddableProps } from './log_categorization_for_discover';
import { LogCategorizationDiscover } from './log_categorization_for_discover';
export interface EmbeddableLogCategorizationDeps {
theme: ThemeServiceStart;
data: DataPublicPluginStart;
uiSettings: IUiSettingsClient;
http: CoreStart['http'];
notifications: CoreStart['notifications'];
i18n: CoreStart['i18n'];
lens: LensPublicStart;
fieldFormats: FieldFormatsStart;
application: CoreStart['application'];
charts: ChartsPluginStart;
uiActions: UiActionsStart;
}
export interface LogCategorizationEmbeddableWrapperProps {
deps: EmbeddableLogCategorizationDeps;
appContextValue: AiopsAppContextValue;
props: LogCategorizationEmbeddableProps;
embeddingOrigin?: string;
}
const localStorage = new Storage(window.localStorage);
export const LogCategorizationDiscoverWrapper: FC<LogCategorizationEmbeddableWrapperProps> = ({
deps,
appContextValue,
props,
embeddingOrigin,
}) => {
const I18nContext = deps.i18n.Context;
const aiopsAppContextValue = {
embeddingOrigin,
...deps,
} as unknown as AiopsAppDependencies;
const I18nContext = appContextValue.i18n.Context;
const datePickerDeps = {
...pick(deps, ['data', 'http', 'notifications', 'theme', 'uiSettings', 'i18n']),
...pick(appContextValue, ['data', 'http', 'notifications', 'theme', 'uiSettings', 'i18n']),
uiSettingsKeys: UI_SETTINGS,
};
return (
<I18nContext>
<AiopsAppContext.Provider value={aiopsAppContextValue}>
<AiopsAppContext.Provider value={appContextValue}>
<DatePickerContextProvider {...datePickerDeps}>
<StorageContextProvider storage={localStorage} storageKeys={AIOPS_STORAGE_KEYS}>
<Suspense fallback={null}>

View file

@ -18,7 +18,7 @@ import type { Category } from '@kbn/aiops-log-pattern-analysis/types';
import type { CategorizationAdditionalFilter } from '@kbn/aiops-log-pattern-analysis/create_category_request';
import type { EmbeddablePatternAnalysisInput } from '@kbn/aiops-log-pattern-analysis/embeddable';
import { useTableState } from '@kbn/ml-in-memory-table/hooks/use_table_state';
import { AIOPS_TELEMETRY_ID } from '@kbn/aiops-common/constants';
import { AIOPS_ANALYSIS_RUN_ORIGIN } from '@kbn/aiops-common/constants';
import datemath from '@elastic/datemath';
import useMountedState from 'react-use/lib/useMountedState';
import { useFilterQueryUpdates } from '../../../hooks/use_filters_query';
@ -224,7 +224,7 @@ export const LogCategorizationEmbeddable: FC<LogCategorizationEmbeddableProps> =
searchQuery,
runtimeMappings,
{
[AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin,
[AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin,
}
),
runCategorizeRequest(

View file

@ -28,7 +28,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { usePageUrlState } from '@kbn/ml-url-state';
import type { FieldValidationResults } from '@kbn/ml-category-validator';
import { AIOPS_TELEMETRY_ID } from '@kbn/aiops-common/constants';
import { AIOPS_ANALYSIS_RUN_ORIGIN } from '@kbn/aiops-common/constants';
import type { CategorizationAdditionalFilter } from '@kbn/aiops-log-pattern-analysis/create_category_request';
import type { Category } from '@kbn/aiops-log-pattern-analysis/types';
@ -64,8 +64,6 @@ export interface LogCategorizationPageProps {
savedSearch: SavedSearch | null;
selectedField: DataViewField;
onClose: () => void;
/** Identifier to indicate the plugin utilizing the component */
embeddingOrigin: string;
additionalFilter?: CategorizationAdditionalFilter;
}
@ -76,7 +74,6 @@ export const LogCategorizationFlyout: FC<LogCategorizationPageProps> = ({
savedSearch,
selectedField,
onClose,
embeddingOrigin,
additionalFilter,
}) => {
const {
@ -85,6 +82,7 @@ export const LogCategorizationFlyout: FC<LogCategorizationPageProps> = ({
query: { getState },
},
uiSettings,
embeddingOrigin,
} = useAiopsAppContext();
const { runValidateFieldRequest, cancelRequest: cancelValidationRequest } =
@ -198,7 +196,7 @@ export const LogCategorizationFlyout: FC<LogCategorizationPageProps> = ({
searchQuery,
runtimeMappings,
{
[AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin,
[AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin,
}
),
runCategorizeRequest(

View file

@ -28,10 +28,10 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { usePageUrlState, useUrlState } from '@kbn/ml-url-state';
import type { FieldValidationResults } from '@kbn/ml-category-validator';
import type { SearchQueryLanguage } from '@kbn/ml-query-utils';
import { AIOPS_TELEMETRY_ID } from '@kbn/aiops-common/constants';
import { AIOPS_ANALYSIS_RUN_ORIGIN } from '@kbn/aiops-common/constants';
import type { Category } from '@kbn/aiops-log-pattern-analysis/types';
import { useTableState } from '@kbn/ml-in-memory-table/hooks/use_table_state';
import { useDataSource } from '../../hooks/use_data_source';
import { useData } from '../../hooks/use_data';
import { useSearch } from '../../hooks/use_search';
@ -59,14 +59,10 @@ import { useActions } from './category_table/use_actions';
const BAR_TARGET = 20;
const DEFAULT_SELECTED_FIELD = 'message';
interface LogCategorizationPageProps {
/** Identifier to indicate the plugin utilizing the component */
embeddingOrigin: string;
}
export const LogCategorizationPage: FC<LogCategorizationPageProps> = ({ embeddingOrigin }) => {
export const LogCategorizationPage: FC = () => {
const {
notifications: { toasts },
embeddingOrigin,
} = useAiopsAppContext();
const { dataView, savedSearch } = useDataSource();
@ -229,7 +225,7 @@ export const LogCategorizationPage: FC<LogCategorizationPageProps> = ({ embeddin
searchQuery,
runtimeMappings,
{
[AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin,
[AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin,
}
),

View file

@ -21,7 +21,7 @@ import { StorageContextProvider } from '@kbn/ml-local-storage';
import type { CategorizationAdditionalFilter } from '@kbn/aiops-log-pattern-analysis/create_category_request';
import type { AiopsPluginStartDeps } from '../../types';
import { LogCategorizationFlyout } from './log_categorization_for_flyout';
import { AiopsAppContext, type AiopsAppDependencies } from '../../hooks/use_aiops_app_context';
import { AiopsAppContext, type AiopsAppContextValue } from '../../hooks/use_aiops_app_context';
import { AIOPS_STORAGE_KEYS } from '../../types/storage';
const localStorage = new Storage(window.localStorage);
@ -43,13 +43,14 @@ export async function showCategorizeFlyout(
resolve();
};
const appDependencies: AiopsAppDependencies = {
const appContextValue: AiopsAppContextValue = {
embeddingOrigin: originatingApp,
...coreStart,
...plugins,
};
const startServices = pick(coreStart, 'analytics', 'i18n', 'theme');
const datePickerDeps: DatePickerDependencies = {
...pick(appDependencies, ['data', 'http', 'notifications', 'theme', 'uiSettings']),
...pick(appContextValue, ['data', 'http', 'notifications', 'theme', 'uiSettings']),
i18n,
uiSettingsKeys: UI_SETTINGS,
};
@ -61,7 +62,7 @@ export async function showCategorizeFlyout(
...coreStart,
}}
>
<AiopsAppContext.Provider value={appDependencies}>
<AiopsAppContext.Provider value={appContextValue}>
<DatePickerContextProvider {...datePickerDeps}>
<StorageContextProvider storage={localStorage} storageKeys={AIOPS_STORAGE_KEYS}>
<LogCategorizationFlyout
@ -69,7 +70,6 @@ export async function showCategorizeFlyout(
savedSearch={null}
selectedField={field}
onClose={onFlyoutClose}
embeddingOrigin={originatingApp}
additionalFilter={additionalFilter}
/>
</StorageContextProvider>

View file

@ -18,7 +18,7 @@ import { DatePickerContextProvider, type DatePickerDependencies } from '@kbn/ml-
import { UI_SETTINGS } from '@kbn/data-plugin/common';
import { LogRateAnalysisReduxProvider } from '@kbn/aiops-log-rate-analysis/state';
import type { AiopsAppDependencies } from '../../hooks/use_aiops_app_context';
import type { AiopsAppContextValue } from '../../hooks/use_aiops_app_context';
import { AiopsAppContext } from '../../hooks/use_aiops_app_context';
import { DataSourceContext } from '../../hooks/use_data_source';
import { AIOPS_STORAGE_KEYS } from '../../types/storage';
@ -36,8 +36,8 @@ export interface LogRateAnalysisAppStateProps {
dataView: DataView;
/** The saved search to analyze. */
savedSearch: SavedSearch | null;
/** App dependencies */
appDependencies: AiopsAppDependencies;
/** App context value */
appContextValue: AiopsAppContextValue;
/** Optional flag to indicate whether to show contextual insights */
showContextualInsights?: boolean;
/** Optional flag to indicate whether kibana is running in serverless */
@ -47,7 +47,7 @@ export interface LogRateAnalysisAppStateProps {
export const LogRateAnalysisAppState: FC<LogRateAnalysisAppStateProps> = ({
dataView,
savedSearch,
appDependencies,
appContextValue,
showContextualInsights = false,
showFrozenDataTierChoice = true,
}) => {
@ -60,13 +60,13 @@ export const LogRateAnalysisAppState: FC<LogRateAnalysisAppStateProps> = ({
}
const datePickerDeps: DatePickerDependencies = {
...pick(appDependencies, ['data', 'http', 'notifications', 'theme', 'uiSettings', 'i18n']),
...pick(appContextValue, ['data', 'http', 'notifications', 'theme', 'uiSettings', 'i18n']),
uiSettingsKeys: UI_SETTINGS,
showFrozenDataTierChoice,
};
return (
<AiopsAppContext.Provider value={appDependencies}>
<AiopsAppContext.Provider value={appContextValue}>
<UrlStateProvider>
<DataSourceContext.Provider value={{ dataView, savedSearch }}>
<LogRateAnalysisReduxProvider>

View file

@ -60,8 +60,6 @@ export interface LogRateAnalysisContentProps {
onAnalysisCompleted?: (d: LogRateAnalysisResultsData) => void;
/** Optional callback that exposes current window parameters */
onWindowParametersChange?: (wp?: WindowParameters, replace?: boolean) => void;
/** Identifier to indicate the plugin utilizing the component */
embeddingOrigin: string;
}
export const LogRateAnalysisContent: FC<LogRateAnalysisContentProps> = ({
@ -70,7 +68,6 @@ export const LogRateAnalysisContent: FC<LogRateAnalysisContentProps> = ({
barHighlightColorOverride,
onAnalysisCompleted,
onWindowParametersChange,
embeddingOrigin,
}) => {
const dispatch = useAppDispatch();
@ -218,7 +215,6 @@ export const LogRateAnalysisContent: FC<LogRateAnalysisContentProps> = ({
searchQuery={searchQuery}
barColorOverride={barColorOverride}
barHighlightColorOverride={barHighlightColorOverride}
embeddingOrigin={embeddingOrigin}
/>
)}
{showNoAutoRunEmptyPrompt && (

View file

@ -21,7 +21,7 @@ import { UI_SETTINGS } from '@kbn/data-plugin/common';
import { LogRateAnalysisReduxProvider } from '@kbn/aiops-log-rate-analysis/state';
import { timeSeriesDataViewWarning } from '../../../application/utils/time_series_dataview_check';
import { AiopsAppContext, type AiopsAppDependencies } from '../../../hooks/use_aiops_app_context';
import { AiopsAppContext, type AiopsAppContextValue } from '../../../hooks/use_aiops_app_context';
import { DataSourceContext } from '../../../hooks/use_data_source';
import { AIOPS_STORAGE_KEYS } from '../../../types/storage';
@ -39,7 +39,7 @@ export interface LogRateAnalysisContentWrapperProps {
/** The data view to analyze. */
dataView: DataView;
/** App dependencies */
appDependencies: AiopsAppDependencies;
appContextValue: AiopsAppContextValue;
/** Timestamp for start of initial analysis */
initialAnalysisStart?: number | WindowParameters;
/** Optional time range */
@ -57,13 +57,11 @@ export interface LogRateAnalysisContentWrapperProps {
onAnalysisCompleted?: (d: LogRateAnalysisResultsData) => void;
/** Optional flag to indicate whether kibana is running in serverless */
showFrozenDataTierChoice?: boolean;
/** Identifier to indicate the plugin utilizing the component */
embeddingOrigin: string;
}
export const LogRateAnalysisContentWrapper: FC<LogRateAnalysisContentWrapperProps> = ({
dataView,
appDependencies,
appContextValue,
initialAnalysisStart,
timeRange,
esSearchQuery,
@ -71,7 +69,6 @@ export const LogRateAnalysisContentWrapper: FC<LogRateAnalysisContentWrapperProp
barHighlightColorOverride,
onAnalysisCompleted,
showFrozenDataTierChoice = true,
embeddingOrigin,
}) => {
if (!dataView) return null;
@ -82,13 +79,13 @@ export const LogRateAnalysisContentWrapper: FC<LogRateAnalysisContentWrapperProp
}
const datePickerDeps = {
...pick(appDependencies, ['data', 'http', 'notifications', 'theme', 'uiSettings', 'i18n']),
...pick(appContextValue, ['data', 'http', 'notifications', 'theme', 'uiSettings', 'i18n']),
uiSettingsKeys: UI_SETTINGS,
showFrozenDataTierChoice,
};
return (
<AiopsAppContext.Provider value={appDependencies}>
<AiopsAppContext.Provider value={appContextValue}>
<UrlStateProvider>
<DataSourceContext.Provider value={{ dataView, savedSearch: null }}>
<LogRateAnalysisReduxProvider initialAnalysisStart={initialAnalysisStart}>
@ -103,7 +100,6 @@ export const LogRateAnalysisContentWrapper: FC<LogRateAnalysisContentWrapperProp
barColorOverride={barColorOverride}
barHighlightColorOverride={barHighlightColorOverride}
onAnalysisCompleted={onAnalysisCompleted}
embeddingOrigin={embeddingOrigin}
/>
</DatePickerContextProvider>
</StorageContextProvider>

View file

@ -19,7 +19,6 @@ import { FilterStateStore } from '@kbn/es-query';
import { useUrlState, usePageUrlState } from '@kbn/ml-url-state';
import type { SearchQueryLanguage } from '@kbn/ml-query-utils';
import type { WindowParameters } from '@kbn/aiops-log-rate-analysis';
import { AIOPS_TELEMETRY_ID } from '@kbn/aiops-common/constants';
import {
useAppDispatch,
useCurrentSelectedSignificantItem,
@ -311,7 +310,6 @@ export const LogRateAnalysisPage: FC<LogRateAnalysisPageProps> = ({
</EuiFlexItem>
<EuiFlexItem>
<LogRateAnalysisContent
embeddingOrigin={AIOPS_TELEMETRY_ID.AIOPS_DEFAULT_SOURCE}
esSearchQuery={searchQuery}
onWindowParametersChange={onWindowParametersHandler}
onAnalysisCompleted={onAnalysisCompleted}

View file

@ -38,7 +38,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import type { SignificantItem, SignificantItemGroup } from '@kbn/ml-agg-utils';
import { useStorage } from '@kbn/ml-local-storage';
import { AIOPS_TELEMETRY_ID } from '@kbn/aiops-common/constants';
import { AIOPS_ANALYSIS_RUN_ORIGIN } from '@kbn/aiops-common/constants';
import type { AiopsLogRateAnalysisSchema } from '@kbn/aiops-log-rate-analysis/api/schema';
import type { AiopsLogRateAnalysisSchemaSignificantItem } from '@kbn/aiops-log-rate-analysis/api/schema_v3';
import {
@ -153,8 +153,6 @@ interface LogRateAnalysisResultsProps {
barColorOverride?: string;
/** Optional color override for the highlighted bar color for charts */
barHighlightColorOverride?: string;
/** Identifier to indicate the plugin utilizing the component */
embeddingOrigin: string;
}
export const LogRateAnalysisResults: FC<LogRateAnalysisResultsProps> = ({
@ -162,9 +160,8 @@ export const LogRateAnalysisResults: FC<LogRateAnalysisResultsProps> = ({
searchQuery,
barColorOverride,
barHighlightColorOverride,
embeddingOrigin,
}) => {
const { analytics, http } = useAiopsAppContext();
const { analytics, http, embeddingOrigin } = useAiopsAppContext();
const { dataView } = useDataSource();
const dispatch = useAppDispatch();
@ -351,7 +348,7 @@ export const LogRateAnalysisResults: FC<LogRateAnalysisResultsProps> = ({
overrides,
sampleProbability,
},
headers: { [AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin },
headers: { [AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin },
};
}, [
analysisType,

View file

@ -23,6 +23,7 @@ import {
initializeTitles,
useBatchedPublishingSubjects,
} from '@kbn/presentation-publishing';
import fastIsEqual from 'fast-deep-equal';
import { cloneDeep } from 'lodash';
import React, { useMemo } from 'react';
@ -231,10 +232,9 @@ export const getChangePointChartEmbeddableFactory = (
const lastReloadRequestTime = useObservable(reload$, Date.now());
const timeRange = useObservable(timeRange$, undefined);
let embeddingOrigin;
if (apiHasExecutionContext(parentApi)) {
embeddingOrigin = parentApi.executionContext.type;
}
const embeddingOrigin = apiHasExecutionContext(parentApi)
? parentApi.executionContext.type
: undefined;
return (
<ChangePointDetectionComponent

View file

@ -9,7 +9,6 @@ import type { CoreStart } from '@kbn/core/public';
import { tracksOverlays } from '@kbn/presentation-containers';
import { toMountPoint } from '@kbn/react-kibana-mount';
import React from 'react';
import type { AiopsAppDependencies } from '../..';
import { AiopsAppContext } from '../../hooks/use_aiops_app_context';
import type { AiopsPluginStartDeps } from '../../types';
import { ChangePointChartInitializer } from './change_point_chart_initializer';
@ -31,12 +30,11 @@ export async function resolveEmbeddableChangePointUserInput(
const flyoutSession = overlays.openFlyout(
toMountPoint(
<AiopsAppContext.Provider
value={
{
...coreStart,
...pluginStart,
} as unknown as AiopsAppDependencies
}
value={{
embeddingOrigin: 'flyout',
...coreStart,
...pluginStart,
}}
>
<ChangePointChartInitializer
initialInput={input}

View file

@ -236,10 +236,9 @@ export const getPatternAnalysisEmbeddableFactory = (
const lastReloadRequestTime = useObservable(reload$, Date.now());
const timeRange = useObservable(timeRange$, undefined);
let embeddingOrigin;
if (apiHasExecutionContext(parentApi)) {
embeddingOrigin = parentApi.executionContext.type;
}
const embeddingOrigin = apiHasExecutionContext(parentApi)
? parentApi.executionContext.type
: undefined;
return (
<PatternAnalysisComponent

View file

@ -9,7 +9,6 @@ import type { CoreStart } from '@kbn/core/public';
import { tracksOverlays } from '@kbn/presentation-containers';
import { toMountPoint } from '@kbn/react-kibana-mount';
import React from 'react';
import type { AiopsAppDependencies } from '../..';
import { AiopsAppContext } from '../../hooks/use_aiops_app_context';
import type { AiopsPluginStartDeps } from '../../types';
import { PatternAnalysisEmbeddableInitializer } from './pattern_analysis_initializer';
@ -60,12 +59,11 @@ export async function resolveEmbeddablePatternAnalysisUserInput(
const flyoutSession = overlays.openFlyout(
toMountPoint(
<AiopsAppContext.Provider
value={
{
...coreStart,
...pluginStart,
} as unknown as AiopsAppDependencies
}
value={{
embeddingOrigin: 'flyout',
...coreStart,
...pluginStart,
}}
>
<PatternAnalysisEmbeddableInitializer
initialInput={initialState}

View file

@ -31,9 +31,9 @@ import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
import type { UiActionsStart } from '@kbn/ui-actions-plugin/public';
/**
* AIOps App Dependencies to be provided via React context.
* AIOps app context value to be provided via React context.
*/
export interface AiopsAppDependencies {
export interface AiopsAppContextValue {
/**
* Used for telemetry/performance metrics.
*/
@ -110,7 +110,7 @@ export interface AiopsAppDependencies {
cases?: CasesPublicStart;
isServerless?: boolean;
/** Identifier to indicate the plugin utilizing the component */
embeddingOrigin?: string;
embeddingOrigin: string;
/** Observability AI Assistant */
observabilityAIAssistant?: ObservabilityAIAssistantPublicStart;
}
@ -118,12 +118,12 @@ export interface AiopsAppDependencies {
/**
* React AIOps app dependency context.
*/
export const AiopsAppContext = createContext<AiopsAppDependencies | undefined>(undefined);
export const AiopsAppContext = createContext<AiopsAppContextValue | undefined>(undefined);
/**
* Custom hook to get AIOps app dependency context.
*/
export const useAiopsAppContext = (): AiopsAppDependencies => {
export const useAiopsAppContext = (): AiopsAppContextValue => {
const aiopsAppContext = useContext(AiopsAppContext);
// if `undefined`, throw an error

View file

@ -15,7 +15,7 @@ export function plugin() {
export type { AiopsPluginStart, AiopsPluginSetup } from './types';
export type { AiopsAppDependencies } from './hooks/use_aiops_app_context';
export type { AiopsAppContextValue } from './hooks/use_aiops_app_context';
export type { LogRateAnalysisAppStateProps } from './components/log_rate_analysis';
export type { LogRateAnalysisContentWrapperProps } from './components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content_wrapper';
export type { LogCategorizationAppStateProps } from './components/log_categorization';

View file

@ -6,7 +6,7 @@
*/
import { css } from '@emotion/react';
import type { ChangePointDetectionViewType } from '@kbn/aiops-change-point-detection/constants';
import { EMBEDDABLE_ORIGIN } from '@kbn/aiops-common/constants';
import { AIOPS_EMBEDDABLE_ORIGIN } from '@kbn/aiops-common/constants';
import type { CoreStart } from '@kbn/core-lifecycle-browser';
import { UI_SETTINGS } from '@kbn/data-service';
import type { TimeRange } from '@kbn/es-query';
@ -21,7 +21,7 @@ import {
type ChangePointAnnotation,
} from '../components/change_point_detection/change_point_detection_context';
import { ChartGridEmbeddableWrapper } from '../embeddables/change_point_chart/embeddable_chart_component_wrapper';
import { AiopsAppContext, type AiopsAppDependencies } from '../hooks/use_aiops_app_context';
import { AiopsAppContext, type AiopsAppContextValue } from '../hooks/use_aiops_app_context';
import { DataSourceContextProvider } from '../hooks/use_data_source';
import { FilterQueryContextProvider } from '../hooks/use_filters_query';
import { ReloadContextProvider } from '../hooks/use_reload';
@ -85,18 +85,19 @@ const ChangePointDetectionWrapper: FC<ChangePointDetectionPropsWithDeps> = ({
lastReloadRequestTime,
}) => {
const deps = useMemo(() => {
const { http, uiSettings, notifications, ...startServices } = coreStart;
const { lens, data, usageCollection, fieldFormats } = pluginStart;
const { charts, lens, data, usageCollection, fieldFormats, share, storage, unifiedSearch } =
pluginStart;
return {
http,
uiSettings,
charts,
data,
notifications,
lens,
usageCollection,
fieldFormats,
...startServices,
unifiedSearch,
share,
storage,
...coreStart,
};
}, [coreStart, pluginStart]);
@ -105,11 +106,11 @@ const ChangePointDetectionWrapper: FC<ChangePointDetectionPropsWithDeps> = ({
uiSettingsKeys: UI_SETTINGS,
};
const aiopsAppContextValue = useMemo<AiopsAppDependencies>(() => {
const aiopsAppContextValue = useMemo<AiopsAppContextValue>(() => {
return {
embeddingOrigin: embeddingOrigin ?? EMBEDDABLE_ORIGIN,
embeddingOrigin: embeddingOrigin ?? AIOPS_EMBEDDABLE_ORIGIN.DEFAULT,
...deps,
} as unknown as AiopsAppDependencies;
};
}, [deps, embeddingOrigin]);
const [manualReload$] = useState<BehaviorSubject<number>>(

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { EMBEDDABLE_ORIGIN } from '@kbn/aiops-common/constants';
import { AIOPS_EMBEDDABLE_ORIGIN } from '@kbn/aiops-common/constants';
import type { Category } from '@kbn/aiops-log-pattern-analysis/types';
import type { CoreStart } from '@kbn/core-lifecycle-browser';
import { UI_SETTINGS } from '@kbn/data-service';
@ -21,7 +21,7 @@ import type {
RandomSamplerProbability,
} from '../components/log_categorization/sampling_menu/random_sampler';
import { PatternAnalysisEmbeddableWrapper } from '../embeddables/pattern_analysis/pattern_analysys_component_wrapper';
import { AiopsAppContext, type AiopsAppDependencies } from '../hooks/use_aiops_app_context';
import { AiopsAppContext, type AiopsAppContextValue } from '../hooks/use_aiops_app_context';
import { DataSourceContextProvider } from '../hooks/use_data_source';
import { FilterQueryContextProvider } from '../hooks/use_filters_query';
import { ReloadContextProvider } from '../hooks/use_reload';
@ -82,19 +82,19 @@ const PatternAnalysisWrapper: FC<PatternAnalysisPropsWithDeps> = ({
onChange,
}) => {
const deps = useMemo(() => {
const { http, uiSettings, notifications, ...startServices } = coreStart;
const { lens, data, usageCollection, fieldFormats, charts } = pluginStart;
const { lens, data, usageCollection, fieldFormats, charts, share, storage, unifiedSearch } =
pluginStart;
return {
http,
uiSettings,
data,
notifications,
lens,
usageCollection,
fieldFormats,
charts,
...startServices,
share,
storage,
unifiedSearch,
...coreStart,
};
}, [coreStart, pluginStart]);
@ -103,11 +103,11 @@ const PatternAnalysisWrapper: FC<PatternAnalysisPropsWithDeps> = ({
uiSettingsKeys: UI_SETTINGS,
};
const aiopsAppContextValue = useMemo<AiopsAppDependencies>(() => {
const aiopsAppContextValue = useMemo<AiopsAppContextValue>(() => {
return {
embeddingOrigin: embeddingOrigin ?? EMBEDDABLE_ORIGIN,
embeddingOrigin: embeddingOrigin ?? AIOPS_EMBEDDABLE_ORIGIN.DEFAULT,
...deps,
} as unknown as AiopsAppDependencies;
};
}, [deps, embeddingOrigin]);
const [manualReload$] = useState<BehaviorSubject<number>>(

View file

@ -13,7 +13,7 @@ import type {
} from '@kbn/core/server';
import { categorizationExamplesProvider } from '@kbn/ml-category-validator';
import type { UsageCounter } from '@kbn/usage-collection-plugin/server';
import { AIOPS_TELEMETRY_ID } from '@kbn/aiops-common/constants';
import { AIOPS_ANALYSIS_RUN_ORIGIN } from '@kbn/aiops-common/constants';
import { AIOPS_API_ENDPOINT } from '@kbn/aiops-common/constants';
import type { CategorizationFieldValidationSchema } from '@kbn/aiops-log-pattern-analysis/schema';
@ -34,7 +34,7 @@ export const routeHandlerFactory: (
const { headers } = request;
trackAIOpsRouteUsage(
`POST ${AIOPS_API_ENDPOINT.CATEGORIZATION_FIELD_VALIDATION}`,
headers[AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN],
headers[AIOPS_ANALYSIS_RUN_ORIGIN],
usageCounter
);

View file

@ -16,7 +16,7 @@ import { withSpan } from '@kbn/apm-utils';
import type { Logger } from '@kbn/logging';
import { createExecutionContext } from '@kbn/ml-route-utils';
import type { UsageCounter } from '@kbn/usage-collection-plugin/server';
import { AIOPS_TELEMETRY_ID, AIOPS_PLUGIN_ID } from '@kbn/aiops-common/constants';
import { AIOPS_ANALYSIS_RUN_ORIGIN, AIOPS_PLUGIN_ID } from '@kbn/aiops-common/constants';
import type {
AiopsLogRateAnalysisSchema,
AiopsLogRateAnalysisApiVersion as ApiVersion,
@ -50,7 +50,7 @@ export function routeHandlerFactory<T extends ApiVersion>(
trackAIOpsRouteUsage(
`POST ${AIOPS_API_ENDPOINT.LOG_RATE_ANALYSIS}`,
headers[AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN],
headers[AIOPS_ANALYSIS_RUN_ORIGIN],
usageCounter
);

View file

@ -14,7 +14,7 @@ import type {
} from '@kbn/core/server';
import { createExecutionContext } from '@kbn/ml-route-utils';
import type { UsageCounter } from '@kbn/usage-collection-plugin/server';
import { AIOPS_TELEMETRY_ID, AIOPS_PLUGIN_ID } from '@kbn/aiops-common/constants';
import { AIOPS_ANALYSIS_RUN_ORIGIN, AIOPS_PLUGIN_ID } from '@kbn/aiops-common/constants';
import type {
AiopsLogRateAnalysisSchema,
AiopsLogRateAnalysisApiVersion as ApiVersion,
@ -44,7 +44,7 @@ export function routeHandlerFactory<T extends ApiVersion>(
trackAIOpsRouteUsage(
`POST ${AIOPS_API_ENDPOINT.LOG_RATE_ANALYSIS_FIELD_CANDIDATES}`,
headers[AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN],
headers[AIOPS_ANALYSIS_RUN_ORIGIN],
usageCounter
);

View file

@ -24,7 +24,6 @@
"@kbn/core-execution-context-browser",
"@kbn/core-http-server",
"@kbn/core-lifecycle-browser",
"@kbn/core-theme-browser",
"@kbn/core-ui-settings-browser-mocks",
"@kbn/core",
"@kbn/data-plugin",

View file

@ -13,6 +13,7 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { ChangePointDetection } from '@kbn/aiops-plugin/public';
import { AIOPS_EMBEDDABLE_ORIGIN } from '@kbn/aiops-common/constants';
import { useDataSource } from '../contexts/ml/data_source_context';
import { useMlKibana } from '../contexts/kibana';
@ -48,7 +49,8 @@ export const ChangePointDetectionPage: FC = () => {
dataView={dataView}
savedSearch={savedSearch}
showFrozenDataTierChoice={showNodeInfo}
appDependencies={{
appContextValue={{
embeddingOrigin: AIOPS_EMBEDDABLE_ORIGIN.ML_AIOPS_LABS,
...pick(services, [
'analytics',
'application',

View file

@ -8,9 +8,13 @@
import type { FC } from 'react';
import React from 'react';
import { pick } from 'lodash';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { LogCategorization } from '@kbn/aiops-plugin/public';
import { AIOPS_EMBEDDABLE_ORIGIN } from '@kbn/aiops-common/constants';
import { useDataSource } from '../contexts/ml/data_source_context';
import { useMlKibana } from '../contexts/kibana';
import { useEnabledFeatures } from '../contexts/ml';
@ -40,24 +44,27 @@ export const LogCategorizationPage: FC = () => {
dataView={dataView}
savedSearch={savedSearch}
showFrozenDataTierChoice={showNodeInfo}
appDependencies={pick(services, [
'analytics',
'application',
'charts',
'data',
'executionContext',
'fieldFormats',
'http',
'i18n',
'lens',
'notifications',
'share',
'storage',
'theme',
'uiActions',
'uiSettings',
'unifiedSearch',
])}
appContextValue={{
embeddingOrigin: AIOPS_EMBEDDABLE_ORIGIN.ML_AIOPS_LABS,
...pick(services, [
'analytics',
'application',
'charts',
'data',
'executionContext',
'fieldFormats',
'http',
'i18n',
'lens',
'notifications',
'share',
'storage',
'theme',
'uiActions',
'uiSettings',
'unifiedSearch',
]),
}}
/>
)}
<HelpMenu docLink={services.docLinks.links.ml.guide} />

View file

@ -11,6 +11,8 @@ import { pick } from 'lodash';
import { FormattedMessage } from '@kbn/i18n-react';
import { LogRateAnalysis } from '@kbn/aiops-plugin/public';
import { AIOPS_EMBEDDABLE_ORIGIN } from '@kbn/aiops-common/constants';
import { useDataSource } from '../contexts/ml/data_source_context';
import { useMlKibana } from '../contexts/kibana';
import { HelpMenu } from '../components/help_menu';
@ -37,25 +39,28 @@ export const LogRateAnalysisPage: FC = () => {
savedSearch={savedSearch}
showContextualInsights={showContextualInsights}
showFrozenDataTierChoice={showNodeInfo}
appDependencies={pick(services, [
'analytics',
'application',
'charts',
'data',
'executionContext',
'fieldFormats',
'http',
'i18n',
'lens',
'notifications',
'share',
'storage',
'theme',
'uiActions',
'uiSettings',
'unifiedSearch',
'observabilityAIAssistant',
])}
appContextValue={{
embeddingOrigin: AIOPS_EMBEDDABLE_ORIGIN.ML_AIOPS_LABS,
...pick(services, [
'analytics',
'application',
'charts',
'data',
'executionContext',
'fieldFormats',
'http',
'i18n',
'lens',
'notifications',
'share',
'storage',
'theme',
'uiActions',
'uiSettings',
'unifiedSearch',
'observabilityAIAssistant',
]),
}}
/>
)}
<HelpMenu docLink={services.docLinks.links.ml.guide} />

View file

@ -131,6 +131,7 @@
"@kbn/json-schemas",
"@kbn/ml-field-stats-flyout",
"@kbn/ml-parse-interval",
"@kbn/ml-validators"
"@kbn/ml-validators",
"@kbn/aiops-common"
]
}

View file

@ -207,7 +207,6 @@ export const LogRateAnalysis: FC<AlertDetailsLogRateAnalysisSectionProps> = ({ r
</EuiFlexItem>
<EuiFlexItem>
<LogRateAnalysisContent
embeddingOrigin="observability_log_threshold_alert_details"
dataView={dataView}
timeRange={timeRange}
esSearchQuery={esSearchQuery}
@ -215,23 +214,26 @@ export const LogRateAnalysis: FC<AlertDetailsLogRateAnalysisSectionProps> = ({ r
barColorOverride={colorTransformer(Color.color0)}
barHighlightColorOverride={colorTransformer(Color.color1)}
onAnalysisCompleted={onAnalysisCompleted}
appDependencies={pick(services, [
'analytics',
'application',
'data',
'executionContext',
'charts',
'fieldFormats',
'http',
'notifications',
'share',
'storage',
'uiSettings',
'unifiedSearch',
'theme',
'lens',
'i18n',
])}
appContextValue={{
embeddingOrigin: 'observability_log_threshold_alert_details',
...pick(services, [
'analytics',
'application',
'data',
'executionContext',
'charts',
'fieldFormats',
'http',
'notifications',
'share',
'storage',
'uiSettings',
'unifiedSearch',
'theme',
'lens',
'i18n',
]),
}}
/>
</EuiFlexItem>
</EuiFlexGroup>

View file

@ -185,7 +185,6 @@ export function LogRateAnalysis({
</EuiFlexItem>
<EuiFlexItem>
<LogRateAnalysisContent
embeddingOrigin="observability_log_threshold_alert_details"
dataView={dataView}
timeRange={timeRange}
esSearchQuery={esSearchQuery}
@ -193,23 +192,26 @@ export function LogRateAnalysis({
barColorOverride={colorTransformer(Color.color0)}
barHighlightColorOverride={colorTransformer(Color.color1)}
onAnalysisCompleted={onAnalysisCompleted}
appDependencies={pick(services, [
'analytics',
'application',
'data',
'executionContext',
'charts',
'fieldFormats',
'http',
'notifications',
'share',
'storage',
'uiSettings',
'unifiedSearch',
'theme',
'lens',
'i18n',
])}
appContextValue={{
embeddingOrigin: 'observability_custom_threshold_alert_details',
...pick(services, [
'analytics',
'application',
'data',
'executionContext',
'charts',
'fieldFormats',
'http',
'notifications',
'share',
'storage',
'uiSettings',
'unifiedSearch',
'theme',
'lens',
'i18n',
]),
}}
/>
</EuiFlexItem>
</EuiFlexGroup>

View file

@ -279,7 +279,6 @@ export function LogRateAnalysisPanel({ slo, alert, rule }: Props) {
</EuiFlexItem>
<EuiFlexItem>
<LogRateAnalysisContent
embeddingOrigin="observability_slo_burn_rate_alert_details"
dataView={dataView}
esSearchQuery={esSearchQuery}
timeRange={timeRange}
@ -287,23 +286,26 @@ export function LogRateAnalysisPanel({ slo, alert, rule }: Props) {
barColorOverride={colorTransformer('color0')}
barHighlightColorOverride={colorTransformer('color1')}
onAnalysisCompleted={onAnalysisCompleted}
appDependencies={pick(services, [
'analytics',
'application',
'data',
'executionContext',
'charts',
'fieldFormats',
'http',
'notifications',
'share',
'storage',
'uiSettings',
'unifiedSearch',
'theme',
'lens',
'i18n',
])}
appContextValue={{
embeddingOrigin: 'observability_slo_burn_rate_alert_details',
...pick(services, [
'analytics',
'application',
'data',
'executionContext',
'charts',
'fieldFormats',
'http',
'notifications',
'share',
'storage',
'uiSettings',
'unifiedSearch',
'theme',
'lens',
'i18n',
]),
}}
/>
</EuiFlexItem>
</EuiFlexGroup>