[ML] AIOps: Fix missing comments/exports/anys. (#162966)

## Summary

Fixes comments/exports/anys in the `aiops` plugin. Commands to check
are:

```bash
node scripts/build_api_docs --plugin aiops --stats comments
node scripts/build_api_docs --plugin aiops --stats exports
node scripts/build_api_docs --plugin aiops --stats any
```

### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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 2023-08-03 14:35:37 +02:00 committed by GitHub
parent d6a1e20075
commit 581768116a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 99 additions and 4 deletions

View file

@ -5,15 +5,27 @@
* 2.0.
*/
/**
* The p-value threshold to be used for statistically significant items.
*/
export const LOG_RATE_ANALYSIS_P_VALUE_THRESHOLD = 0.02;
/**
* The type of log rate analysis (spike or dip) will affect how parameters are
* passed to the analysis API endpoint.
*/
export const LOG_RATE_ANALYSIS_TYPE = {
SPIKE: 'spike',
DIP: 'dip',
} as const;
/**
* Union type of log rate analysis types.
*/
export type LogRateAnalysisType =
typeof LOG_RATE_ANALYSIS_TYPE[keyof typeof LOG_RATE_ANALYSIS_TYPE];
// For the technical preview of Log Rate Analysis we use a hard coded seed.
// In future versions we might use a user specific seed or let the user costumise it.
/**
* For the technical preview of Log Rate Analysis we use a hard coded seed.
* In future versions we might use a user specific seed or let the user customise it.
*/
export const RANDOM_SAMPLER_SEED = 3867412;

View file

@ -5,6 +5,8 @@
* 2.0.
*/
export type { LogRateAnalysisType } from './constants';
/**
* PLUGIN_ID is used as a unique identifier for the aiops plugin
*/

View file

@ -31,9 +31,15 @@ import { timeSeriesDataViewWarning } from '../../application/utils/time_series_d
const localStorage = new Storage(window.localStorage);
/**
* Props for the ChangePointDetectionAppState component.
*/
export interface ChangePointDetectionAppStateProps {
/** The data view to analyze. */
dataView: DataView;
/** The saved search to analyze. */
savedSearch: SavedSearch | null;
/** App dependencies */
appDependencies: AiopsAppDependencies;
}

View file

@ -26,9 +26,15 @@ import { timeSeriesDataViewWarning } from '../../application/utils/time_series_d
const localStorage = new Storage(window.localStorage);
/**
* Props for the LogCategorizationAppState component.
*/
export interface LogCategorizationAppStateProps {
/** The data view to analyze. */
dataView: DataView;
/** The saved search to analyze. */
savedSearch: SavedSearch | null;
/** App dependencies */
appDependencies: AiopsAppDependencies;
}

View file

@ -29,6 +29,9 @@ import { timeSeriesDataViewWarning } from '../../application/utils/time_series_d
const localStorage = new Storage(window.localStorage);
/**
* Props for the LogRateAnalysisAppState component.
*/
export interface LogRateAnalysisAppStateProps {
/** The data view to analyze. */
dataView: DataView;

View file

@ -32,6 +32,9 @@ import type { LogRateAnalysisResultsData } from '../log_rate_analysis_results';
const localStorage = new Storage(window.localStorage);
/**
* Props for the LogRateAnalysisContentWrapper component.
*/
export interface LogRateAnalysisContentWrapperProps {
/** The data view to analyze. */
dataView: DataView;
@ -45,6 +48,7 @@ export interface LogRateAnalysisContentWrapperProps {
setGlobalState?: any;
/** Timestamp for start of initial analysis */
initialAnalysisStart?: number | WindowParameters;
/** Optional time range */
timeRange?: { min: Moment; max: Moment };
/** Elasticsearch query to pass to analysis endpoint */
esSearchQuery?: estypes.QueryDslQueryContainer;
@ -52,7 +56,10 @@ export interface LogRateAnalysisContentWrapperProps {
barColorOverride?: string;
/** Optional color override for the highlighted bar color for charts */
barHighlightColorOverride?: string;
/** Optional callback that exposes data of the completed analysis */
/**
* Optional callback that exposes data of the completed analysis
* @param d Log rate analysis results data
*/
onAnalysisCompleted?: (d: LogRateAnalysisResultsData) => void;
}

View file

@ -69,8 +69,13 @@ const groupResultsOnMessage = i18n.translate(
const resultsGroupedOffId = 'aiopsLogRateAnalysisGroupingOff';
const resultsGroupedOnId = 'aiopsLogRateAnalysisGroupingOn';
/**
* Interface for log rate analysis results data.
*/
export interface LogRateAnalysisResultsData {
/** Statistically significant field/value items. */
significantTerms: SignificantTerm[];
/** Statistically significant groups of field/value items. */
significantTermsGroups: SignificantTermGroup[];
}

View file

@ -30,21 +30,68 @@ import type {
} from '@kbn/unified-field-list/src/components/field_stats';
import type { TimeRange as TimeRangeMs } from '@kbn/ml-date-picker';
/**
* AIOps App Dependencies to be provided via React context.
*/
export interface AiopsAppDependencies {
/**
* Used to check capabilities for links to other plugins.
* `application.currentAppId$` is used to close the log pattern analysis flyout
* when user navigates out of the current plugin.
*/
application: CoreStart['application'];
/**
* Used for data fetching.
*/
data: DataPublicPluginStart;
/**
* Provides execution context for data fetching.
*/
executionContext: ExecutionContextStart;
/**
* Required as a dependency for the fields stats service.
*/
charts: ChartsPluginStart;
/**
* Required as a dependency for the fields stats service and
* used for date formatting in change point detection.
*/
fieldFormats: FieldFormatsStart;
/**
* Used for data fetching.
*/
http: HttpStart;
/**
* Used for toast notifications.
*/
notifications: CoreSetup['notifications'];
/**
* Used to store user settings in local storage.
*/
storage: IStorageWrapper;
/**
* Theme service.
*/
theme: ThemeServiceStart;
/**
* UI settings.
*/
uiSettings: IUiSettingsClient;
/**
* Unified search.
*/
unifiedSearch: UnifiedSearchPublicPluginStart;
/**
* Used to create deep links to other plugins.
*/
share: SharePluginStart;
/**
* Used to create lens embeddables.
*/
lens: LensPublicStart;
// deps for unified field stats
/**
* Deps for unified fields stats.
*/
fieldStats?: {
useFieldStatsTrigger: () => {
renderOption: EuiComboBoxProps<string>['renderOption'];
@ -59,8 +106,14 @@ export interface AiopsAppDependencies {
};
}
/**
* React AIOps app dependency context.
*/
export const AiopsAppContext = createContext<AiopsAppDependencies | undefined>(undefined);
/**
* Custom hook to get AIOps app dependency context.
*/
export const useAiopsAppContext = (): AiopsAppDependencies => {
const aiopsAppContext = useContext(AiopsAppContext);

View file

@ -17,6 +17,7 @@ export { LOG_RATE_ANALYSIS_TYPE, type LogRateAnalysisType } from '../common/cons
export type { AiopsAppDependencies } 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';
export type { ChangePointDetectionAppStateProps } from './components/change_point_detection';
export type { LogRateAnalysisResultsData } from './components/log_rate_analysis/log_rate_analysis_results';