-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:elastic/kibana into add-feature-o11…
…y-server-less
- Loading branch information
Showing
79 changed files
with
2,046 additions
and
1,511 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+29.9 KB
(120%)
docs/user/alerting/images/rule-types-es-query-conditions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
x-pack/plugins/aiops/server/routes/categorization_field_validation/define_route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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 type { IRouter } from '@kbn/core/server'; | ||
import type { DataRequestHandlerContext } from '@kbn/data-plugin/server'; | ||
import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; | ||
import { categorizationFieldValidationSchema } from '../../../common/api/log_categorization/schema'; | ||
import { AIOPS_API_ENDPOINT } from '../../../common/api'; | ||
import type { AiopsLicense } from '../../types'; | ||
import { routeHandlerFactory } from './route_handler_factory'; | ||
|
||
export const defineRoute = ( | ||
router: IRouter<DataRequestHandlerContext>, | ||
license: AiopsLicense, | ||
usageCounter?: UsageCounter | ||
) => { | ||
router.versioned | ||
.post({ | ||
path: AIOPS_API_ENDPOINT.CATEGORIZATION_FIELD_VALIDATION, | ||
access: 'internal', | ||
}) | ||
.addVersion( | ||
{ | ||
version: '1', | ||
validate: { | ||
request: { | ||
body: categorizationFieldValidationSchema, | ||
}, | ||
}, | ||
}, | ||
routeHandlerFactory(license, usageCounter) | ||
); | ||
}; |
83 changes: 83 additions & 0 deletions
83
x-pack/plugins/aiops/server/routes/categorization_field_validation/route_handler_factory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* 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 type { | ||
KibanaRequest, | ||
RequestHandlerContext, | ||
RequestHandler, | ||
KibanaResponseFactory, | ||
} from '@kbn/core/server'; | ||
import { categorizationExamplesProvider } from '@kbn/ml-category-validator'; | ||
import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; | ||
import { wrapError } from '../error_wrapper'; | ||
import { trackAIOpsRouteUsage } from '../../lib/track_route_usage'; | ||
import { AIOPS_TELEMETRY_ID } from '../../../common/constants'; | ||
import { AIOPS_API_ENDPOINT } from '../../../common/api'; | ||
import type { AiopsLicense } from '../../types'; | ||
import type { CategorizationFieldValidationSchema } from '../../../common/api/log_categorization/schema'; | ||
|
||
export const routeHandlerFactory: ( | ||
license: AiopsLicense, | ||
usageCounter?: UsageCounter | ||
) => RequestHandler<unknown, unknown, CategorizationFieldValidationSchema> = | ||
(license, usageCounter) => | ||
async ( | ||
context: RequestHandlerContext, | ||
request: KibanaRequest<unknown, unknown, CategorizationFieldValidationSchema>, | ||
response: KibanaResponseFactory | ||
) => { | ||
const { headers } = request; | ||
trackAIOpsRouteUsage( | ||
`POST ${AIOPS_API_ENDPOINT.CATEGORIZATION_FIELD_VALIDATION}`, | ||
headers[AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN], | ||
usageCounter | ||
); | ||
|
||
if (!license.isActivePlatinumLicense) { | ||
return response.forbidden(); | ||
} | ||
try { | ||
const { | ||
elasticsearch: { client }, | ||
} = await context.core; | ||
|
||
const { | ||
indexPatternTitle, | ||
timeField, | ||
query, | ||
size, | ||
field, | ||
start, | ||
end, | ||
analyzer, | ||
runtimeMappings, | ||
indicesOptions, | ||
includeExamples, | ||
} = request.body; | ||
|
||
const { validateCategoryExamples } = categorizationExamplesProvider(client); | ||
const resp = await validateCategoryExamples( | ||
indexPatternTitle, | ||
query, | ||
size, | ||
field, | ||
timeField, | ||
start, | ||
end, | ||
analyzer ?? {}, | ||
runtimeMappings, | ||
indicesOptions, | ||
includeExamples | ||
); | ||
|
||
return response.ok({ | ||
body: resp, | ||
}); | ||
} catch (e) { | ||
return response.customError(wrapError(e)); | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.