-
Notifications
You must be signed in to change notification settings - Fork 8.3k
/
Copy pathindex.ts
101 lines (91 loc) · 3.34 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
* 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.
*/
// TODO: https://github.com/elastic/kibana/issues/110905
/* eslint-disable @kbn/eslint/no_export_all */
import { offeringBasedSchema, schema, TypeOf } from '@kbn/config-schema';
import { PluginConfigDescriptor, PluginInitializerContext } from '@kbn/core/server';
import type { ObservabilityPluginSetup } from './plugin';
import { createOrUpdateIndex, Mappings } from './utils/create_or_update_index';
import { createOrUpdateIndexTemplate } from './utils/create_or_update_index_template';
import { ScopedAnnotationsClient } from './lib/annotations/bootstrap_annotations';
import { CustomThresholdLocators } from './lib/rules/custom_threshold/custom_threshold_executor';
import {
unwrapEsResponse,
WrappedElasticsearchClientError,
} from '../common/utils/unwrap_es_response';
export { rangeQuery, kqlQuery, termQuery, termsQuery, wildcardQuery } from './utils/queries';
export { getParsedFilterQuery } from './utils/get_parsed_filtered_query';
export { getInspectResponse } from '../common/utils/get_inspect_response';
export * from './types';
const configSchema = schema.object({
annotations: schema.object({
enabled: schema.boolean({ defaultValue: true }),
index: schema.string({ defaultValue: 'observability-annotations' }),
}),
unsafe: schema.object({
alertDetails: schema.object({
metrics: schema.object({
enabled: schema.boolean({ defaultValue: false }),
}),
logs: schema.object({
enabled: schema.boolean({ defaultValue: false }),
}),
uptime: schema.object({
enabled: schema.boolean({ defaultValue: false }),
}),
observability: schema.object({
enabled: schema.boolean({ defaultValue: false }),
}),
}),
thresholdRule: schema.object({
enabled: offeringBasedSchema({
serverless: schema.boolean({ defaultValue: false }),
traditional: schema.boolean({ defaultValue: false }),
}),
}),
}),
customThresholdRule: schema.object({
groupByPageSize: schema.number({ defaultValue: 10_000 }),
}),
enabled: schema.boolean({ defaultValue: true }),
createO11yGenericFeatureId: schema.boolean({ defaultValue: false }),
});
export const config: PluginConfigDescriptor = {
exposeToBrowser: {
unsafe: true,
aiAssistant: {
enabled: true,
feedback: {
enabled: true,
},
},
},
schema: configSchema,
deprecations: ({ unused }) => [
unused('unsafe.thresholdRule.enabled', { level: 'warning' }),
unused('unsafe.alertDetails.logs.enabled', { level: 'warning' }),
unused('unsafe.alertDetails.observability.enabled', { level: 'warning' }),
],
};
export type ObservabilityConfig = TypeOf<typeof configSchema>;
export const plugin = async (initContext: PluginInitializerContext) => {
const { ObservabilityPlugin } = await import('./plugin');
return new ObservabilityPlugin(initContext);
};
export type {
Mappings,
ObservabilityPluginSetup,
ScopedAnnotationsClient,
CustomThresholdLocators,
};
export {
createOrUpdateIndex,
createOrUpdateIndexTemplate,
unwrapEsResponse,
WrappedElasticsearchClientError,
};
export { uiSettings } from './ui_settings';