kibana/x-pack/plugins/observability/server/index.ts
Bena Kansara 5a2b80f8db
Add feature flag for new Threshold Alert details page (#162394)
Resolves https://github.com/elastic/kibana/issues/162393

Adds a new feature flag
`xpack.observability.unsafe.alertDetails.observability.enabled` to
show/hide threshold alert details page until it is ready for GA.
2023-07-27 11:53:29 +02:00

89 lines
2.9 KiB
TypeScript

/*
* 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 { schema, TypeOf } from '@kbn/config-schema';
import { PluginConfigDescriptor, PluginInitializerContext } from '@kbn/core/server';
import { ObservabilityPlugin, 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 {
unwrapEsResponse,
WrappedElasticsearchClientError,
} from '../common/utils/unwrap_es_response';
import { observabilityCoPilotConfig } from './services/openai/config';
export { rangeQuery, kqlQuery, termQuery, termsQuery } from './utils/queries';
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({
// Enable it by default: https://github.com/elastic/kibana/issues/159945
enabled: schema.boolean({ defaultValue: true }),
}),
uptime: schema.object({
enabled: schema.boolean({ defaultValue: false }),
}),
observability: schema.object({
enabled: schema.boolean({ defaultValue: false }),
}),
}),
thresholdRule: schema.object({
enabled: schema.boolean({ defaultValue: false }),
}),
}),
thresholdRule: schema.object({
groupByPageSize: schema.number({ defaultValue: 10_000 }),
}),
enabled: schema.boolean({ defaultValue: true }),
aiAssistant: schema.maybe(observabilityCoPilotConfig),
compositeSlo: schema.object({
enabled: schema.boolean({ defaultValue: false }),
}),
});
export const config: PluginConfigDescriptor = {
exposeToBrowser: {
unsafe: true,
aiAssistant: {
enabled: true,
feedback: {
enabled: true,
},
},
},
schema: configSchema,
};
export type ObservabilityConfig = TypeOf<typeof configSchema>;
export const plugin = (initContext: PluginInitializerContext) =>
new ObservabilityPlugin(initContext);
export type { Mappings, ObservabilityPluginSetup, ScopedAnnotationsClient };
export {
createOrUpdateIndex,
createOrUpdateIndexTemplate,
unwrapEsResponse,
WrappedElasticsearchClientError,
};
export { uiSettings } from './ui_settings';