diff --git a/.eslintrc.js b/.eslintrc.js index 1ec3718ec74bc..dca6267b02c09 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -875,6 +875,7 @@ module.exports = { 'x-pack/plugins/observability_solution/observability/**/*.{js,mjs,ts,tsx}', 'x-pack/plugins/observability_solution/exploratory_view/**/*.{js,mjs,ts,tsx}', 'x-pack/plugins/observability_solution/ux/**/*.{js,mjs,ts,tsx}', + 'x-pack/plugins/observability_solution/slo/**/*.{js,mjs,ts,tsx}', ], rules: { 'no-console': ['warn', { allow: ['error'] }], @@ -897,6 +898,7 @@ module.exports = { 'x-pack/plugins/observability_solution/apm/**/*.stories.*', 'x-pack/plugins/observability_solution/observability/**/*.stories.*', 'x-pack/plugins/observability_solution/exploratory_view/**/*.stories.*', + 'x-pack/plugins/observability_solution/slo/**/*.stories.*', ], rules: { 'react/function-component-definition': [ diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ccc5bf4a1cac9..60165edc03aa6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -783,6 +783,7 @@ packages/shared-ux/router/types @elastic/appex-sharedux packages/shared-ux/storybook/config @elastic/appex-sharedux packages/shared-ux/storybook/mock @elastic/appex-sharedux packages/kbn-shared-ux-utility @elastic/appex-sharedux +x-pack/plugins/observability_solution/slo @elastic/obs-ux-management-team x-pack/packages/kbn-slo-schema @elastic/obs-ux-management-team x-pack/plugins/snapshot_restore @elastic/kibana-management packages/solution-nav/es @elastic/appex-sharedux diff --git a/config/serverless.oblt.yml b/config/serverless.oblt.yml index f011e198f5208..a2e7d8d4eeb97 100644 --- a/config/serverless.oblt.yml +++ b/config/serverless.oblt.yml @@ -7,11 +7,14 @@ xpack.infra.enabled: true xpack.uptime.enabled: true xpack.securitySolution.enabled: false +## Enable the slo plugin +xpack.slo.enabled: true + ## Cloud settings xpack.cloud.serverless.project_type: observability ## Enable the Serverless Observability plugin -xpack.serverless.observability.enabled: true +xpack.serverless.observability.enabled: true ## Configure plugins diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index f8c4e8644e5d0..241dcd5f73648 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -794,6 +794,10 @@ It leverages universal configuration and other APIs in the serverless plugin to |Session View is meant to provide a visualization into what is going on in a particular Linux environment where the agent is running. It looks likes a terminal emulator; however, it is a tool for introspecting process activity and understanding user and service behaviour in your Linux servers and infrastructure. It is a time-ordered series of process executions displayed in a tree over time. +|{kib-repo}blob/{branch}/x-pack/plugins/observability_solution/slo/README.md[slo] +|A Kibana plugin + + |{kib-repo}blob/{branch}/x-pack/plugins/snapshot_restore/README.md[snapshotRestore] |or diff --git a/package.json b/package.json index 672a211939713..77731b36c08d4 100644 --- a/package.json +++ b/package.json @@ -785,6 +785,7 @@ "@kbn/shared-ux-storybook-config": "link:packages/shared-ux/storybook/config", "@kbn/shared-ux-storybook-mock": "link:packages/shared-ux/storybook/mock", "@kbn/shared-ux-utility": "link:packages/kbn-shared-ux-utility", + "@kbn/slo-plugin": "link:x-pack/plugins/observability_solution/slo", "@kbn/slo-schema": "link:x-pack/packages/kbn-slo-schema", "@kbn/snapshot-restore-plugin": "link:x-pack/plugins/snapshot_restore", "@kbn/solution-nav-es": "link:packages/solution-nav/es", diff --git a/packages/deeplinks/observability/constants.ts b/packages/deeplinks/observability/constants.ts index 1c44778cda28a..b17e2736a25b4 100644 --- a/packages/deeplinks/observability/constants.ts +++ b/packages/deeplinks/observability/constants.ts @@ -19,3 +19,5 @@ export const APM_APP_ID = 'apm'; export const SYNTHETICS_APP_ID = 'synthetics'; export const OBSERVABILITY_ONBOARDING_APP_ID = 'observabilityOnboarding'; + +export const SLO_APP_ID = 'slo'; diff --git a/packages/deeplinks/observability/deep_links.ts b/packages/deeplinks/observability/deep_links.ts index 305e9c0c56c28..7912d4e391a5c 100644 --- a/packages/deeplinks/observability/deep_links.ts +++ b/packages/deeplinks/observability/deep_links.ts @@ -14,6 +14,7 @@ import { OBSERVABILITY_ONBOARDING_APP_ID, OBSERVABILITY_OVERVIEW_APP_ID, SYNTHETICS_APP_ID, + SLO_APP_ID, } from './constants'; type LogsApp = typeof LOGS_APP_ID; @@ -23,6 +24,7 @@ type MetricsApp = typeof METRICS_APP_ID; type ApmApp = typeof APM_APP_ID; type SyntheticsApp = typeof SYNTHETICS_APP_ID; type ObservabilityOnboardingApp = typeof OBSERVABILITY_ONBOARDING_APP_ID; +type SLO_APP = typeof SLO_APP_ID; export type AppId = | LogsApp @@ -31,7 +33,8 @@ export type AppId = | ObservabilityOnboardingApp | ApmApp | MetricsApp - | SyntheticsApp; + | SyntheticsApp + | SLO_APP; export type LogsLinkId = 'log-categories' | 'settings' | 'anomalies' | 'stream'; @@ -40,8 +43,7 @@ export type ObservabilityOverviewLinkId = | 'cases' | 'cases_configure' | 'cases_create' - | 'rules' - | 'slos'; + | 'rules'; export type MetricsLinkId = | 'inventory' @@ -61,12 +63,15 @@ export type ApmLinkId = export type SyntheticsLinkId = 'certificates' | 'overview'; +export type SLOLinkId = 'slo'; + export type LinkId = | LogsLinkId | ObservabilityOverviewLinkId | MetricsLinkId | ApmLinkId - | SyntheticsLinkId; + | SyntheticsLinkId + | SLOLinkId; export type DeepLinkId = | AppId diff --git a/packages/kbn-babel-preset/styled_components_files.js b/packages/kbn-babel-preset/styled_components_files.js index 26dd151028d3f..92b888b4ea9b2 100644 --- a/packages/kbn-babel-preset/styled_components_files.js +++ b/packages/kbn-babel-preset/styled_components_files.js @@ -14,7 +14,7 @@ module.exports = { USES_STYLED_COMPONENTS: [ /packages[\/\\]kbn-ui-shared-deps-(npm|src)[\/\\]/, /src[\/\\]plugins[\/\\](kibana_react)[\/\\]/, - /x-pack[\/\\]plugins[\/\\](observability_solution\/apm|beats_management|cases|fleet|observability_solution\/infra|lists|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/, + /x-pack[\/\\]plugins[\/\\](observability_solution\/apm|beats_management|cases|fleet|observability_solution\/infra|lists|observability_solution\/observability|observability_solution\/observability_shared|observability_solution\/exploratory_view|observability_solution\/slo|security_solution|timelines|observability_solution\/synthetics|observability_solution\/ux|observability_solution\/uptime)[\/\\]/, /x-pack[\/\\]test[\/\\]plugin_functional[\/\\]plugins[\/\\]resolver_test[\/\\]/, /x-pack[\/\\]packages[\/\\]elastic_assistant[\/\\]/, /x-pack[\/\\]packages[\/\\]security-solution[\/\\]ecs_data_quality_dashboard[\/\\]/, diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 05b613ab4b222..5b89972d34ea3 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -103,7 +103,7 @@ pageLoadAssetSize: navigation: 37269 newsfeed: 42228 noDataPage: 5000 - observability: 115443 + observability: 167673 observabilityAIAssistant: 58230 observabilityAIAssistantApp: 27680 observabilityLogsExplorer: 46650 @@ -136,6 +136,7 @@ pageLoadAssetSize: serverlessSearch: 72995 sessionView: 77750 share: 71239 + slo: 37039 snapshotRestore: 79032 spaces: 57868 stackAlerts: 58316 diff --git a/src/dev/storybook/aliases.ts b/src/dev/storybook/aliases.ts index fffa53da5d926..d478350919559 100644 --- a/src/dev/storybook/aliases.ts +++ b/src/dev/storybook/aliases.ts @@ -57,6 +57,7 @@ export const storybookAliases = { security_solution_packages: 'x-pack/packages/security-solution/storybook/config', serverless: 'packages/serverless/storybook/config', shared_ux: 'packages/shared-ux/storybook/config', + slo: 'x-pack/plugins/observability_solution/slo/.storybook', threat_intelligence: 'x-pack/plugins/threat_intelligence/.storybook', triggers_actions_ui: 'x-pack/plugins/triggers_actions_ui/.storybook', ui_actions_enhanced: 'src/plugins/ui_actions_enhanced/.storybook', diff --git a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts index 97c2c74814db1..0e12abb64bcc7 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts @@ -162,6 +162,7 @@ export const applicationUsageSchema = { 'exploratory-view': commonSchema, osquery: commonSchema, profiling: commonSchema, + slo: commonSchema, security_account: commonSchema, reportingRedirect: commonSchema, security_access_agreement: commonSchema, diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index e365106dfe8a0..d31c277fa8afd 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -5635,6 +5635,137 @@ } } }, + "slo": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "Always `main`" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 90 days" + } + }, + "views": { + "type": "array", + "items": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "The application view being tracked" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application sub view since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application sub view is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 90 days" + } + } + } + } + } + } + }, "security_account": { "properties": { "appId": { diff --git a/tsconfig.base.json b/tsconfig.base.json index b7de026789462..35519b4fd0487 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1560,6 +1560,8 @@ "@kbn/shared-ux-storybook-mock/*": ["packages/shared-ux/storybook/mock/*"], "@kbn/shared-ux-utility": ["packages/kbn-shared-ux-utility"], "@kbn/shared-ux-utility/*": ["packages/kbn-shared-ux-utility/*"], + "@kbn/slo-plugin": ["x-pack/plugins/observability_solution/slo"], + "@kbn/slo-plugin/*": ["x-pack/plugins/observability_solution/slo/*"], "@kbn/slo-schema": ["x-pack/packages/kbn-slo-schema"], "@kbn/slo-schema/*": ["x-pack/packages/kbn-slo-schema/*"], "@kbn/snapshot-restore-plugin": ["x-pack/plugins/snapshot_restore"], diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index b3b25e47fc226..03399acb752da 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -115,6 +115,7 @@ "xpack.securitySolutionEss": "plugins/security_solution_ess", "xpack.securitySolutionServerless": "plugins/security_solution_serverless", "xpack.sessionView": "plugins/session_view", + "xpack.slo": "plugins/observability_solution/slo", "xpack.snapshotRestore": "plugins/snapshot_restore", "xpack.spaces": "plugins/spaces", "xpack.savedObjectsTagging": [ diff --git a/x-pack/plugins/observability_solution/observability/common/constants.ts b/x-pack/plugins/observability_solution/observability/common/constants.ts index 97d3d1d9eb938..0286e4bef0825 100644 --- a/x-pack/plugins/observability_solution/observability/common/constants.ts +++ b/x-pack/plugins/observability_solution/observability/common/constants.ts @@ -5,49 +5,14 @@ * 2.0. */ -import { i18n } from '@kbn/i18n'; import { AlertConsumers } from '@kbn/rule-data-utils'; import type { ValidFeatureId } from '@kbn/rule-data-utils'; import type { RuleCreationValidConsumer } from '@kbn/triggers-actions-ui-plugin/public'; -export const SLO_BURN_RATE_RULE_TYPE_ID = 'slo.rules.burnRate'; - export const INVALID_EQUATION_REGEX = /[^A-Z|+|\-|\s|\d+|\.|\(|\)|\/|\*|>|<|=|\?|\:|&|\!|\|]+/g; export const ALERT_STATUS_ALL = 'all'; export const ALERTS_URL_STORAGE_KEY = '_a'; -export const ALERT_ACTION_ID = 'slo.burnRate.alert'; -export const ALERT_ACTION = { - id: ALERT_ACTION_ID, - name: i18n.translate('xpack.observability.slo.alerting.burnRate.alertAction', { - defaultMessage: 'Critical', - }), -}; - -export const HIGH_PRIORITY_ACTION_ID = 'slo.burnRate.high'; -export const HIGH_PRIORITY_ACTION = { - id: HIGH_PRIORITY_ACTION_ID, - name: i18n.translate('xpack.observability.slo.alerting.burnRate.highPriorityAction', { - defaultMessage: 'High', - }), -}; - -export const MEDIUM_PRIORITY_ACTION_ID = 'slo.burnRate.medium'; -export const MEDIUM_PRIORITY_ACTION = { - id: MEDIUM_PRIORITY_ACTION_ID, - name: i18n.translate('xpack.observability.slo.alerting.burnRate.mediumPriorityAction', { - defaultMessage: 'Medium', - }), -}; - -export const LOW_PRIORITY_ACTION_ID = 'slo.burnRate.low'; -export const LOW_PRIORITY_ACTION = { - id: LOW_PRIORITY_ACTION_ID, - name: i18n.translate('xpack.observability.slo.alerting.burnRate.lowPriorityAction', { - defaultMessage: 'Low', - }), -}; - export const observabilityAlertFeatureIds: ValidFeatureId[] = [ AlertConsumers.APM, AlertConsumers.INFRASTRUCTURE, diff --git a/x-pack/plugins/observability_solution/observability/common/index.ts b/x-pack/plugins/observability_solution/observability/common/index.ts index 2502639bc0d4d..6e29cf4009bc6 100644 --- a/x-pack/plugins/observability_solution/observability/common/index.ts +++ b/x-pack/plugins/observability_solution/observability/common/index.ts @@ -60,9 +60,8 @@ export { getProbabilityFromProgressiveLoadingQuality, } from './progressive_loading'; -export const sloFeatureId = 'slo'; export const casesFeatureId = 'observabilityCases'; - +export const sloFeatureId = 'slo'; // The ID of the observability app. Should more appropriately be called // 'observability' but it's used in telemetry by applicationUsage so we don't // want to change it. @@ -87,3 +86,5 @@ export const sloListLocatorID = 'SLO_LIST_LOCATOR'; import { paths } from './locators/paths'; export const observabilityPaths = paths.observability; export type { AlertsLocatorParams } from './locators/alerts'; +export { AlertsLocatorDefinition } from './locators/alerts'; +export { observabilityAlertFeatureIds } from './constants'; diff --git a/x-pack/plugins/observability_solution/observability/common/locators/paths.ts b/x-pack/plugins/observability_solution/observability/common/locators/paths.ts index 2808149c543ba..1646224a63be7 100644 --- a/x-pack/plugins/observability_solution/observability/common/locators/paths.ts +++ b/x-pack/plugins/observability_solution/observability/common/locators/paths.ts @@ -15,14 +15,17 @@ export const EXPLORATORY_VIEW_PATH = '/exploratory-view' as const; // has been m export const RULES_PATH = '/alerts/rules' as const; export const RULES_LOGS_PATH = '/alerts/rules/logs' as const; export const RULE_DETAIL_PATH = '/alerts/rules/:ruleId' as const; -export const SLOS_PATH = '/slos' as const; -export const SLOS_WELCOME_PATH = '/slos/welcome' as const; -export const SLO_DETAIL_PATH = '/slos/:sloId' as const; -export const SLO_CREATE_PATH = '/slos/create' as const; -export const SLO_EDIT_PATH = '/slos/edit/:sloId' as const; -export const SLOS_OUTDATED_DEFINITIONS_PATH = '/slos/outdated-definitions' as const; export const CASES_PATH = '/cases' as const; +// // SLOs have been moved to its own app (slo). Keeping around for redirecting purposes. +export const OLD_SLOS_PATH = '/slos' as const; +export const OLD_SLOS_WELCOME_PATH = '/slos/welcome' as const; +export const OLD_SLOS_OUTDATED_DEFINITIONS_PATH = '/slos/outdated-definitions' as const; +export const OLD_SLO_DETAIL_PATH = '/slos/:sloId' as const; +export const OLD_SLO_EDIT_PATH = '/slos/edit/:sloId' as const; + +export const SLO_DETAIL_PATH = '/:sloId' as const; + export const paths = { observability: { alerts: `${OBSERVABILITY_BASE_PATH}${ALERTS_PATH}`, @@ -31,24 +34,6 @@ export const paths = { rules: `${OBSERVABILITY_BASE_PATH}${RULES_PATH}`, ruleDetails: (ruleId: string) => `${OBSERVABILITY_BASE_PATH}${RULES_PATH}/${encodeURIComponent(ruleId)}`, - slos: `${OBSERVABILITY_BASE_PATH}${SLOS_PATH}`, - slosWelcome: `${OBSERVABILITY_BASE_PATH}${SLOS_WELCOME_PATH}`, - slosOutdatedDefinitions: `${OBSERVABILITY_BASE_PATH}${SLOS_OUTDATED_DEFINITIONS_PATH}`, - sloCreate: `${OBSERVABILITY_BASE_PATH}${SLO_CREATE_PATH}`, - sloCreateWithEncodedForm: (encodedParams: string) => - `${OBSERVABILITY_BASE_PATH}${SLO_CREATE_PATH}?_a=${encodedParams}`, - sloEdit: (sloId: string) => - `${OBSERVABILITY_BASE_PATH}${SLOS_PATH}/edit/${encodeURIComponent(sloId)}`, - sloEditWithEncodedForm: (sloId: string, encodedParams: string) => - `${OBSERVABILITY_BASE_PATH}${SLOS_PATH}/edit/${encodeURIComponent( - sloId - )}?_a=${encodedParams}`, - sloDetails: (sloId: string, instanceId?: string) => - !!instanceId - ? `${OBSERVABILITY_BASE_PATH}${SLOS_PATH}/${encodeURIComponent( - sloId - )}?instanceId=${encodeURIComponent(instanceId)}` - : `${OBSERVABILITY_BASE_PATH}${SLOS_PATH}/${encodeURIComponent(sloId)}`, }, }; diff --git a/x-pack/plugins/observability_solution/observability/kibana.jsonc b/x-pack/plugins/observability_solution/observability/kibana.jsonc index d51801cedc669..da3715c018bdc 100644 --- a/x-pack/plugins/observability_solution/observability/kibana.jsonc +++ b/x-pack/plugins/observability_solution/observability/kibana.jsonc @@ -20,7 +20,6 @@ "data", "dataViews", "dataViewEditor", - "embeddable", "fieldFormats", "uiActions", "presentationUtil", @@ -32,7 +31,6 @@ "observabilityShared", "observabilityAIAssistant", "ruleRegistry", - "taskManager", "triggersActionsUi", "security", "share", @@ -59,8 +57,6 @@ "unifiedSearch", "stackAlerts", "spaces", - "embeddable", - "ingestPipelines" ], "extraPublicDirs": [ "common" diff --git a/x-pack/plugins/observability_solution/observability/public/components/alerts_flyout/use_get_alert_flyout_components.tsx b/x-pack/plugins/observability_solution/observability/public/components/alerts_flyout/use_get_alert_flyout_components.tsx index 2d7e7545db736..3b7f485364293 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/alerts_flyout/use_get_alert_flyout_components.tsx +++ b/x-pack/plugins/observability_solution/observability/public/components/alerts_flyout/use_get_alert_flyout_components.tsx @@ -9,7 +9,7 @@ import React, { useCallback, useMemo } from 'react'; import { AlertsTableFlyoutBaseProps } from '@kbn/triggers-actions-ui-plugin/public'; import { useRouteMatch } from 'react-router-dom'; -import { SLO_ALERTS_TABLE_ID } from '../../pages/slo_details/components/slo_detail_alerts'; +import { SLO_ALERTS_TABLE_ID } from '@kbn/observability-shared-plugin/common'; import { SLO_DETAIL_PATH } from '../../../common/locators/paths'; import type { ObservabilityRuleTypeRegistry } from '../../rules/create_observability_rule_type_registry'; import { AlertsFlyoutHeader } from './alerts_flyout_header'; diff --git a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/register_alerts_table_configuration.tsx b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/register_alerts_table_configuration.tsx index 1ac236f83608b..1fa574d1dd402 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/register_alerts_table_configuration.tsx +++ b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/register_alerts_table_configuration.tsx @@ -32,9 +32,6 @@ export const registerAlertsTableConfiguration = ( alertTableConfigRegistry.register(ruleDetailsAlertsTableConfig); // SLO - const sloAlertsTableConfig = getSloAlertsTableConfiguration( - observabilityRuleTypeRegistry, - config - ); + const sloAlertsTableConfig = getSloAlertsTableConfiguration(observabilityRuleTypeRegistry); alertTableConfigRegistry.register(sloAlertsTableConfig); }; diff --git a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/default_columns.tsx b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/default_columns.tsx index 4872070a6c39c..ea67c7c158e83 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/default_columns.tsx +++ b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/default_columns.tsx @@ -25,7 +25,7 @@ export const columns: Array< { columnHeaderType: 'not-filtered', displayAsText: i18n.translate( - 'xpack.observability.sloAlertsEmbeddable.alertsTGrid.statusColumnDescription', + 'xpack.observability.slo.sloAlertsEmbeddable.alertsTGrid.statusColumnDescription', { defaultMessage: 'Status', } @@ -35,25 +35,34 @@ export const columns: Array< }, { columnHeaderType: 'not-filtered', - displayAsText: i18n.translate('xpack.observability.alertsTGrid.durationColumnDescription', { - defaultMessage: 'Duration', - }), + displayAsText: i18n.translate( + 'xpack.observability.slo.sloAlertsEmbeddable.alertsTGrid.durationColumnDescription', + { + defaultMessage: 'Duration', + } + ), id: ALERT_DURATION, initialWidth: 116, }, { columnHeaderType: 'not-filtered', - displayAsText: i18n.translate('xpack.observability.alertsTGrid.sloColumnDescription', { - defaultMessage: 'Rule name', - }), + displayAsText: i18n.translate( + 'xpack.observability.slo.sloAlertsEmbeddable.alertsTGrid.sloColumnDescription', + { + defaultMessage: 'Rule name', + } + ), id: ALERT_RULE_NAME, initialWidth: 110, }, { columnHeaderType: 'not-filtered', - displayAsText: i18n.translate('xpack.observability.alertsTGrid.reasonColumnDescription', { - defaultMessage: 'Reason', - }), + displayAsText: i18n.translate( + 'xpack.observability.slo.sloAlertsEmbeddable.alertsTGrid.reasonColumnDescription', + { + defaultMessage: 'Reason', + } + ), id: ALERT_REASON, linkField: '*', }, diff --git a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/get_slo_alerts_table_configuration.tsx b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/get_slo_alerts_table_configuration.tsx index 9bebb82234df6..80c60169253c7 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/get_slo_alerts_table_configuration.tsx +++ b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/get_slo_alerts_table_configuration.tsx @@ -8,17 +8,18 @@ import { SortOrder } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { ALERT_DURATION } from '@kbn/rule-data-utils'; import { AlertsTableConfigurationRegistry } from '@kbn/triggers-actions-ui-plugin/public/types'; -import { casesFeatureId, observabilityFeatureId } from '../../../../common'; +import { + casesFeatureId, + observabilityFeatureId, + SLO_ALERTS_TABLE_CONFIG_ID, +} from '@kbn/observability-shared-plugin/public'; import { getRenderCellValue } from '../common/render_cell_value'; -import { columns } from './default_columns'; +import type { ObservabilityRuleTypeRegistry } from '../../..'; import { useGetAlertFlyoutComponents } from '../../alerts_flyout/use_get_alert_flyout_components'; -import type { ObservabilityRuleTypeRegistry } from '../../../rules/create_observability_rule_type_registry'; -import type { ConfigSchema } from '../../../plugin'; -import { SLO_ALERTS_TABLE_CONFIG_ID } from '../../../embeddable/slo/constants'; +import { columns } from './default_columns'; export const getSloAlertsTableConfiguration = ( - observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry, - config: ConfigSchema + observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry ): AlertsTableConfigurationRegistry => ({ id: SLO_ALERTS_TABLE_CONFIG_ID, cases: { featureId: casesFeatureId, owner: [observabilityFeatureId] }, diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/utils/last_duration_i18n.ts b/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/utils/last_duration_i18n.ts deleted file mode 100644 index daae6e7839129..0000000000000 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/utils/last_duration_i18n.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 { i18n } from '@kbn/i18n'; -import moment from 'moment'; -import { TimeRange } from '../../../error_rate_chart/use_lens_definition'; - -export function getLastDurationInUnit(timeRange: TimeRange): string { - const duration = moment.duration(moment(timeRange.to).diff(timeRange.from)); - const durationInSeconds = duration.asSeconds(); - - const oneMinute = 60; - if (durationInSeconds < oneMinute) { - return i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.lastDurationInSeconds', - { - defaultMessage: 'Last {duration} seconds', - values: { - duration: Math.trunc(durationInSeconds), - }, - } - ); - } - - const twoHours = 2 * 60 * 60; - if (durationInSeconds < twoHours) { - return i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.lastDurationInMinutes', - { - defaultMessage: 'Last {duration} minutes', - values: { - duration: Math.trunc(duration.asMinutes()), - }, - } - ); - } - - const twoDays = 2 * 24 * 60 * 60; - if (durationInSeconds < twoDays) { - return i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.lastDurationInHours', - { - defaultMessage: 'Last {duration} hours', - values: { - duration: Math.trunc(duration.asHours()), - }, - } - ); - } - - return i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.lastDurationInDays', - { - defaultMessage: 'Last {duration} days', - values: { - duration: Math.trunc(duration.asDays()), - }, - } - ); -} diff --git a/x-pack/plugins/observability_solution/observability/public/constants.ts b/x-pack/plugins/observability_solution/observability/public/constants.ts index cea913c2e548b..2da72ff858283 100644 --- a/x-pack/plugins/observability_solution/observability/public/constants.ts +++ b/x-pack/plugins/observability_solution/observability/public/constants.ts @@ -7,7 +7,5 @@ export const DEFAULT_INTERVAL = '60s'; export const DEFAULT_DATE_FORMAT = 'YYYY-MM-DD HH:mm'; -export const SLO_LONG_REFETCH_INTERVAL = 60 * 1000; // 1 minute -export const SLO_SHORT_REFETCH_INTERVAL = 5 * 1000; // 5 seconds export const RULE_DETAILS_ALERTS_TABLE_CONFIG_ID = `rule-details-alerts-table`; diff --git a/x-pack/plugins/observability_solution/observability/public/index.ts b/x-pack/plugins/observability_solution/observability/public/index.ts index 9403f67a8d59b..6542e95f20123 100644 --- a/x-pack/plugins/observability_solution/observability/public/index.ts +++ b/x-pack/plugins/observability_solution/observability/public/index.ts @@ -32,6 +32,8 @@ export const plugin: PluginInitializer< return new Plugin(initializerContext); }; +export type { ConfigSchema } from './plugin'; + export { enableLegacyUptimeApp, syntheticsThrottlingEnabled, @@ -51,12 +53,10 @@ export { uptimeOverviewLocatorID, } from '../common'; -export type { SloEditLocatorParams } from './locators/slo_edit'; - +export type { RulesParams } from './locators/rules'; export { getCoreVitalsComponent } from './pages/overview/components/sections/ux/core_web_vitals/get_core_web_vitals_lazy'; - -export { DatePicker } from './pages/overview/components/date_picker/date_picker'; export { ObservabilityAlertSearchBar } from './components/alert_search_bar/get_alert_search_bar_lazy'; +export { DatePicker } from './pages/overview/components/date_picker/date_picker'; export const LazyAlertsFlyout = lazy(() => import('./components/alerts_flyout/alerts_flyout')); @@ -68,11 +68,16 @@ export type { TopAlert, AlertSummary, AlertSummaryField }; export { observabilityFeatureId, observabilityAppId } from '../common'; +export { useFetchDataViews } from './hooks/use_fetch_data_views'; export { useTimeBuckets } from './hooks/use_time_buckets'; export { createUseRulesLink } from './hooks/create_use_rules_link'; export { useSummaryTimeRange } from './hooks/use_summary_time_range'; +export { useGetFilteredRuleTypes } from './hooks/use_get_filtered_rule_types'; +export { useCreateRule } from './hooks/use_create_rule'; export { getApmTraceUrl } from './utils/get_apm_trace_url'; +export { buildEsQuery } from './utils/build_es_query'; +export { KibanaReactStorybookDecorator } from './utils/kibana_react.storybook_decorator'; export type { ObservabilityRuleTypeFormatter, @@ -86,8 +91,10 @@ export { DatePickerContextProvider } from './context/date_picker_context/date_pi export { fromQuery, toQuery } from './utils/url'; export { getAlertSummaryTimeRange } from './utils/alert_summary_widget'; export { calculateTimeRangeBucketSize } from './pages/overview/helpers/calculate_bucket_size'; +export type { render } from './utils/test_helper'; export { convertTo } from '../common/utils/formatters/duration'; +export { getElasticsearchQueryOrThrow } from '../common/utils/parse_kuery'; export { formatAlertEvaluationValue } from './utils/format_alert_evaluation_value'; export { WithKueryAutocompletion } from './components/rule_kql_filter/with_kuery_autocompletion'; export { AutocompleteField } from './components/rule_kql_filter/autocomplete_field'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/alerts/components/alert_actions.tsx b/x-pack/plugins/observability_solution/observability/public/pages/alerts/components/alert_actions.tsx index e54c0f060d2c1..2c840babd21ef 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/alerts/components/alert_actions.tsx +++ b/x-pack/plugins/observability_solution/observability/public/pages/alerts/components/alert_actions.tsx @@ -22,7 +22,7 @@ import { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs'; import { TimelineNonEcsData } from '@kbn/timelines-plugin/common'; import type { AlertActionsProps } from '@kbn/triggers-actions-ui-plugin/public/types'; import { useRouteMatch } from 'react-router-dom'; -import { SLO_ALERTS_TABLE_ID } from '../../slo_details/components/slo_detail_alerts'; +import { SLO_ALERTS_TABLE_ID } from '@kbn/observability-shared-plugin/common'; import { RULE_DETAILS_PAGE_ID } from '../../rule_details/constants'; import { paths, SLO_DETAIL_PATH } from '../../../../common/locators/paths'; import { isAlertDetailsEnabledPerApp } from '../../../utils/is_alert_details_enabled'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/aggregation_options.ts b/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/aggregation_options.ts deleted file mode 100644 index ab27dcd68efe5..0000000000000 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/aggregation_options.ts +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 { i18n } from '@kbn/i18n'; -export const AGGREGATION_OPTIONS = [ - { - value: 'avg', - label: i18n.translate('xpack.observability.slo.sloEdit.timesliceMetric.aggregation.average', { - defaultMessage: 'Average', - }), - }, - { - value: 'max', - label: i18n.translate('xpack.observability.slo.sloEdit.timesliceMetric.aggregation.max', { - defaultMessage: 'Max', - }), - }, - { - value: 'min', - label: i18n.translate('xpack.observability.slo.sloEdit.timesliceMetric.aggregation.min', { - defaultMessage: 'Min', - }), - }, - { - value: 'sum', - label: i18n.translate('xpack.observability.slo.sloEdit.timesliceMetric.aggregation.sum', { - defaultMessage: 'Sum', - }), - }, - { - value: 'cardinality', - label: i18n.translate( - 'xpack.observability.slo.sloEdit.timesliceMetric.aggregation.cardinality', - { - defaultMessage: 'Cardinality', - } - ), - }, - { - value: 'last_value', - label: i18n.translate( - 'xpack.observability.slo.sloEdit.timesliceMetric.aggregation.last_value', - { - defaultMessage: 'Last value', - } - ), - }, - { - value: 'std_deviation', - label: i18n.translate( - 'xpack.observability.slo.sloEdit.timesliceMetric.aggregation.std_deviation', - { - defaultMessage: 'Std. Deviation', - } - ), - }, - { - value: 'doc_count', - label: i18n.translate('xpack.observability.slo.sloEdit.timesliceMetric.aggregation.doc_count', { - defaultMessage: 'Doc count', - }), - }, - { - value: 'percentile', - label: i18n.translate( - 'xpack.observability.slo.sloEdit.timesliceMetric.aggregation.percentile', - { - defaultMessage: 'Percentile', - } - ), - }, -]; - -export const CUSTOM_METRIC_AGGREGATION_OPTIONS = AGGREGATION_OPTIONS.filter((option) => - ['doc_count', 'sum'].includes(option.value) -); - -export function aggValueToLabel(value: string) { - const aggregation = AGGREGATION_OPTIONS.find((agg) => agg.value === value); - if (aggregation) { - return aggregation.label; - } - return value; -} diff --git a/x-pack/plugins/observability_solution/observability/public/plugin.ts b/x-pack/plugins/observability_solution/observability/public/plugin.ts index 74cc276819f37..2a1cd8ad37400 100644 --- a/x-pack/plugins/observability_solution/observability/public/plugin.ts +++ b/x-pack/plugins/observability_solution/observability/public/plugin.ts @@ -66,11 +66,9 @@ import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/publi import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public'; import type { UiActionsStart, UiActionsSetup } from '@kbn/ui-actions-plugin/public'; -import { firstValueFrom } from 'rxjs'; import type { PresentationUtilPluginStart } from '@kbn/presentation-util-plugin/public'; import { DataViewFieldEditorStart } from '@kbn/data-view-field-editor-plugin/public'; -import { getCreateSLOFlyoutLazy } from './pages/slo_edit/shared_flyout/get_create_slo_flyout'; import { observabilityAppId, observabilityFeatureId } from '../common'; import { ALERTS_PATH, @@ -78,15 +76,11 @@ import { OBSERVABILITY_BASE_PATH, OVERVIEW_PATH, RULES_PATH, - SLOS_PATH, } from '../common/locators/paths'; import { registerDataHandler } from './context/has_data_context/data_handler'; import { createUseRulesLink } from './hooks/create_use_rules_link'; import { RulesLocatorDefinition } from './locators/rules'; import { RuleDetailsLocatorDefinition } from './locators/rule_details'; -import { SloDetailsLocatorDefinition } from './locators/slo_details'; -import { SloEditLocatorDefinition } from './locators/slo_edit'; -import { SloListLocatorDefinition } from './locators/slo_list'; import { createObservabilityRuleTypeRegistry, ObservabilityRuleTypeRegistry, @@ -213,15 +207,6 @@ export class Plugin }, ], }, - { - id: 'slos', - title: i18n.translate('xpack.observability.slosLinkTitle', { - defaultMessage: 'SLOs', - }), - visibleIn: [], - order: 8002, - path: SLOS_PATH, - }, getCasesDeepLinks({ basePath: CASES_PATH, extend: { @@ -260,12 +245,6 @@ export class Plugin new RuleDetailsLocatorDefinition() ); - const sloDetailsLocator = pluginsSetup.share.url.locators.create( - new SloDetailsLocatorDefinition() - ); - const sloEditLocator = pluginsSetup.share.url.locators.create(new SloEditLocatorDefinition()); - const sloListLocator = pluginsSetup.share.url.locators.create(new SloListLocatorDefinition()); - const logsExplorerLocator = pluginsSetup.share.url.locators.get(LOGS_EXPLORER_LOCATOR_ID); @@ -331,53 +310,6 @@ export class Plugin logsExplorerLocator ); - const assertPlatinumLicense = async () => { - const licensing = await pluginsSetup.licensing; - const license = await firstValueFrom(licensing.license$); - - const hasPlatinumLicense = license.hasAtLeast('platinum'); - if (hasPlatinumLicense) { - const registerSloOverviewEmbeddableFactory = async () => { - const { SloOverviewEmbeddableFactoryDefinition } = await import( - './embeddable/slo/overview/slo_embeddable_factory' - ); - const factory = new SloOverviewEmbeddableFactoryDefinition(coreSetup.getStartServices); - pluginsSetup.embeddable.registerEmbeddableFactory(factory.type, factory); - }; - registerSloOverviewEmbeddableFactory(); - const registerSloAlertsEmbeddableFactory = async () => { - const { SloAlertsEmbeddableFactoryDefinition } = await import( - './embeddable/slo/alerts/slo_alerts_embeddable_factory' - ); - const factory = new SloAlertsEmbeddableFactoryDefinition( - coreSetup.getStartServices, - kibanaVersion - ); - pluginsSetup.embeddable.registerEmbeddableFactory(factory.type, factory); - }; - registerSloAlertsEmbeddableFactory(); - - const registerSloErrorBudgetEmbeddableFactory = async () => { - const { SloErrorBudgetEmbeddableFactoryDefinition } = await import( - './embeddable/slo/error_budget/slo_error_budget_embeddable_factory' - ); - const factory = new SloErrorBudgetEmbeddableFactoryDefinition(coreSetup.getStartServices); - pluginsSetup.embeddable.registerEmbeddableFactory(factory.type, factory); - }; - registerSloErrorBudgetEmbeddableFactory(); - - const registerAsyncSloAlertsUiActions = async () => { - if (pluginsSetup.uiActions) { - const { registerSloAlertsUiActions } = await import('./ui_actions'); - registerSloAlertsUiActions(pluginsSetup.uiActions, coreSetup); - } - }; - registerAsyncSloAlertsUiActions(); - } - }; - - assertPlatinumLicense(); - if (pluginsSetup.home) { pluginsSetup.home.featureCatalogue.registerSolution({ id: observabilityFeatureId, @@ -439,6 +371,18 @@ export class Plugin ] : []; + const sloLink = coreStart.application.capabilities.slo?.read + ? [ + { + label: i18n.translate('xpack.observability.sloLinkTitle', { + defaultMessage: 'SLOs', + }), + app: 'slo', + path: '/', + }, + ] + : []; + // Reformat the visible links to be NavigationEntry objects instead of // AppDeepLink objects. // @@ -449,8 +393,17 @@ export class Plugin // properties used by the deepLinks. // // See https://github.com/elastic/kibana/issues/103325. - const otherLinks: NavigationEntry[] = deepLinks - .filter((link) => (link.visibleIn ?? []).length > 0) + const otherLinks = deepLinks.filter((link) => (link.visibleIn ?? []).length > 0); + const alertsLink: NavigationEntry[] = otherLinks + .filter((link) => link.id === 'alerts') + .map((link) => ({ + app: observabilityAppId, + label: link.title, + path: link.path ?? '', + })); + + const casesLink: NavigationEntry[] = otherLinks + .filter((link) => link.id === 'cases') .map((link) => ({ app: observabilityAppId, label: link.title, @@ -461,7 +414,13 @@ export class Plugin { label: '', sortKey: 100, - entries: [...overviewLink, ...otherLinks, ...aiAssistantLink], + entries: [ + ...overviewLink, + ...alertsLink, + ...sloLink, + ...casesLink, + ...aiAssistantLink, + ], }, ]; }) @@ -476,9 +435,7 @@ export class Plugin useRulesLink: createUseRulesLink(), rulesLocator, ruleDetailsLocator, - sloDetailsLocator, - sloEditLocator, - sloListLocator, + config, }; } @@ -499,22 +456,11 @@ export class Plugin deepLinks: this.deepLinks, updater$: this.appUpdater$, }); - const kibanaVersion = this.initContext.env.packageInfo.version; - const { ruleTypeRegistry, actionTypeRegistry } = pluginsStart.triggersActionsUi; return { + config, observabilityRuleTypeRegistry: this.observabilityRuleTypeRegistry, useRulesLink: createUseRulesLink(), - getCreateSLOFlyout: getCreateSLOFlyoutLazy({ - config, - core: coreStart, - isDev: this.initContext.env.mode.dev, - kibanaVersion, - observabilityRuleTypeRegistry: this.observabilityRuleTypeRegistry, - ObservabilityPageTemplate: pluginsStart.observabilityShared.navigation.PageTemplate, - plugins: { ...pluginsStart, ruleTypeRegistry, actionTypeRegistry }, - isServerless: !!pluginsStart.serverless, - }), }; } } diff --git a/x-pack/plugins/observability_solution/observability/public/routes/routes.tsx b/x-pack/plugins/observability_solution/observability/public/routes/routes.tsx index 7bfd2c2b25e08..62328fc103797 100644 --- a/x-pack/plugins/observability_solution/observability/public/routes/routes.tsx +++ b/x-pack/plugins/observability_solution/observability/public/routes/routes.tsx @@ -16,10 +16,6 @@ import { LandingPage } from '../pages/landing/landing'; import { OverviewPage } from '../pages/overview/overview'; import { RulesPage } from '../pages/rules/rules'; import { RuleDetailsPage } from '../pages/rule_details/rule_details'; -import { SlosPage } from '../pages/slos/slos'; -import { SlosWelcomePage } from '../pages/slos_welcome/slos_welcome'; -import { SloDetailsPage } from '../pages/slo_details/slo_details'; -import { SloEditPage } from '../pages/slo_edit/slo_edit'; import { ALERTS_PATH, ALERT_DETAIL_PATH, @@ -31,15 +27,13 @@ import { RULES_LOGS_PATH, RULES_PATH, RULE_DETAIL_PATH, - SLOS_OUTDATED_DEFINITIONS_PATH, - SLOS_PATH, - SLOS_WELCOME_PATH, - SLO_CREATE_PATH, - SLO_DETAIL_PATH, - SLO_EDIT_PATH, + OLD_SLOS_PATH, + OLD_SLOS_WELCOME_PATH, + OLD_SLOS_OUTDATED_DEFINITIONS_PATH, + OLD_SLO_DETAIL_PATH, + OLD_SLO_EDIT_PATH, } from '../../common/locators/paths'; import { HasDataContextProvider } from '../context/has_data_context/has_data_context'; -import { SlosOutdatedDefinitions } from '../pages/slo_outdated_definitions'; // Note: React Router DOM component was not working here // so I've recreated this simple version for this purpose. @@ -48,10 +42,15 @@ function SimpleRedirect({ to, redirectToApp }: { to: string; redirectToApp?: str application: { navigateToApp }, } = useKibana().services; const history = useHistory(); - const { search, hash } = useLocation(); - + const { search, hash, pathname } = useLocation(); if (redirectToApp) { - navigateToApp(redirectToApp, { path: `/${search}${hash}`, replace: true }); + if (to === '/:sloId') { + to = pathname.split('/slos')[1]; + } + navigateToApp(redirectToApp, { + path: `/${to}${search ? `?${search}` : ''}${hash}`, + replace: true, + }); } else if (to) { history.replace(to); } @@ -139,44 +138,37 @@ export const routes = { params: {}, exact: true, }, - [SLOS_PATH]: { - handler: () => { - return ; - }, - params: {}, - exact: true, - }, - [SLO_CREATE_PATH]: { + [OLD_SLOS_PATH]: { handler: () => { - return ; + return ; }, params: {}, exact: true, }, - [SLOS_WELCOME_PATH]: { + [OLD_SLOS_WELCOME_PATH]: { handler: () => { - return ; + return ; }, params: {}, exact: true, }, - [SLOS_OUTDATED_DEFINITIONS_PATH]: { + [OLD_SLOS_OUTDATED_DEFINITIONS_PATH]: { handler: () => { - return ; + return ; }, params: {}, exact: true, }, - [SLO_EDIT_PATH]: { + [OLD_SLO_DETAIL_PATH]: { handler: () => { - return ; + return ; }, params: {}, exact: true, }, - [SLO_DETAIL_PATH]: { + [OLD_SLO_EDIT_PATH]: { handler: () => { - return ; + return ; }, params: {}, exact: true, diff --git a/x-pack/plugins/observability_solution/observability/public/rules/register_observability_rule_types.ts b/x-pack/plugins/observability_solution/observability/public/rules/register_observability_rule_types.ts index a8dd008a673ce..694874e533191 100644 --- a/x-pack/plugins/observability_solution/observability/public/rules/register_observability_rule_types.ts +++ b/x-pack/plugins/observability_solution/observability/public/rules/register_observability_rule_types.ts @@ -27,45 +27,9 @@ import type { import type { MetricExpression } from '../components/custom_threshold/types'; import { getViewInAppUrl } from '../../common/custom_threshold_rule/get_view_in_app_url'; import { getGroups } from '../../common/custom_threshold_rule/helpers/get_group'; -import { SLO_ID_FIELD, SLO_INSTANCE_ID_FIELD } from '../../common/field_names/slo'; import { ObservabilityRuleTypeRegistry } from './create_observability_rule_type_registry'; -import { SLO_BURN_RATE_RULE_TYPE_ID } from '../../common/constants'; -import { validateBurnRateRule } from '../components/burn_rate_rule_editor/validation'; import { validateCustomThreshold } from '../components/custom_threshold/components/validation'; -const sloBurnRateDefaultActionMessage = i18n.translate( - 'xpack.observability.slo.rules.burnRate.defaultActionMessage', - { - defaultMessage: `\\{\\{context.reason\\}\\} - -\\{\\{rule.name\\}\\} is active with the following conditions: - -- SLO: \\{\\{context.sloName\\}\\}' -- The burn rate over the last \\{\\{context.longWindow.duration\\}\\} is \\{\\{context.longWindow.burnRate\\}\\} -- The burn rate over the last \\{\\{context.shortWindow.duration\\}\\} is \\{\\{context.shortWindow.burnRate\\}\\} -- Threshold: \\{\\{context.burnRateThreshold\\}\\} - -[View alert details](\\{\\{context.alertDetailsUrl\\}\\}) -`, - } -); -const sloBurnRateDefaultRecoveryMessage = i18n.translate( - 'xpack.observability.slo.rules.burnRate.defaultRecoveryMessage', - { - defaultMessage: `\\{\\{context.reason\\}\\} - -\\{\\{rule.name\\}\\} has recovered. - -- SLO: \\{\\{context.sloName\\}\\}' -- The burn rate over the last \\{\\{context.longWindow.duration\\}\\} is \\{\\{context.longWindow.burnRate\\}\\} -- The burn rate over the last \\{\\{context.shortWindow.duration\\}\\} is \\{\\{context.shortWindow.burnRate\\}\\} -- Threshold: \\{\\{context.burnRateThreshold\\}\\} - -[View alert details](\\{\\{context.alertDetailsUrl\\}\\}) -`, - } -); - const thresholdDefaultActionMessage = i18n.translate( 'xpack.observability.customThreshold.rule.alerting.threshold.defaultActionMessage', { @@ -97,33 +61,6 @@ export const registerObservabilityRuleTypes = async ( uiSettings: IUiSettingsClient, logsExplorerLocator?: LocatorPublic ) => { - observabilityRuleTypeRegistry.register({ - id: SLO_BURN_RATE_RULE_TYPE_ID, - description: i18n.translate('xpack.observability.slo.rules.burnRate.description', { - defaultMessage: 'Alert when your SLO burn rate is too high over a defined period of time.', - }), - format: ({ fields }) => { - return { - reason: fields[ALERT_REASON] ?? '-', - link: `/app/observability/slos/${fields[SLO_ID_FIELD]}?instanceId=${ - fields[SLO_INSTANCE_ID_FIELD] ?? '*' - }`, - }; - }, - iconClass: 'bell', - documentationUrl(docLinks) { - return `${docLinks.links.observability.sloBurnRateRule}`; - }, - ruleParamsExpression: lazy(() => import('../components/burn_rate_rule_editor')), - validate: validateBurnRateRule, - requiresAppContext: false, - defaultActionMessage: sloBurnRateDefaultActionMessage, - defaultRecoveryMessage: sloBurnRateDefaultRecoveryMessage, - alertDetailsAppSection: lazy( - () => import('../components/slo/burn_rate/alert_details/alert_details_app_section') - ), - priority: 100, - }); const validateCustomThresholdWithUiSettings = ({ criteria, searchConfiguration, diff --git a/x-pack/plugins/observability_solution/observability/public/typings/index.ts b/x-pack/plugins/observability_solution/observability/public/typings/index.ts index 92ee64971e30b..b0cf1484d201a 100644 --- a/x-pack/plugins/observability_solution/observability/public/typings/index.ts +++ b/x-pack/plugins/observability_solution/observability/public/typings/index.ts @@ -6,5 +6,4 @@ */ export * from './fetch_overview_data'; -export * from './slo'; export * from './utils'; diff --git a/x-pack/plugins/observability_solution/observability/public/utils/kibana_react.storybook_decorator.tsx b/x-pack/plugins/observability_solution/observability/public/utils/kibana_react.storybook_decorator.tsx index 3794fa1e269c6..b8b4fe5ad142a 100644 --- a/x-pack/plugins/observability_solution/observability/public/utils/kibana_react.storybook_decorator.tsx +++ b/x-pack/plugins/observability_solution/observability/public/utils/kibana_react.storybook_decorator.tsx @@ -12,7 +12,7 @@ import { AppMountParameters } from '@kbn/core-application-browser'; import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; import { CoreTheme } from '@kbn/core-theme-browser'; import { MemoryRouter } from 'react-router-dom'; -import { casesFeatureId, sloFeatureId } from '../../common'; +import { casesFeatureId, sloFeatureId } from '@kbn/observability-shared-plugin/common'; import { PluginContext } from '../context/plugin_context/plugin_context'; import { createObservabilityRuleTypeRegistryMock } from '../rules/observability_rule_type_registry_mock'; import { ConfigSchema } from '../plugin'; diff --git a/x-pack/plugins/observability_solution/observability/server/common/constants.ts b/x-pack/plugins/observability_solution/observability/server/common/constants.ts index 4a5ce7287bea0..373c6b32b3388 100644 --- a/x-pack/plugins/observability_solution/observability/server/common/constants.ts +++ b/x-pack/plugins/observability_solution/observability/server/common/constants.ts @@ -5,5 +5,4 @@ * 2.0. */ -export const SLO_RULE_REGISTRATION_CONTEXT = 'observability.slo'; export const THRESHOLD_RULE_REGISTRATION_CONTEXT = 'observability.threshold'; diff --git a/x-pack/plugins/observability_solution/observability/server/index.ts b/x-pack/plugins/observability_solution/observability/server/index.ts index 07fb79a05f412..c6c96c6599632 100644 --- a/x-pack/plugins/observability_solution/observability/server/index.ts +++ b/x-pack/plugins/observability_solution/observability/server/index.ts @@ -14,6 +14,7 @@ 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, @@ -57,7 +58,6 @@ const configSchema = schema.object({ }), enabled: schema.boolean({ defaultValue: true }), createO11yGenericFeatureId: schema.boolean({ defaultValue: false }), - sloOrphanSummaryCleanUpTaskEnabled: schema.boolean({ defaultValue: true }), }); export const config: PluginConfigDescriptor = { @@ -85,7 +85,12 @@ export const plugin = async (initContext: PluginInitializerContext) => { return new ObservabilityPlugin(initContext); }; -export type { Mappings, ObservabilityPluginSetup, ScopedAnnotationsClient }; +export type { + Mappings, + ObservabilityPluginSetup, + ScopedAnnotationsClient, + CustomThresholdLocators, +}; export { createOrUpdateIndex, createOrUpdateIndexTemplate, diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/register_rule_types.ts b/x-pack/plugins/observability_solution/observability/server/lib/rules/register_rule_types.ts index f705cf6416459..bc3611ac216c7 100644 --- a/x-pack/plugins/observability_solution/observability/server/lib/rules/register_rule_types.ts +++ b/x-pack/plugins/observability_solution/observability/server/lib/rules/register_rule_types.ts @@ -15,15 +15,10 @@ import { import { mappingFromFieldMap } from '@kbn/alerting-plugin/common'; import { legacyExperimentalFieldMap } from '@kbn/alerts-as-data-utils'; import { CustomThresholdLocators } from './custom_threshold/custom_threshold_executor'; -import { sloFeatureId, observabilityFeatureId } from '../../../common'; +import { observabilityFeatureId } from '../../../common'; import { ObservabilityConfig } from '../..'; -import { - SLO_RULE_REGISTRATION_CONTEXT, - THRESHOLD_RULE_REGISTRATION_CONTEXT, -} from '../../common/constants'; -import { sloBurnRateRuleType } from './slo_burn_rate'; +import { THRESHOLD_RULE_REGISTRATION_CONTEXT } from '../../common/constants'; import { thresholdRuleType } from './custom_threshold/register_custom_threshold_rule_type'; -import { sloRuleFieldMap } from './slo_burn_rate/field_map'; export function registerRuleTypes( alertingPlugin: PluginSetupContract, @@ -33,31 +28,6 @@ export function registerRuleTypes( ruleDataService: IRuleDataService, locators: CustomThresholdLocators ) { - // SLO RULE - const ruleDataClientSLO = ruleDataService.initializeIndex({ - feature: sloFeatureId, - registrationContext: SLO_RULE_REGISTRATION_CONTEXT, - dataset: Dataset.alerts, - componentTemplateRefs: [], - componentTemplates: [ - { - name: 'mappings', - mappings: mappingFromFieldMap( - { ...legacyExperimentalFieldMap, ...sloRuleFieldMap }, - 'strict' - ), - }, - ], - }); - - const createLifecycleRuleExecutorSLO = createLifecycleExecutor( - logger.get('rules'), - ruleDataClientSLO - ); - alertingPlugin.registerType( - sloBurnRateRuleType(createLifecycleRuleExecutorSLO, basePath, locators.alertsLocator) - ); - const ruleDataClientThreshold = ruleDataService.initializeIndex({ feature: observabilityFeatureId, registrationContext: THRESHOLD_RULE_REGISTRATION_CONTEXT, diff --git a/x-pack/plugins/observability_solution/observability/server/plugin.ts b/x-pack/plugins/observability_solution/observability/server/plugin.ts index 70a6e97b344fe..805f771a67a02 100644 --- a/x-pack/plugins/observability_solution/observability/server/plugin.ts +++ b/x-pack/plugins/observability_solution/observability/server/plugin.ts @@ -18,7 +18,6 @@ import { Logger, Plugin, PluginInitializerContext, - SavedObjectsClient, } from '@kbn/core/server'; import { LogsExplorerLocatorParams, LOGS_EXPLORER_LOCATOR_ID } from '@kbn/deeplinks-observability'; import { PluginSetupContract as FeaturesSetup } from '@kbn/features-plugin/server'; @@ -31,19 +30,14 @@ import { ML_ANOMALY_DETECTION_RULE_TYPE_ID, METRIC_INVENTORY_THRESHOLD_ALERT_TYPE_ID, OBSERVABILITY_THRESHOLD_RULE_TYPE_ID, + SLO_BURN_RATE_RULE_TYPE_ID, } from '@kbn/rule-data-utils'; -import { - TaskManagerSetupContract, - TaskManagerStartContract, -} from '@kbn/task-manager-plugin/server'; import { RuleRegistryPluginSetupContract } from '@kbn/rule-registry-plugin/server'; import { SharePluginSetup } from '@kbn/share-plugin/server'; import { SpacesPluginSetup, SpacesPluginStart } from '@kbn/spaces-plugin/server'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; -import { SloOrphanSummaryCleanupTask } from './services/slo/tasks/orphan_summary_cleanup_task'; import { ObservabilityConfig } from '.'; -import { casesFeatureId, observabilityFeatureId, sloFeatureId } from '../common'; -import { SLO_BURN_RATE_RULE_TYPE_ID } from '../common/constants'; +import { casesFeatureId, observabilityFeatureId } from '../common'; import { kubernetesGuideConfig, kubernetesGuideId, @@ -54,14 +48,10 @@ import { bootstrapAnnotations, ScopedAnnotationsClientFactory, } from './lib/annotations/bootstrap_annotations'; -import { registerSloUsageCollector } from './lib/collectors/register'; import { registerRuleTypes } from './lib/rules/register_rule_types'; import { getObservabilityServerRouteRepository } from './routes/get_global_observability_server_route_repository'; import { registerRoutes } from './routes/register_routes'; -import { slo, SO_SLO_TYPE } from './saved_objects'; import { threshold } from './saved_objects/threshold'; -import { DefaultResourceInstaller, DefaultSLOInstaller } from './services/slo'; - import { uiSettings } from './ui_settings'; export type ObservabilityPluginSetup = ReturnType; @@ -75,17 +65,13 @@ interface PluginSetup { spaces?: SpacesPluginSetup; usageCollection?: UsageCollectionSetup; cloud?: CloudSetup; - taskManager: TaskManagerSetupContract; } interface PluginStart { alerting: PluginStartContract; - taskManager: TaskManagerStartContract; spaces?: SpacesPluginStart; } -const sloRuleTypes = [SLO_BURN_RATE_RULE_TYPE_ID]; - const o11yRuleTypes = [ SLO_BURN_RATE_RULE_TYPE_ID, OBSERVABILITY_THRESHOLD_RULE_TYPE_ID, @@ -97,7 +83,6 @@ const o11yRuleTypes = [ export class ObservabilityPlugin implements Plugin { private logger: Logger; - private sloOrphanCleanupTask?: SloOrphanSummaryCleanupTask; constructor(private readonly initContext: PluginInitializerContext) { this.initContext = initContext; @@ -290,65 +275,12 @@ export class ObservabilityPlugin implements Plugin { const { ruleDataService } = plugins.ruleRegistry; - const savedObjectTypes = [SO_SLO_TYPE]; - plugins.features.registerKibanaFeature({ - id: sloFeatureId, - name: i18n.translate('xpack.observability.featureRegistry.linkSloTitle', { - defaultMessage: 'SLOs', - }), - order: 1200, - category: DEFAULT_APP_CATEGORIES.observability, - app: [sloFeatureId, 'kibana'], - catalogue: [sloFeatureId, 'observability'], - alerting: sloRuleTypes, - privileges: { - all: { - app: [sloFeatureId, 'kibana'], - catalogue: [sloFeatureId, 'observability'], - api: ['slo_write', 'slo_read', 'rac'], - savedObject: { - all: savedObjectTypes, - read: [], - }, - alerting: { - rule: { - all: sloRuleTypes, - }, - alert: { - all: sloRuleTypes, - }, - }, - ui: ['read', 'write'], - }, - read: { - app: [sloFeatureId, 'kibana'], - catalogue: [sloFeatureId, 'observability'], - api: ['slo_read', 'rac'], - savedObject: { - all: [], - read: savedObjectTypes, - }, - alerting: { - rule: { - read: sloRuleTypes, - }, - alert: { - read: sloRuleTypes, - }, - }, - ui: ['read'], - }, - }, - }); - - core.savedObjects.registerType(slo); core.savedObjects.registerType(threshold); registerRuleTypes(plugins.alerting, core.http.basePath, config, this.logger, ruleDataService, { alertsLocator, logsExplorerLocator, }); - registerSloUsageCollector(plugins.usageCollection); core.getStartServices().then(([coreStart, pluginStart]) => { registerRoutes({ @@ -366,24 +298,12 @@ export class ObservabilityPlugin implements Plugin { logger: this.logger, repository: getObservabilityServerRouteRepository(config), }); - - const esInternalClient = coreStart.elasticsearch.client.asInternalUser; - - const sloResourceInstaller = new DefaultResourceInstaller(esInternalClient, this.logger); - const sloInstaller = new DefaultSLOInstaller(sloResourceInstaller, this.logger); - sloInstaller.install(); }); /** * Register a config for the observability guide */ plugins.guidedOnboarding?.registerGuideConfig(kubernetesGuideId, kubernetesGuideConfig); - this.sloOrphanCleanupTask = new SloOrphanSummaryCleanupTask( - plugins.taskManager, - this.logger, - config - ); - return { getAlertDetailsConfig() { return config.unsafe.alertDetails; @@ -396,12 +316,7 @@ export class ObservabilityPlugin implements Plugin { }; } - public start(core: CoreStart, plugins: PluginStart) { - const internalSoClient = new SavedObjectsClient(core.savedObjects.createInternalRepository()); - const internalEsClient = core.elasticsearch.client.asInternalUser; - - this.sloOrphanCleanupTask?.start(plugins.taskManager, internalSoClient, internalEsClient); - } + public start(core: CoreStart, plugins: PluginStart) {} public stop() {} } diff --git a/x-pack/plugins/observability_solution/observability/server/routes/get_global_observability_server_route_repository.ts b/x-pack/plugins/observability_solution/observability/server/routes/get_global_observability_server_route_repository.ts index d6a71120bb37b..78c4a2614b528 100644 --- a/x-pack/plugins/observability_solution/observability/server/routes/get_global_observability_server_route_repository.ts +++ b/x-pack/plugins/observability_solution/observability/server/routes/get_global_observability_server_route_repository.ts @@ -7,12 +7,10 @@ import { ObservabilityConfig } from '..'; import { rulesRouteRepository } from './rules/route'; -import { sloRouteRepository } from './slo/route'; export function getObservabilityServerRouteRepository(config: ObservabilityConfig) { const repository = { ...rulesRouteRepository, - ...sloRouteRepository, }; return repository; } diff --git a/x-pack/plugins/observability_solution/observability/tsconfig.json b/x-pack/plugins/observability_solution/observability/tsconfig.json index 345ddcbba080b..31d4f84f0f9fd 100644 --- a/x-pack/plugins/observability_solution/observability/tsconfig.json +++ b/x-pack/plugins/observability_solution/observability/tsconfig.json @@ -10,7 +10,6 @@ "server/**/*", "typings/**/*", "../../../../typings/**/*", - "../../observability/public/embeddable/slo/common" ], "kbn_references": [ "@kbn/core", @@ -47,13 +46,10 @@ "@kbn/server-route-repository", "@kbn/ui-theme", "@kbn/test-jest-helpers", - "@kbn/core-http-browser", "@kbn/config-schema", "@kbn/features-plugin", - "@kbn/core-saved-objects-server", "@kbn/logging-mocks", "@kbn/logging", - "@kbn/core-saved-objects-api-server", "@kbn/share-plugin", "@kbn/core-notifications-browser", "@kbn/slo-schema", @@ -93,27 +89,14 @@ "@kbn/react-kibana-mount", "@kbn/react-kibana-context-theme", "@kbn/shared-ux-link-redirect-app", - "@kbn/core-chrome-browser", "@kbn/lens-embeddable-utils", "@kbn/serverless", - "@kbn/dashboard-plugin", - "@kbn/calculate-auto", "@kbn/presentation-util-plugin", - "@kbn/task-manager-plugin", - "@kbn/core-elasticsearch-client-server-mocks", "@kbn/es-types", - "@kbn/ingest-pipelines-plugin", - "@kbn/core-saved-objects-api-server-mocks", "@kbn/core-ui-settings-browser-mocks", "@kbn/field-formats-plugin", "@kbn/aiops-utils", "@kbn/event-annotation-common", - "@kbn/controls-plugin", - "@kbn/core-lifecycle-browser", - "@kbn/unified-data-table", - "@kbn/cell-actions", - "@kbn/discover-utils", - "@kbn/unified-field-list", "@kbn/data-view-field-editor-plugin" ], "exclude": ["target/**/*"] diff --git a/x-pack/plugins/observability_solution/observability_logs_explorer/kibana.jsonc b/x-pack/plugins/observability_solution/observability_logs_explorer/kibana.jsonc index 98b24afc4e6f6..6fbbde284e78e 100644 --- a/x-pack/plugins/observability_solution/observability_logs_explorer/kibana.jsonc +++ b/x-pack/plugins/observability_solution/observability_logs_explorer/kibana.jsonc @@ -18,7 +18,7 @@ "logsShared", "observabilityAIAssistant", "observabilityShared", - "observability", + "slo", "share", "kibanaUtils", "datasetQuality" diff --git a/x-pack/plugins/observability_solution/observability_logs_explorer/public/components/alerts_popover.tsx b/x-pack/plugins/observability_solution/observability_logs_explorer/public/components/alerts_popover.tsx index fc224093dfe60..6766bdf70ab39 100644 --- a/x-pack/plugins/observability_solution/observability_logs_explorer/public/components/alerts_popover.tsx +++ b/x-pack/plugins/observability_solution/observability_logs_explorer/public/components/alerts_popover.tsx @@ -20,7 +20,7 @@ import { hydrateDataSourceSelection } from '@kbn/logs-explorer-plugin/common'; import { getDiscoverFiltersFromState } from '@kbn/logs-explorer-plugin/public'; import type { AlertParams } from '@kbn/observability-plugin/public/components/custom_threshold/types'; import { useLinkProps } from '@kbn/observability-shared-plugin/public'; -import { sloFeatureId } from '@kbn/observability-plugin/common'; +import { sloFeatureId } from '@kbn/observability-shared-plugin/common'; import { loadRuleTypes } from '@kbn/triggers-actions-ui-plugin/public'; import useAsync from 'react-use/lib/useAsync'; import { useKibanaContextForPlugin } from '../utils/use_kibana'; @@ -78,9 +78,8 @@ function alertsPopoverReducer(state: AlertsPopoverState, action: AlertsPopoverAc export const AlertsPopover = () => { const { - services: { triggersActionsUi, observability, application, http }, + services: { triggersActionsUi, slo, application, http }, } = useKibanaContextForPlugin(); - const manageRulesLinkProps = useLinkProps({ app: 'observability', pathname: '/alerts/rules' }); const [pageState] = useActor(useObservabilityLogsExplorerPageStateContext()); @@ -144,7 +143,7 @@ export const AlertsPopover = () => { logsExplorerState?.query && 'query' in logsExplorerState.query ? String(logsExplorerState.query.query) : undefined; - return observability.getCreateSLOFlyout({ + return slo.getCreateSLOFlyout({ initialValues: { indicator: { type: 'sli.kql.custom', @@ -166,7 +165,7 @@ export const AlertsPopover = () => { onClose: closeCreateSLOFlyout, }); } - }, [observability, pageState, state.isCreateSLOFlyoutOpen]); + }, [slo, pageState, state.isCreateSLOFlyoutOpen]); // Check whether the user has the necessary permissions to create an SLO const canCreateSLOs = !!application.capabilities[sloFeatureId]?.write; diff --git a/x-pack/plugins/observability_solution/observability_logs_explorer/public/types.ts b/x-pack/plugins/observability_solution/observability_logs_explorer/public/types.ts index d73d4c372e2f0..94209c0b80d69 100644 --- a/x-pack/plugins/observability_solution/observability_logs_explorer/public/types.ts +++ b/x-pack/plugins/observability_solution/observability_logs_explorer/public/types.ts @@ -20,7 +20,7 @@ import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/publi import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public'; import { LensPublicStart } from '@kbn/lens-plugin/public'; -import { ObservabilityPublicStart } from '@kbn/observability-plugin/public'; +import { SloPublicStart } from '@kbn/slo-plugin/public'; import { ObservabilityLogsExplorerLocators, ObservabilityLogsExplorerLocationState, @@ -46,7 +46,7 @@ export interface ObservabilityLogsExplorerStartDeps { logsShared: LogsSharedClientStartExports; observabilityAIAssistant: ObservabilityAIAssistantPublicStart; observabilityShared: ObservabilitySharedPluginStart; - observability: ObservabilityPublicStart; + slo: SloPublicStart; serverless?: ServerlessPluginStart; triggersActionsUi?: TriggersAndActionsUIPublicPluginStart; unifiedSearch?: UnifiedSearchPublicPluginStart; diff --git a/x-pack/plugins/observability_solution/observability_logs_explorer/tsconfig.json b/x-pack/plugins/observability_solution/observability_logs_explorer/tsconfig.json index 471ae17fd4029..6d1f864890e57 100644 --- a/x-pack/plugins/observability_solution/observability_logs_explorer/tsconfig.json +++ b/x-pack/plugins/observability_solution/observability_logs_explorer/tsconfig.json @@ -46,6 +46,7 @@ "@kbn/data-view-editor-plugin", "@kbn/lens-plugin", "@kbn/shared-ux-prompt-not-found", + "@kbn/slo-plugin", ], "exclude": [ "target/**/*" diff --git a/x-pack/plugins/observability_solution/observability_shared/common/index.ts b/x-pack/plugins/observability_solution/observability_shared/common/index.ts index ded7a14c7d1e8..a213f029aa759 100644 --- a/x-pack/plugins/observability_solution/observability_shared/common/index.ts +++ b/x-pack/plugins/observability_solution/observability_shared/common/index.ts @@ -4,12 +4,18 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { AlertConsumers } from '@kbn/rule-data-utils'; export const observabilityFeatureId = 'observability'; export const observabilityAppId = 'observability-overview'; export const casesFeatureId = 'observabilityCases'; export const sloFeatureId = 'slo'; +// SLO alerts table in slo detail page +export const SLO_ALERTS_TABLE_ID = 'xpack.observability.slo.sloDetails.alertTable'; +// Emebeddable SLO alerts table +export const SLO_ALERTS_TABLE_CONFIG_ID = `${AlertConsumers.SLO}-embeddable-alerts-table`; + export { CLOUD, CLOUD_AVAILABILITY_ZONE, diff --git a/x-pack/plugins/observability_solution/observability_shared/public/index.ts b/x-pack/plugins/observability_solution/observability_shared/public/index.ts index 9b4ef62271697..3dd3dd52055d2 100644 --- a/x-pack/plugins/observability_solution/observability_shared/public/index.ts +++ b/x-pack/plugins/observability_solution/observability_shared/public/index.ts @@ -80,6 +80,7 @@ export { observabilityAppId, casesFeatureId, sloFeatureId, + SLO_ALERTS_TABLE_CONFIG_ID, } from '../common'; export { diff --git a/x-pack/plugins/observability_solution/observability_shared/public/services/update_global_navigation.test.tsx b/x-pack/plugins/observability_solution/observability_shared/public/services/update_global_navigation.test.tsx index 868a1638a2775..1230ec5034742 100644 --- a/x-pack/plugins/observability_solution/observability_shared/public/services/update_global_navigation.test.tsx +++ b/x-pack/plugins/observability_solution/observability_shared/public/services/update_global_navigation.test.tsx @@ -7,7 +7,7 @@ import { Subject } from 'rxjs'; import { App, AppDeepLink, ApplicationStart, AppUpdater } from '@kbn/core/public'; -import { casesFeatureId, sloFeatureId } from '../../common'; +import { casesFeatureId } from '../../common'; import { updateGlobalNavigation } from './update_global_navigation'; // Used in updater callback @@ -157,70 +157,5 @@ describe('updateGlobalNavigation', () => { }); }); }); - - it("hides the slo link when the capabilities don't include it", () => { - const capabilities = { - navLinks: { apm: true, logs: false, metrics: false, uptime: false }, - } as unknown as ApplicationStart['capabilities']; - - const sloRoute = { - id: 'slos', - title: 'SLOs', - order: 8002, - path: '/slos', - visibleIn: [], - }; - - const deepLinks = [sloRoute]; - - const callback = jest.fn(); - const updater$ = { - next: (cb: AppUpdater) => callback(cb(app)), - } as unknown as Subject; - - updateGlobalNavigation({ capabilities, deepLinks, updater$ }); - - expect(callback).toHaveBeenCalledWith({ - deepLinks: [], // Deeplink has been filtered out - visibleIn: ['sideNav', 'globalSearch', 'home', 'kibanaOverview'], - }); - }); - - describe('when slos are enabled', () => { - it('shows the slos deep link', () => { - const capabilities = { - [casesFeatureId]: { read_cases: true }, - [sloFeatureId]: { read: true }, - navLinks: { apm: false, logs: false, metrics: false, uptime: false }, - } as unknown as ApplicationStart['capabilities']; - - const sloRoute = { - id: 'slos', - title: 'SLOs', - order: 8002, - path: '/slos', - visibleIn: [], - }; - - const deepLinks = [sloRoute]; - - const callback = jest.fn(); - const updater$ = { - next: (cb: AppUpdater) => callback(cb(app)), - } as unknown as Subject; - - updateGlobalNavigation({ capabilities, deepLinks, updater$ }); - - expect(callback).toHaveBeenCalledWith({ - deepLinks: [ - { - ...sloRoute, - visibleIn: ['sideNav', 'globalSearch'], - }, - ], - visibleIn: ['sideNav', 'globalSearch', 'home', 'kibanaOverview'], - }); - }); - }); }); }); diff --git a/x-pack/plugins/observability_solution/observability_shared/public/services/update_global_navigation.tsx b/x-pack/plugins/observability_solution/observability_shared/public/services/update_global_navigation.tsx index 07f92546a09f7..2c854c9b2dcd9 100644 --- a/x-pack/plugins/observability_solution/observability_shared/public/services/update_global_navigation.tsx +++ b/x-pack/plugins/observability_solution/observability_shared/public/services/update_global_navigation.tsx @@ -8,7 +8,7 @@ import { Subject } from 'rxjs'; import { AppUpdater, ApplicationStart, AppDeepLink } from '@kbn/core/public'; import { CasesDeepLinkId } from '@kbn/cases-plugin/public'; -import { casesFeatureId, sloFeatureId } from '../../common'; +import { casesFeatureId } from '../../common'; export function updateGlobalNavigation({ capabilities, @@ -19,12 +19,13 @@ export function updateGlobalNavigation({ deepLinks: AppDeepLink[]; updater$: Subject; }) { - const { apm, logs, metrics, uptime } = capabilities.navLinks; + const { apm, logs, metrics, uptime, slo } = capabilities.navLinks; const someVisible = Object.values({ apm, logs, metrics, uptime, + slo, }).some((visible) => visible); const updatedDeepLinks = deepLinks @@ -54,14 +55,6 @@ export function updateGlobalNavigation({ }; } return null; - case 'slos': - if (!!capabilities[sloFeatureId]?.read) { - return { - ...link, - visibleIn: ['sideNav', 'globalSearch'], - }; - } - return null; default: return link; } @@ -70,9 +63,6 @@ export function updateGlobalNavigation({ updater$.next(() => ({ deepLinks: updatedDeepLinks, - visibleIn: - someVisible || !!capabilities[sloFeatureId]?.read - ? ['sideNav', 'globalSearch', 'home', 'kibanaOverview'] - : [], + visibleIn: someVisible ? ['sideNav', 'globalSearch', 'home', 'kibanaOverview'] : [], })); } diff --git a/x-pack/plugins/observability_solution/observability_shared/tsconfig.json b/x-pack/plugins/observability_solution/observability_shared/tsconfig.json index ced2b3bed57fd..3e62cf75a4d07 100644 --- a/x-pack/plugins/observability_solution/observability_shared/tsconfig.json +++ b/x-pack/plugins/observability_solution/observability_shared/tsconfig.json @@ -41,6 +41,7 @@ "@kbn/management-settings-types", "@kbn/management-settings-utilities", "@kbn/core-chrome-browser", + "@kbn/rule-data-utils", ], "exclude": ["target/**/*"] } diff --git a/x-pack/plugins/observability_solution/slo/.storybook/jest_setup.js b/x-pack/plugins/observability_solution/slo/.storybook/jest_setup.js new file mode 100644 index 0000000000000..32071b8aa3f62 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/.storybook/jest_setup.js @@ -0,0 +1,11 @@ +/* + * 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 { setGlobalConfig } from '@storybook/testing-react'; +import * as globalStorybookConfig from './preview'; + +setGlobalConfig(globalStorybookConfig); diff --git a/x-pack/plugins/observability_solution/slo/.storybook/main.js b/x-pack/plugins/observability_solution/slo/.storybook/main.js new file mode 100644 index 0000000000000..86b48c32f103e --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/.storybook/main.js @@ -0,0 +1,8 @@ +/* + * 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. + */ + +module.exports = require('@kbn/storybook').defaultConfig; diff --git a/x-pack/plugins/observability_solution/slo/.storybook/preview.js b/x-pack/plugins/observability_solution/slo/.storybook/preview.js new file mode 100644 index 0000000000000..3200746243d47 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/.storybook/preview.js @@ -0,0 +1,10 @@ +/* + * 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 { EuiThemeProviderDecorator } from '@kbn/kibana-react-plugin/common'; + +export const decorators = [EuiThemeProviderDecorator]; diff --git a/x-pack/plugins/observability_solution/slo/README.md b/x-pack/plugins/observability_solution/slo/README.md new file mode 100755 index 0000000000000..f577b2da35ec9 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/README.md @@ -0,0 +1,22 @@ +# slos + +A Kibana plugin + +--- + +## Development + +See the [kibana contributing guide](https://github.com/elastic/kibana/blob/main/CONTRIBUTING.md) for instructions setting up your development environment. + +## Scripts + +
+
yarn kbn bootstrap
+
Execute this to install node_modules and setup the dependencies in your plugin and in Kibana
+ +
yarn plugin-helpers build
+
Execute this to create a distributable version of this plugin that can be installed in Kibana
+ +
yarn plugin-helpers dev --watch
+
Execute this to build your plugin ui browser side so Kibana could pick up when started in development
+
diff --git a/x-pack/plugins/observability_solution/observability/common/slo/constants.ts b/x-pack/plugins/observability_solution/slo/common/constants.ts similarity index 68% rename from x-pack/plugins/observability_solution/observability/common/slo/constants.ts rename to x-pack/plugins/observability_solution/slo/common/constants.ts index f98586bf0aea7..31c7be796d7a5 100644 --- a/x-pack/plugins/observability_solution/observability/common/slo/constants.ts +++ b/x-pack/plugins/observability_solution/slo/common/constants.ts @@ -5,6 +5,42 @@ * 2.0. */ +import { i18n } from '@kbn/i18n'; + +export const INVALID_EQUATION_REGEX = /[^A-Z|+|\-|\s|\d+|\.|\(|\)|\/|\*|>|<|=|\?|\:|&|\!|\|]+/g; + +export const ALERT_ACTION_ID = 'slo.burnRate.alert'; +export const ALERT_ACTION = { + id: ALERT_ACTION_ID, + name: i18n.translate('xpack.slo.alerting.burnRate.alertAction', { + defaultMessage: 'Critical', + }), +}; + +export const HIGH_PRIORITY_ACTION_ID = 'slo.burnRate.high'; +export const HIGH_PRIORITY_ACTION = { + id: HIGH_PRIORITY_ACTION_ID, + name: i18n.translate('xpack.slo.alerting.burnRate.highPriorityAction', { + defaultMessage: 'High', + }), +}; + +export const MEDIUM_PRIORITY_ACTION_ID = 'slo.burnRate.medium'; +export const MEDIUM_PRIORITY_ACTION = { + id: MEDIUM_PRIORITY_ACTION_ID, + name: i18n.translate('xpack.slo.alerting.burnRate.mediumPriorityAction', { + defaultMessage: 'Medium', + }), +}; + +export const LOW_PRIORITY_ACTION_ID = 'slo.burnRate.low'; +export const LOW_PRIORITY_ACTION = { + id: LOW_PRIORITY_ACTION_ID, + name: i18n.translate('xpack.slo.alerting.burnRate.lowPriorityAction', { + defaultMessage: 'Low', + }), +}; + export const SLO_MODEL_VERSION = 2; export const SLO_RESOURCES_VERSION = 3; diff --git a/x-pack/plugins/observability_solution/observability/common/field_names/slo.ts b/x-pack/plugins/observability_solution/slo/common/field_names/slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/common/field_names/slo.ts rename to x-pack/plugins/observability_solution/slo/common/field_names/slo.ts diff --git a/x-pack/plugins/observability_solution/slo/common/i18n.ts b/x-pack/plugins/observability_solution/slo/common/i18n.ts new file mode 100644 index 0000000000000..2b5f2a782bb3b --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/common/i18n.ts @@ -0,0 +1,12 @@ +/* + * 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 { i18n } from '@kbn/i18n'; + +export const NOT_AVAILABLE_LABEL = i18n.translate('xpack.slo.notAvailable', { + defaultMessage: 'N/A', +}); diff --git a/x-pack/plugins/observability_solution/slo/common/index.ts b/x-pack/plugins/observability_solution/slo/common/index.ts new file mode 100644 index 0000000000000..a280f7eaedd90 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/common/index.ts @@ -0,0 +1,12 @@ +/* + * 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. + */ + +export const sloAppId = 'slo'; +export const PLUGIN_NAME = 'SLOs'; + +import { paths } from './locators/paths'; +export const sloPaths = paths; diff --git a/x-pack/plugins/observability_solution/slo/common/locators/paths.ts b/x-pack/plugins/observability_solution/slo/common/locators/paths.ts new file mode 100644 index 0000000000000..420688da09201 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/common/locators/paths.ts @@ -0,0 +1,32 @@ +/* + * 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. + */ +export const SLOS_BASE_PATH = '/app/slos'; +export const SLO_PREFIX = '/slos'; +export const SLOS_PATH = '/' as const; +export const SLOS_WELCOME_PATH = '/welcome' as const; +export const SLO_DETAIL_PATH = '/:sloId' as const; +export const SLO_CREATE_PATH = '/create' as const; +export const SLO_EDIT_PATH = '/edit/:sloId' as const; +export const SLOS_OUTDATED_DEFINITIONS_PATH = '/outdated-definitions' as const; + +export const paths = { + slos: `${SLOS_BASE_PATH}${SLOS_PATH}`, + slosWelcome: `${SLOS_BASE_PATH}${SLOS_WELCOME_PATH}`, + slosOutdatedDefinitions: `${SLOS_BASE_PATH}${SLOS_OUTDATED_DEFINITIONS_PATH}`, + sloCreate: `${SLOS_BASE_PATH}${SLO_CREATE_PATH}`, + sloCreateWithEncodedForm: (encodedParams: string) => + `${SLOS_BASE_PATH}${SLO_CREATE_PATH}?_a=${encodedParams}`, + sloEdit: (sloId: string) => `${SLOS_BASE_PATH}${SLOS_PATH}/edit/${encodeURIComponent(sloId)}`, + sloEditWithEncodedForm: (sloId: string, encodedParams: string) => + `${SLOS_BASE_PATH}${SLOS_PATH}/edit/${encodeURIComponent(sloId)}?_a=${encodedParams}`, + sloDetails: (sloId: string, instanceId?: string) => + !!instanceId + ? `${SLOS_BASE_PATH}${SLOS_PATH}/${encodeURIComponent(sloId)}?instanceId=${encodeURIComponent( + instanceId + )}` + : `${SLOS_BASE_PATH}${SLOS_PATH}/${encodeURIComponent(sloId)}`, +}; diff --git a/x-pack/plugins/observability_solution/observability/dev_docs/slo.md b/x-pack/plugins/observability_solution/slo/dev_docs/slo.md similarity index 100% rename from x-pack/plugins/observability_solution/observability/dev_docs/slo.md rename to x-pack/plugins/observability_solution/slo/dev_docs/slo.md diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/README.md b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/README.md similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/README.md rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/README.md diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/bundled.json b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.json similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/bundled.json rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.json diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/bundled.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/bundled.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/bundled.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/README.md b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/README.md similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/README.md rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/README.md diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/headers/kbn_xsrf.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/headers/kbn_xsrf.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/headers/kbn_xsrf.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/headers/kbn_xsrf.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/parameters/slo_id.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/parameters/slo_id.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/parameters/slo_id.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/parameters/slo_id.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/parameters/space_id.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/parameters/space_id.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/parameters/space_id.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/parameters/space_id.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/400_response.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/400_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/400_response.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/400_response.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/401_response.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/401_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/401_response.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/401_response.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/403_response.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/403_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/403_response.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/403_response.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/404_response.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/404_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/404_response.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/404_response.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/409_response.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/409_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/409_response.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/409_response.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/budgeting_method.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/budgeting_method.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/budgeting_method.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/budgeting_method.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/create_slo_request.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/create_slo_request.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/create_slo_request.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/create_slo_request.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/create_slo_response.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/create_slo_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/create_slo_response.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/create_slo_response.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/delete_slo_instances_request.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/delete_slo_instances_request.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/delete_slo_instances_request.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/delete_slo_instances_request.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/error_budget.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/error_budget.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/error_budget.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/error_budget.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/filter.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/filter.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/filter.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/filter.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/filter_meta.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/filter_meta.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/filter_meta.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/filter_meta.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/find_slo_definitions_response.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/find_slo_definitions_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/find_slo_definitions_response.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/find_slo_definitions_response.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/find_slo_response.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/find_slo_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/find_slo_response.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/find_slo_response.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/historical_summary_request.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/historical_summary_request.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/historical_summary_request.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/historical_summary_request.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/historical_summary_response.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/historical_summary_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/historical_summary_response.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/historical_summary_response.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_apm_availability.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_availability.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_apm_availability.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_availability.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_apm_latency.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_latency.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_apm_latency.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_apm_latency.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_custom_kql.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_kql.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_custom_kql.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_kql.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_custom_metric.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_metric.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_custom_metric.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_custom_metric.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_histogram.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_histogram.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_histogram.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_histogram.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_timeslice_metric.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_timeslice_metric.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/indicator_properties_timeslice_metric.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/indicator_properties_timeslice_metric.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/kql_with_filters.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/kql_with_filters.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/kql_with_filters.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/kql_with_filters.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/objective.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/objective.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/objective.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/objective.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/settings.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/settings.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/settings.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/settings.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/slo_definition_response.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/slo_definition_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/slo_definition_response.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/slo_definition_response.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/slo_with_summary_response.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/slo_with_summary_response.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/slo_with_summary_response.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/slo_with_summary_response.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/summary.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/summary.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/summary.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/summary.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/summary_status.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/summary_status.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/summary_status.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/summary_status.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/time_window.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/time_window.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/time_window.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/time_window.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/timeslice_metric_basic_metric_with_field.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_basic_metric_with_field.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/timeslice_metric_basic_metric_with_field.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_basic_metric_with_field.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/timeslice_metric_doc_count_metric.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_doc_count_metric.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/timeslice_metric_doc_count_metric.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_doc_count_metric.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/timeslice_metric_percentile_metric.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_percentile_metric.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/timeslice_metric_percentile_metric.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/timeslice_metric_percentile_metric.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/update_slo_request.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/update_slo_request.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/components/schemas/update_slo_request.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/components/schemas/update_slo_request.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/entrypoint.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/entrypoint.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/entrypoint.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/entrypoint.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/makefile b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/makefile similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/makefile rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/makefile diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/README.md b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/README.md similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/README.md rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/README.md diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@_definitions.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_definitions.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@_definitions.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_definitions.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@_delete_instances.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_delete_instances.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@_delete_instances.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_delete_instances.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@_historical_summary.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_historical_summary.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@_historical_summary.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@_historical_summary.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@_reset.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@_reset.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@_reset.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@_reset.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@disable.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@disable.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@disable.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@disable.yaml diff --git a/x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@enable.yaml b/x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@enable.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@enable.yaml rename to x-pack/plugins/observability_solution/slo/docs/openapi/slo/paths/s@{spaceid}@api@slos@{sloid}@enable.yaml diff --git a/x-pack/plugins/observability_solution/slo/jest.config.js b/x-pack/plugins/observability_solution/slo/jest.config.js new file mode 100644 index 0000000000000..fa7ff9c84deca --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/jest.config.js @@ -0,0 +1,19 @@ +/* + * 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. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../../..', + roots: ['/x-pack/plugins/observability_solution/slo'], + setupFiles: ['/x-pack/plugins/observability_solution/slo/.storybook/jest_setup.js'], + coverageDirectory: + '/target/kibana-coverage/jest/x-pack/plugins/observability_solution/slo', + coverageReporters: ['text', 'html'], + collectCoverageFrom: [ + '/x-pack/plugins/observability_solution/slo/{common,public,server}/**/*.{js,ts,tsx}', + ], +}; diff --git a/x-pack/plugins/observability_solution/slo/kibana.jsonc b/x-pack/plugins/observability_solution/slo/kibana.jsonc new file mode 100644 index 0000000000000..a36cdae8cf897 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/kibana.jsonc @@ -0,0 +1,54 @@ +{ + "type": "plugin", + "id": "@kbn/slo-plugin", + "owner": "@elastic/obs-ux-management-team", + "plugin": { + "id": "slo", + "server": true, + "browser": true, + "configPath": [ + "xpack", + "slo" + ], + "requiredPlugins": [ + "alerting", + "cases", + "charts", + "contentManagement", + "controls", + "data", + "dataViews", + "lens", + "dataViewEditor", + "fieldFormats", + "observability", + "observabilityShared", + "ruleRegistry", + "security", + "taskManager", + "triggersActionsUi", + "share", + "unifiedSearch", + "uiActions", + "embeddable", + "presentationUtil", + "features", + "licensing", + "observabilityAIAssistant", + "usageCollection", + ], + "optionalPlugins": [ + "cloud", + "spaces", + "serverless", + "discover" + ], + "requiredBundles": [ + "kibanaReact", + "kibanaUtils", + "unifiedSearch", + "embeddable", + "ingestPipelines" + ] + } +} diff --git a/x-pack/plugins/observability_solution/slo/public/application.tsx b/x-pack/plugins/observability_solution/slo/public/application.tsx new file mode 100644 index 0000000000000..2e2d01f83409d --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/application.tsx @@ -0,0 +1,137 @@ +/* + * 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 React from 'react'; +import ReactDOM from 'react-dom'; +import { EuiErrorBoundary } from '@elastic/eui'; +import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; +import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; +import { AppMountParameters, APP_WRAPPER_CLASS, CoreStart } from '@kbn/core/public'; +import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public'; +import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; +import { Router, Routes, Route } from '@kbn/shared-ux-router'; +import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; +import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app'; +import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; +import { Storage } from '@kbn/kibana-utils-plugin/public'; +import { ObservabilityRuleTypeRegistry } from '@kbn/observability-plugin/public'; + +import { PluginContext } from './context/plugin_context'; + +import { SloPublicPluginsStart } from './types'; +import { routes } from './routes/routes'; + +function App() { + return ( + <> + + {Object.keys(routes).map((key) => { + const path = key as keyof typeof routes; + const { handler, exact } = routes[path]; + const Wrapper = () => { + return handler(); + }; + return ; + })} + + + ); +} + +export const renderApp = ({ + core, + plugins, + appMountParameters, + ObservabilityPageTemplate, + usageCollection, + isDev, + kibanaVersion, + isServerless, + observabilityRuleTypeRegistry, +}: { + core: CoreStart; + plugins: SloPublicPluginsStart; + appMountParameters: AppMountParameters; + observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry; + ObservabilityPageTemplate: React.ComponentType; + usageCollection: UsageCollectionSetup; + isDev?: boolean; + kibanaVersion: string; + isServerless?: boolean; +}) => { + const { element, history, theme$ } = appMountParameters; + const i18nCore = core.i18n; + const isDarkMode = core.theme.getTheme().darkMode; + + // ensure all divs are .kbnAppWrappers + element.classList.add(APP_WRAPPER_CLASS); + + const queryClient = new QueryClient(); + + const ApplicationUsageTrackingProvider = + usageCollection?.components.ApplicationUsageTrackingProvider ?? React.Fragment; + const CloudProvider = plugins.cloud?.CloudContextProvider ?? React.Fragment; + + const PresentationContextProvider = plugins.presentationUtil?.ContextProvider ?? React.Fragment; + + ReactDOM.render( + + + + + + + + + + + + + + + + + + + + + + + + + , + element + ); + + return () => { + // This needs to be present to fix https://github.com/elastic/kibana/issues/155704 + // as the Overview page renders the UX Section component. That component renders a Lens embeddable + // via the ExploratoryView app, which uses search sessions. Therefore on unmounting we need to clear + // these sessions. + plugins.data.search.session.clear(); + ReactDOM.unmountComponentAtNode(element); + }; +}; diff --git a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/alert_time_table.tsx b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/alert_time_table.tsx similarity index 85% rename from x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/alert_time_table.tsx rename to x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/alert_time_table.tsx index 9a12f79b6c1b7..b2c582fc019ca 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/alert_time_table.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/alert_time_table.tsx @@ -24,12 +24,12 @@ function formatTime(minutes: number) { if (minutes > 59) { const mins = minutes % 60; const hours = (minutes - mins) / 60; - return i18n.translate('xpack.observability.slo.rules.timeTable.minuteHoursLabel', { + return i18n.translate('xpack.slo.rules.timeTable.minuteHoursLabel', { defaultMessage: '{hours}h {mins}m', values: { hours, mins }, }); } - return i18n.translate('xpack.observability.slo.rules.timeTable.minuteLabel', { + return i18n.translate('xpack.slo.rules.timeTable.minuteLabel', { defaultMessage: '{minutes}m', values: { minutes }, }); @@ -55,7 +55,7 @@ export function AlertTimeTable({ windows, slo }: AlertTimeTableProps) { const columns = [ { field: 'rate', - name: i18n.translate('xpack.observability.slo.rules.timeTable.rateColumnLabel', { + name: i18n.translate('xpack.slo.rules.timeTable.rateColumnLabel', { defaultMessage: 'Error rate', }), render: (rate: number) => numeral(rate).format('0%'), @@ -73,7 +73,7 @@ export function AlertTimeTable({ windows, slo }: AlertTimeTableProps) { <>
- {i18n.translate('xpack.observability.slo.rules.timeTable.title', { + {i18n.translate('xpack.slo.rules.timeTable.title', { defaultMessage: 'How long will it take for the alert to fire?', })}
@@ -81,7 +81,7 @@ export function AlertTimeTable({ windows, slo }: AlertTimeTableProps) {

- {i18n.translate('xpack.observability.slo.rules.timeTable.description', { + {i18n.translate('xpack.slo.rules.timeTable.description', { defaultMessage: 'The table below lists the error rates and approximately how long it would take to receive your first alert with the current configuration.', })} @@ -89,7 +89,7 @@ export function AlertTimeTable({ windows, slo }: AlertTimeTableProps) { - tableCaption={i18n.translate('xpack.observability.slo.rules.tableCaption', { + tableCaption={i18n.translate('xpack.slo.rules.tableCaption', { defaultMessage: 'Alerting time table', })} items={rows} diff --git a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/budget_consumed.tsx b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/budget_consumed.tsx similarity index 92% rename from x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/budget_consumed.tsx rename to x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/budget_consumed.tsx index 005cefec1e30f..ef0126a2e7686 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/budget_consumed.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/budget_consumed.tsx @@ -41,12 +41,12 @@ export function BudgetConsumed({ - {i18n.translate('xpack.observability.slo.rules.budgetConsumed.rowLabel', { + {i18n.translate('xpack.slo.rules.budgetConsumed.rowLabel', { defaultMessage: '% Budget consumed', })}{' '} diff --git a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/burn_rate.tsx b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/burn_rate.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/burn_rate.tsx rename to x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/burn_rate.tsx index 1e76ddec456e2..91ce6491911e0 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/burn_rate.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/burn_rate.tsx @@ -31,12 +31,12 @@ export function BurnRate({ onChange, initialBurnRate = 1, maxBurnRate, errors }: - {i18n.translate('xpack.observability.slo.rules.burnRate.rowLabel', { + {i18n.translate('xpack.slo.rules.burnRate.rowLabel', { defaultMessage: 'Burn rate threshold', })}{' '}

- {i18n.translate('xpack.observability.burnRateRuleEditor.h5.chooseASLOToMonitorLabel', { + {i18n.translate('xpack.slo.burnRateRuleEditor.h5.chooseASLOToMonitorLabel', { defaultMessage: 'Choose a SLO to monitor', })}
@@ -74,7 +74,7 @@ export function BurnRateRuleEditor(props: Props) { ( <> - {i18n.translate('xpack.observability.slo.rules.longWindow.rowLabel', { + {i18n.translate('xpack.slo.rules.longWindow.rowLabel', { defaultMessage: 'Lookback (hours)', })}{' '} @@ -62,7 +62,7 @@ const getRowLabel = (shortWindowDuration: Duration) => ( ); const getTooltipText = (shortWindowDuration: Duration) => - i18n.translate('xpack.observability.slo.rules.longWindowDuration.tooltip', { + i18n.translate('xpack.slo.rules.longWindowDuration.tooltip', { defaultMessage: 'Lookback period over which the burn rate is computed. A shorter lookback period of {shortWindowDuration} minutes (1/12 the lookback period) will be used for faster recovery', values: { shortWindowDuration: toMinutes(shortWindowDuration) }, diff --git a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/slo_selector.stories.tsx b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.stories.tsx similarity index 86% rename from x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/slo_selector.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.stories.tsx index f0f3a4cf44733..b69861b45103b 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/slo_selector.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { SLOResponse } from '@kbn/slo-schema'; -import { KibanaReactStorybookDecorator } from '../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloSelector as Component } from './slo_selector'; export default { @@ -19,6 +19,7 @@ export default { }; const Template: ComponentStory = () => ( + // eslint-disable-next-line no-console console.log(slo)} /> ); const defaultProps = {}; diff --git a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/slo_selector.test.tsx b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.test.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/slo_selector.test.tsx rename to x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.test.tsx index ce401e7e0f1c2..e3dc1fb24bda2 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/slo_selector.test.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.test.tsx @@ -11,11 +11,11 @@ import { wait } from '@testing-library/user-event/dist/utils'; import React from 'react'; import { emptySloList } from '../../data/slo/slo'; -import { useFetchSloDefinitions } from '../../hooks/slo/use_fetch_slo_definitions'; +import { useFetchSloDefinitions } from '../../hooks/use_fetch_slo_definitions'; import { render } from '../../utils/test_helper'; import { SloSelector } from './slo_selector'; -jest.mock('../../hooks/slo/use_fetch_slo_definitions'); +jest.mock('../../hooks/use_fetch_slo_definitions'); const useFetchSloDefinitionsMock = useFetchSloDefinitions as jest.Mock; diff --git a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/slo_selector.tsx b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.tsx similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/slo_selector.tsx rename to x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.tsx index 6e35ce265bad5..b860502dc57a9 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/slo_selector.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/slo_selector.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { SLOResponse } from '@kbn/slo-schema'; import { debounce } from 'lodash'; import React, { useEffect, useMemo, useState } from 'react'; -import { useFetchSloDefinitions } from '../../hooks/slo/use_fetch_slo_definitions'; +import { useFetchSloDefinitions } from '../../hooks/use_fetch_slo_definitions'; interface Props { initialSlo?: SLOResponse; @@ -54,10 +54,10 @@ function SloSelector({ initialSlo, onSelected, errors }: Props) { error={hasError ? errors[0] : undefined} > { return unit === 'h' && value >= MIN_DURATION_IN_HOURS && value <= MAX_DURATION_IN_HOURS; }; -const SLO_REQUIRED = i18n.translate('xpack.observability.slo.rules.burnRate.errors.sloRequired', { +const SLO_REQUIRED = i18n.translate('xpack.slo.rules.burnRate.errors.sloRequired', { defaultMessage: 'SLO is required.', }); const LONG_WINDOW_DURATION_REQUIRED = i18n.translate( - 'xpack.observability.slo.rules.burnRate.errors.windowDurationRequired', + 'xpack.slo.rules.burnRate.errors.windowDurationRequired', { defaultMessage: 'The lookback period is required.' } ); -const LONG_WINDOW_DURATION_INVALID = i18n.translate( - 'xpack.observability.slo.rules.longWindow.errorText', - { - defaultMessage: 'The lookback period must be between 1 and 72 hours.', - } -); +const LONG_WINDOW_DURATION_INVALID = i18n.translate('xpack.slo.rules.longWindow.errorText', { + defaultMessage: 'The lookback period must be between 1 and 72 hours.', +}); const BURN_RATE_THRESHOLD_REQUIRED = i18n.translate( - 'xpack.observability.slo.rules.burnRate.errors.burnRateThresholdRequired', + 'xpack.slo.rules.burnRate.errors.burnRateThresholdRequired', { defaultMessage: 'Burn rate threshold is required.' } ); const getInvalidThresholdValueError = (maxBurnRate: number) => - i18n.translate('xpack.observability.slo.rules.burnRate.errors.invalidThresholdValue', { + i18n.translate('xpack.slo.rules.burnRate.errors.invalidThresholdValue', { defaultMessage: 'Burn rate threshold must be between 0.01 and {maxBurnRate}.', values: { maxBurnRate }, }); diff --git a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/windows.tsx b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/windows.tsx similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/windows.tsx rename to x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/windows.tsx index 69e05a4537d75..ab01fee1b97ee 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/burn_rate_rule_editor/windows.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/burn_rate_rule_editor/windows.tsx @@ -167,7 +167,7 @@ function Window({ )} @@ -176,7 +176,7 @@ function Window({ options={ACTION_GROUP_OPTIONS} value={actionGroup} onChange={onActionGroupChange} - aria-label={i18n.translate('xpack.observability.slo.rules.actionGroupSelectorLabel', { + aria-label={i18n.translate('xpack.slo.rules.actionGroupSelectorLabel', { defaultMessage: 'Action Group', })} /> @@ -190,10 +190,10 @@ function Window({ style={{ marginBottom: '-1em' }} onClick={() => onDelete(id)} disabled={disableDelete} - title={i18n.translate('xpack.observability.slo.rules.deleteWindowLabel', { + title={i18n.translate('xpack.slo.rules.deleteWindowLabel', { defaultMessage: 'Delete window', })} - aria-label={i18n.translate('xpack.observability.slo.rules.deleteWindowLabel', { + aria-label={i18n.translate('xpack.slo.rules.deleteWindowLabel', { defaultMessage: 'Delete window', })} /> @@ -229,7 +229,7 @@ const getErrorBudgetExhaustionText = ( budgetMode = false ) => budgetMode - ? i18n.translate('xpack.observability.slo.rules.errorBudgetExhaustion.budgetMode.text', { + ? i18n.translate('xpack.slo.rules.errorBudgetExhaustion.budgetMode.text', { defaultMessage: '{formatedHours} hours until error budget exhaustion. The burn rate threshold is {burnRateThreshold}x.', values: { @@ -237,7 +237,7 @@ const getErrorBudgetExhaustionText = ( burnRateThreshold: numeral(burnRateThreshold).format('0[.0]'), }, }) - : i18n.translate('xpack.observability.slo.rules.errorBudgetExhaustion.burnRateMode.text', { + : i18n.translate('xpack.slo.rules.errorBudgetExhaustion.burnRateMode.text', { defaultMessage: '{formatedHours} hours until error budget exhaustion. {budgetConsumed} budget consumed before first alert.', values: { @@ -245,7 +245,6 @@ const getErrorBudgetExhaustionText = ( budgetConsumed: numeral(budgetConsumed).format('0.00%'), }, }); - export const createNewWindow = ( slo?: SLOResponse | CreateSLOInput, partialWindow: Partial = {} @@ -292,7 +291,7 @@ export function Windows({ slo, windows, errors, onChange, totalNumberOfWindows } <>
- {i18n.translate('xpack.observability.burnRateRuleEditor.h5.defineMultipleBurnRateLabel', { + {i18n.translate('xpack.slo.burnRateRuleEditor.h5.defineMultipleBurnRateLabel', { defaultMessage: 'Define multiple burn rate windows', })}
@@ -325,14 +324,11 @@ export function Windows({ slo, windows, errors, onChange, totalNumberOfWindows } iconType={'plusInCircleFilled'} onClick={handleAddWindow} isDisabled={windows.length === (totalNumberOfWindows || 4)} - aria-label={i18n.translate('xpack.observability.slo.rules.addWindowAriaLabel', { + aria-label={i18n.translate('xpack.slo.rules.addWindowAriaLabel', { defaultMessage: 'Add window', })} > - +
@@ -340,7 +336,7 @@ export function Windows({ slo, windows, errors, onChange, totalNumberOfWindows } compressed onChange={handleModeChange} checked={!budgetMode} - label={i18n.translate('xpack.observability.slo.rules.useBurnRateModeLabel', { + label={i18n.translate('xpack.slo.rules.useBurnRateModeLabel', { defaultMessage: 'Burn rate mode', })} /> diff --git a/x-pack/plugins/observability_solution/slo/public/components/header_menu/header_menu.tsx b/x-pack/plugins/observability_solution/slo/public/components/header_menu/header_menu.tsx new file mode 100644 index 0000000000000..2b76afab609e1 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/components/header_menu/header_menu.tsx @@ -0,0 +1,42 @@ +/* + * 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 React from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiFlexGroup, EuiFlexItem, EuiHeaderLink, EuiHeaderLinks } from '@elastic/eui'; +import { HeaderMenuPortal } from '@kbn/observability-shared-plugin/public'; +import { useKibana } from '../../utils/kibana_react'; +import { usePluginContext } from '../../hooks/use_plugin_context'; + +export function HeaderMenu(): React.ReactElement | null { + const { http, theme } = useKibana().services; + + const { appMountParameters } = usePluginContext(); + + return ( + + + + + + {i18n.translate('xpack.slo.headerMenu.addData', { + defaultMessage: 'Add integrations', + })} + + + + + + ); +} diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/auto_refresh_button/auto_refresh_button.stories.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/auto_refresh_button.stories.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/components/slo/auto_refresh_button/auto_refresh_button.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/auto_refresh_button.stories.tsx index 5a5b94401253e..e892ebe5d2090 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/auto_refresh_button/auto_refresh_button.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/auto_refresh_button.stories.tsx @@ -8,7 +8,7 @@ import React, { useState } from 'react'; import { ComponentStory } from '@storybook/react'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { AutoRefreshButton as Component } from './auto_refresh_button'; export default { diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/auto_refresh_button/auto_refresh_button.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/auto_refresh_button.tsx similarity index 86% rename from x-pack/plugins/observability_solution/observability/public/components/slo/auto_refresh_button/auto_refresh_button.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/auto_refresh_button.tsx index c19c3d19e54d9..bb766f2ad4230 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/auto_refresh_button/auto_refresh_button.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/auto_refresh_button.tsx @@ -23,7 +23,7 @@ export function AutoRefreshButton({ disabled, isAutoRefreshing, onClick }: Props iconType="pause" onClick={onClick} > - {i18n.translate('xpack.observability.slosPage.stopRefreshingButtonLabel', { + {i18n.translate('xpack.slo.slosPage.stopRefreshingButtonLabel', { defaultMessage: 'Stop refreshing', })} @@ -35,7 +35,7 @@ export function AutoRefreshButton({ disabled, isAutoRefreshing, onClick }: Props iconType="play" onClick={onClick} > - {i18n.translate('xpack.observability.slosPage.autoRefreshButtonLabel', { + {i18n.translate('xpack.slo.slosPage.autoRefreshButtonLabel', { defaultMessage: 'Auto-refresh', })} diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/auto_refresh_button/hooks/use_auto_refresh_storage.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/hooks/use_auto_refresh_storage.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/components/slo/auto_refresh_button/hooks/use_auto_refresh_storage.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/hooks/use_auto_refresh_storage.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/auto_refresh_button/index.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/index.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/components/slo/auto_refresh_button/index.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/auto_refresh_button/index.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/alert_details_app_section.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/alert_details_app_section.tsx similarity index 78% rename from x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/alert_details_app_section.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/alert_details_app_section.tsx index 26512aef807d5..8646f38fe83d6 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/alert_details_app_section.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/alert_details_app_section.tsx @@ -9,11 +9,10 @@ import { EuiFlexGroup, EuiLink } from '@elastic/eui'; import { Rule } from '@kbn/alerting-plugin/common'; import { i18n } from '@kbn/i18n'; import React, { useEffect } from 'react'; -import { useFetchSloDetails } from '../../../../hooks/slo/use_fetch_slo_details'; -import { AlertSummaryField } from '../../../../pages/alert_details/components/alert_summary'; -import { TopAlert } from '../../../../typings/alerts'; -import { BurnRateRuleParams } from '../../../../typings/slo'; +import { AlertSummaryField, TopAlert } from '@kbn/observability-plugin/public'; import { useKibana } from '../../../../utils/kibana_react'; +import { useFetchSloDetails } from '../../../../hooks/use_fetch_slo_details'; +import { BurnRateRuleParams } from '../../../../typings/slo'; import { AlertsHistoryPanel } from './components/alerts_history/alerts_history_panel'; import { ErrorRatePanel } from './components/error_rate/error_rate_panel'; @@ -48,12 +47,9 @@ export default function AlertDetailsAppSection({ useEffect(() => { setAlertSummaryFields([ { - label: i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.summaryField.slo', - { - defaultMessage: 'Source SLO', - } - ), + label: i18n.translate('xpack.slo.burnRateRule.alertDetailsAppSection.summaryField.slo', { + defaultMessage: 'Source SLO', + }), value: ( {slo?.name ?? '-'} @@ -61,12 +57,9 @@ export default function AlertDetailsAppSection({ ), }, { - label: i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.summaryField.rule', - { - defaultMessage: 'Rule', - } - ), + label: i18n.translate('xpack.slo.burnRateRule.alertDetailsAppSection.summaryField.rule', { + defaultMessage: 'Rule', + }), value: ( {rule.name} diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/components/alerts_history/alerts_history_panel.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/components/alerts_history/alerts_history_panel.tsx similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/components/alerts_history/alerts_history_panel.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/components/alerts_history/alerts_history_panel.tsx index 47320da6cce5a..7232fa860791c 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/components/alerts_history/alerts_history_panel.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/components/alerts_history/alerts_history_panel.tsx @@ -26,9 +26,9 @@ import { ALERT_RULE_PARAMETERS } from '@kbn/rule-data-utils'; import { GetSLOResponse } from '@kbn/slo-schema'; import moment from 'moment'; import React from 'react'; -import { convertTo } from '../../../../../../../common/utils/formatters'; -import { WindowSchema } from '../../../../../../typings'; +import { convertTo } from '@kbn/observability-plugin/public'; import { useKibana } from '../../../../../../utils/kibana_react'; +import { WindowSchema } from '../../../../../../typings'; import { ErrorRateChart } from '../../../../error_rate_chart'; import { BurnRateAlert, BurnRateRule } from '../../alert_details_app_section'; import { getActionGroupFromReason } from '../../utils/alert'; @@ -85,7 +85,7 @@ export function AlertsHistoryPanel({ rule, slo, alert, isLoading }: Props) {

{i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.alertsHistory.title', + 'xpack.slo.burnRateRule.alertDetailsAppSection.alertsHistory.title', { defaultMessage: '{sloName} alerts history', values: { sloName: slo.name } } )}

@@ -95,7 +95,7 @@ export function AlertsHistoryPanel({ rule, slo, alert, isLoading }: Props) { @@ -106,7 +106,7 @@ export function AlertsHistoryPanel({ rule, slo, alert, isLoading }: Props) { {i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.alertsHistory.subtitle', + 'xpack.slo.burnRateRule.alertDetailsAppSection.alertsHistory.subtitle', { defaultMessage: 'Last 30 days', } @@ -138,7 +138,7 @@ export function AlertsHistoryPanel({ rule, slo, alert, isLoading }: Props) { {i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.alertsHistory.triggeredAlertsStatsTitle', + 'xpack.slo.burnRateRule.alertDetailsAppSection.alertsHistory.triggeredAlertsStatsTitle', { defaultMessage: 'Alerts triggered' } )} @@ -171,7 +171,7 @@ export function AlertsHistoryPanel({ rule, slo, alert, isLoading }: Props) { {i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.alertsHistory.avgTimeToRecoverStatsTitle', + 'xpack.slo.burnRateRule.alertDetailsAppSection.alertsHistory.avgTimeToRecoverStatsTitle', { defaultMessage: 'Avg time to recover' } )} diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/components/error_rate/error_rate_panel.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/components/error_rate/error_rate_panel.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/components/error_rate/error_rate_panel.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/components/error_rate/error_rate_panel.tsx index 59725b64c2401..d8a2808ef5d1e 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/components/error_rate/error_rate_panel.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/components/error_rate/error_rate_panel.tsx @@ -91,10 +91,10 @@ export function ErrorRatePanel({ alert, slo, isLoading }: Props) {

- {i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.burnRate.title', - { defaultMessage: '{sloName} burn rate', values: { sloName: slo.name } } - )} + {i18n.translate('xpack.slo.burnRateRule.alertDetailsAppSection.burnRate.title', { + defaultMessage: '{sloName} burn rate', + values: { sloName: slo.name }, + })}

@@ -106,7 +106,7 @@ export function ErrorRatePanel({ alert, slo, isLoading }: Props) { >
@@ -130,7 +130,7 @@ export function ErrorRatePanel({ alert, slo, isLoading }: Props) { {i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.burnRate.thresholdBreachedTitle', + 'xpack.slo.burnRateRule.alertDetailsAppSection.burnRate.thresholdBreachedTitle', { defaultMessage: 'Threshold breached' } )} @@ -150,7 +150,7 @@ export function ErrorRatePanel({ alert, slo, isLoading }: Props) { {i18n.translate( - 'xpack.observability.slo.burnRateRule.alertDetailsAppSection.burnRate.tresholdSubtitle', + 'xpack.slo.burnRateRule.alertDetailsAppSection.burnRate.tresholdSubtitle', { defaultMessage: 'Alert when > {threshold}x', values: { diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/utils/alert.ts b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/utils/alert.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/alert_details/utils/alert.ts rename to x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/utils/alert.ts diff --git a/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/utils/last_duration_i18n.ts b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/utils/last_duration_i18n.ts new file mode 100644 index 0000000000000..cda5f292a8a8e --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/alert_details/utils/last_duration_i18n.ts @@ -0,0 +1,52 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import moment from 'moment'; +import { TimeRange } from '../../../error_rate_chart/use_lens_definition'; + +export function getLastDurationInUnit(timeRange: TimeRange): string { + const duration = moment.duration(moment(timeRange.to).diff(timeRange.from)); + const durationInSeconds = duration.asSeconds(); + + const oneMinute = 60; + if (durationInSeconds < oneMinute) { + return i18n.translate('xpack.slo.burnRateRule.alertDetailsAppSection.lastDurationInSeconds', { + defaultMessage: 'Last {duration} seconds', + values: { + duration: Math.trunc(durationInSeconds), + }, + }); + } + + const twoHours = 2 * 60 * 60; + if (durationInSeconds < twoHours) { + return i18n.translate('xpack.slo.burnRateRule.alertDetailsAppSection.lastDurationInMinutes', { + defaultMessage: 'Last {duration} minutes', + values: { + duration: Math.trunc(duration.asMinutes()), + }, + }); + } + + const twoDays = 2 * 24 * 60 * 60; + if (durationInSeconds < twoDays) { + return i18n.translate('xpack.slo.burnRateRule.alertDetailsAppSection.lastDurationInHours', { + defaultMessage: 'Last {duration} hours', + values: { + duration: Math.trunc(duration.asHours()), + }, + }); + } + + return i18n.translate('xpack.slo.burnRateRule.alertDetailsAppSection.lastDurationInDays', { + defaultMessage: 'Last {duration} days', + values: { + duration: Math.trunc(duration.asDays()), + }, + }); +} diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/burn_rate.test.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/burn_rate.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/burn_rate.test.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/burn_rate.test.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/burn_rate.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/burn_rate.tsx similarity index 85% rename from x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/burn_rate.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/burn_rate.tsx index 910818a846a91..3c630263fedb1 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/burn_rate.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/burn_rate.tsx @@ -24,15 +24,15 @@ type Status = 'NO_DATA' | 'BREACHED' | 'OK'; function getTitleFromStatus(status: Status): string { if (status === 'NO_DATA') - return i18n.translate('xpack.observability.slo.burnRate.noDataStatusTitle', { + return i18n.translate('xpack.slo.burnRate.noDataStatusTitle', { defaultMessage: 'No value', }); if (status === 'BREACHED') - return i18n.translate('xpack.observability.slo.burnRate.breachedStatustTitle', { + return i18n.translate('xpack.slo.burnRate.breachedStatustTitle', { defaultMessage: 'Critical value breached', }); - return i18n.translate('xpack.observability.slo.burnRate.okStatusTitle', { + return i18n.translate('xpack.slo.burnRate.okStatusTitle', { defaultMessage: 'Acceptable value', }); } @@ -43,11 +43,11 @@ function getSubtitleFromStatus( slo: SLOResponse ): string { if (status === 'NO_DATA') - return i18n.translate('xpack.observability.slo.burnRate.noDataStatusSubtitle', { + return i18n.translate('xpack.slo.burnRate.noDataStatusSubtitle', { defaultMessage: 'Waiting for more data.', }); if (status === 'BREACHED') - return i18n.translate('xpack.observability.slo.burnRate.breachedStatustSubtitle', { + return i18n.translate('xpack.slo.burnRate.breachedStatustSubtitle', { defaultMessage: 'At current rate, the error budget will be exhausted in {hour} hours.', values: { hour: numeral( @@ -58,7 +58,7 @@ function getSubtitleFromStatus( }, }); - return i18n.translate('xpack.observability.slo.burnRate.okStatusSubtitle', { + return i18n.translate('xpack.slo.burnRate.okStatusSubtitle', { defaultMessage: 'There is no risk of error budget exhaustion.', }); } @@ -96,7 +96,7 @@ export function BurnRate({ threshold, burnRate, slo, isLoading }: BurnRateParams description={ - {i18n.translate('xpack.observability.slo.burnRate.threshold', { + {i18n.translate('xpack.slo.burnRate.threshold', { defaultMessage: 'Threshold is {threshold}x', values: { threshold: numeral(threshold).format('0.[00]') }, })} diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/burn_rates.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/burn_rates.tsx similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/burn_rates.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/burn_rates.tsx index 7c45954fda0d9..1ab81f668bdbe 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/burn_rate/burn_rates.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/burn_rate/burn_rates.tsx @@ -17,7 +17,7 @@ import { i18n } from '@kbn/i18n'; import { SLOWithSummaryResponse } from '@kbn/slo-schema'; import moment from 'moment'; import React, { useEffect, useState } from 'react'; -import { useFetchSloBurnRates } from '../../../hooks/slo/use_fetch_slo_burn_rates'; +import { useFetchSloBurnRates } from '../../../hooks/use_fetch_slo_burn_rates'; import { ErrorRateChart } from '../error_rate_chart'; import { BurnRate } from './burn_rate'; @@ -76,7 +76,7 @@ export function BurnRates({ slo, isAutoRefreshing, burnRateOptions }: Props) {

- {i18n.translate('xpack.observability.slo.burnRate.title', { + {i18n.translate('xpack.slo.burnRate.title', { defaultMessage: 'Burn rate', })}

@@ -84,16 +84,13 @@ export function BurnRates({ slo, isAutoRefreshing, burnRateOptions }: Props) {
({ id: opt.id, label: opt.label }))} diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.stories.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.stories.tsx similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.stories.tsx index 675aba1158010..d004e2131bdeb 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.stories.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloDeleteConfirmationModal as Component, SloDeleteConfirmationModalProps, diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.tsx similarity index 70% rename from x-pack/plugins/observability_solution/observability/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.tsx index 2c8ae6272d916..d14a36e77f88f 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/delete_confirmation_modal/slo_delete_confirmation_modal.tsx @@ -27,28 +27,26 @@ export function SloDeleteConfirmationModal({ {groupBy !== ALL_VALUE - ? i18n.translate('xpack.observability.slo.deleteConfirmationModal.groupByDisclaimerText', { + ? i18n.translate('xpack.slo.deleteConfirmationModal.groupByDisclaimerText', { defaultMessage: 'This SLO has been generated with a group key on {groupKey}. Deleting this SLO definition will result in all instances being deleted.', values: { groupKey: getGroupKeysProse(slo.groupBy) }, }) - : i18n.translate('xpack.observability.slo.deleteConfirmationModal.descriptionText', { + : i18n.translate('xpack.slo.deleteConfirmationModal.descriptionText', { defaultMessage: "You can't recover this SLO after deleting it.", })} diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/error_rate_chart/error_rate_chart.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/error_rate_chart.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/components/slo/error_rate_chart/error_rate_chart.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/error_rate_chart.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/error_rate_chart/index.ts b/x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/components/slo/error_rate_chart/index.ts rename to x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/index.ts diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/error_rate_chart/use_lens_definition.ts b/x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/use_lens_definition.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/public/components/slo/error_rate_chart/use_lens_definition.ts rename to x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/use_lens_definition.ts index a062f120fa473..1624418a1e986 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/error_rate_chart/use_lens_definition.ts +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/error_rate_chart/use_lens_definition.ts @@ -12,7 +12,7 @@ import { TypedLensByValueInput } from '@kbn/lens-plugin/public'; import { ALL_VALUE, SLOResponse } from '@kbn/slo-schema'; import moment from 'moment'; import { v4 as uuidv4 } from 'uuid'; -import { SLO_DESTINATION_INDEX_PATTERN } from '../../../../common/slo/constants'; +import { SLO_DESTINATION_INDEX_PATTERN } from '../../../../common/constants'; export interface TimeRange { from: Date; @@ -110,7 +110,7 @@ export function useLensDefinition( { type: 'manual', id: uuidv4(), - label: i18n.translate('xpack.observability.slo.errorRateChart.alertLabel', { + label: i18n.translate('xpack.slo.errorRateChart.alertLabel', { defaultMessage: 'Alert', }), key: { @@ -123,12 +123,9 @@ export function useLensDefinition( }, { type: 'manual', - label: i18n.translate( - 'xpack.observability.slo.errorRateChart.activeAlertLabel', - { - defaultMessage: 'Active alert', - } - ), + label: i18n.translate('xpack.slo.errorRateChart.activeAlertLabel', { + defaultMessage: 'Active alert', + }), key: { type: 'range', timestamp: moment(alertTimeRange.from).toISOString(), @@ -151,10 +148,10 @@ export function useLensDefinition( { type: 'manual', id: uuidv4(), - label: i18n.translate( - 'xpack.observability.slo.errorRateChart.alertAnnotationLabel', - { defaultMessage: '{total} alert', values: { total: annotation.total } } - ), + label: i18n.translate('xpack.slo.errorRateChart.alertAnnotationLabel', { + defaultMessage: '{total} alert', + values: { total: annotation.total }, + }), key: { type: 'point_in_time', timestamp: moment(annotation.date).toISOString(), @@ -262,7 +259,7 @@ export function useLensDefinition( customLabel: true, }, '9f69a7b0-34b9-4b76-9ff7-26dc1a06ec14': { - label: i18n.translate('xpack.observability.slo.errorRateChart.errorRateLabel', { + label: i18n.translate('xpack.slo.errorRateChart.errorRateLabel', { defaultMessage: 'Error rate', }), dataType: 'number', @@ -352,7 +349,7 @@ export function useLensDefinition( customLabel: true, }, '9f69a7b0-34b9-4b76-9ff7-26dc1a06ec14': { - label: i18n.translate('xpack.observability.slo.errorRateChart.errorRateLabel', { + label: i18n.translate('xpack.slo.errorRateChart.errorRateLabel', { defaultMessage: 'Error rate', }), dataType: 'number', diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/reset_confirmation_modal/slo_reset_confirmation_modal.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/reset_confirmation_modal/slo_reset_confirmation_modal.tsx similarity index 68% rename from x-pack/plugins/observability_solution/observability/public/components/slo/reset_confirmation_modal/slo_reset_confirmation_modal.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/reset_confirmation_modal/slo_reset_confirmation_modal.tsx index 9fabcb61efc96..96d62ddff8d49 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/reset_confirmation_modal/slo_reset_confirmation_modal.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/reset_confirmation_modal/slo_reset_confirmation_modal.tsx @@ -26,22 +26,20 @@ export function SloResetConfirmationModal({ - {i18n.translate('xpack.observability.slo.resetConfirmationModal.descriptionText', { + {i18n.translate('xpack.slo.resetConfirmationModal.descriptionText', { defaultMessage: 'Resetting this SLO will also regenerate the historical data.', })} diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/slo_outdated_callout/index.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/slo_outdated_callout/index.tsx similarity index 83% rename from x-pack/plugins/observability_solution/observability/public/components/slo/slo_outdated_callout/index.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/slo_outdated_callout/index.tsx index de09904d0637c..8495c43d677b3 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/slo_outdated_callout/index.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/slo_outdated_callout/index.tsx @@ -8,8 +8,8 @@ import { EuiButton, EuiCallOut, EuiSpacer } from '@elastic/eui'; import React from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { useFetchSloDefinitions } from '../../../hooks/slo/use_fetch_slo_definitions'; import { useKibana } from '../../../utils/kibana_react'; +import { useFetchSloDefinitions } from '../../../hooks/use_fetch_slo_definitions'; import { paths } from '../../../../common/locators/paths'; export function SloOutdatedCallout() { @@ -19,7 +19,7 @@ export function SloOutdatedCallout() { } = useKibana().services; const handleClick = () => { - navigateToUrl(basePath.prepend(paths.observability.slosOutdatedDefinitions)); + navigateToUrl(basePath.prepend(paths.slosOutdatedDefinitions)); }; const { isLoading, data } = useFetchSloDefinitions({ includeOutdatedOnly: true }); @@ -29,7 +29,7 @@ export function SloOutdatedCallout() {

@@ -51,7 +51,7 @@ export function SloOutdatedCallout() { onClick={handleClick} > diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/index.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/index.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/index.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/index.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_active_alerts_badge.stories.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.stories.tsx similarity index 89% rename from x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_active_alerts_badge.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.stories.tsx index c9f07555897c5..487dc17eba66c 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_active_alerts_badge.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { EuiFlexGroup } from '@elastic/eui'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloActiveAlertsBadge as Component, Props } from './slo_active_alerts_badge'; export default { diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_active_alerts_badge.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.tsx similarity index 82% rename from x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_active_alerts_badge.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.tsx index 991f534815f24..75a08174ac60b 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_active_alerts_badge.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_active_alerts_badge.tsx @@ -9,8 +9,7 @@ import { EuiBadge, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; import { SLOWithSummaryResponse } from '@kbn/slo-schema'; - -import { paths } from '../../../../common/locators/paths'; +import { observabilityPaths } from '@kbn/observability-plugin/common'; import { useKibana } from '../../../utils/kibana_react'; export interface Props { @@ -32,7 +31,7 @@ export function SloActiveAlertsBadge({ slo, activeAlerts, viewMode = 'default' } ); navigateToUrl( `${basePath.prepend( - paths.observability.alerts + observabilityPaths.alerts )}?_a=(kuery:${kuery},rangeFrom:now-15m,rangeTo:now,status:active)` ); } @@ -48,15 +47,14 @@ export function SloActiveAlertsBadge({ slo, activeAlerts, viewMode = 'default' } iconType="warning" color="danger" onClick={handleActiveAlertsClick} - onClickAriaLabel={i18n.translate( - 'xpack.observability.slo.slo.activeAlertsBadge.ariaLabel', - { defaultMessage: 'active alerts badge' } - )} + onClickAriaLabel={i18n.translate('xpack.slo.slo.activeAlertsBadge.ariaLabel', { + defaultMessage: 'active alerts badge', + })} data-test-subj="o11ySloActiveAlertsBadge" > {viewMode !== 'default' ? activeAlerts - : i18n.translate('xpack.observability.slo.slo.activeAlertsBadge.label', { + : i18n.translate('xpack.slo.slo.activeAlertsBadge.label', { defaultMessage: '{count, plural, one {# alert} other {# alerts}}', values: { count: activeAlerts }, })} diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_status_badge.stories.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_status_badge.stories.tsx similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_status_badge.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_status_badge.stories.tsx index a7acf522c0b46..e14af67c323ca 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_status_badge.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_status_badge.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { EuiFlexGroup } from '@elastic/eui'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloStatusBadge as Component, SloStatusProps } from './slo_status_badge'; import { buildSlo } from '../../../data/slo/slo'; diff --git a/x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_status_badge.tsx b/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_status_badge.tsx similarity index 79% rename from x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_status_badge.tsx rename to x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_status_badge.tsx index 6d39133d25776..df38bdace3360 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/slo/slo_status_badge/slo_status_badge.tsx +++ b/x-pack/plugins/observability_solution/slo/public/components/slo/slo_status_badge/slo_status_badge.tsx @@ -21,12 +21,12 @@ export function SloStatusBadge({ slo }: SloStatusProps) { {slo.summary.status === 'NO_DATA' && ( - {i18n.translate('xpack.observability.slo.sloStatusBadge.noData', { + {i18n.translate('xpack.slo.sloStatusBadge.noData', { defaultMessage: 'No data', })} @@ -34,21 +34,21 @@ export function SloStatusBadge({ slo }: SloStatusProps) { )} {slo.summary.status === 'HEALTHY' && ( - {i18n.translate('xpack.observability.slo.sloStatusBadge.healthy', { + {i18n.translate('xpack.slo.sloStatusBadge.healthy', { defaultMessage: 'Healthy', })} )} {slo.summary.status === 'DEGRADING' && ( - {i18n.translate('xpack.observability.slo.sloStatusBadge.degrading', { + {i18n.translate('xpack.slo.sloStatusBadge.degrading', { defaultMessage: 'Degrading', })} )} {slo.summary.status === 'VIOLATED' && ( - {i18n.translate('xpack.observability.slo.sloStatusBadge.violated', { + {i18n.translate('xpack.slo.sloStatusBadge.violated', { defaultMessage: 'Violated', })} @@ -60,7 +60,7 @@ export function SloStatusBadge({ slo }: SloStatusProps) { {/* Prevent badges from growing when inside an EuiFlexGroup by wrapping content with div */}

- {i18n.translate('xpack.observability.slo.sloStatusBadge.forecasted', { + {i18n.translate('xpack.slo.sloStatusBadge.forecasted', { defaultMessage: 'Forecasted', })} diff --git a/x-pack/plugins/observability_solution/slo/public/constants.ts b/x-pack/plugins/observability_solution/slo/public/constants.ts new file mode 100644 index 0000000000000..07b79e5505736 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/constants.ts @@ -0,0 +1,8 @@ +/* + * 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. + */ +export const SLO_LONG_REFETCH_INTERVAL = 60 * 1000; // 1 minute +export const SLO_SHORT_REFETCH_INTERVAL = 5 * 1000; // 5 seconds diff --git a/x-pack/plugins/observability_solution/slo/public/context/plugin_context.tsx b/x-pack/plugins/observability_solution/slo/public/context/plugin_context.tsx new file mode 100644 index 0000000000000..b402a5839111b --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/context/plugin_context.tsx @@ -0,0 +1,20 @@ +/* + * 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 { createContext } from 'react'; +import type { AppMountParameters } from '@kbn/core/public'; +import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public'; +import type { ObservabilityRuleTypeRegistry } from '@kbn/observability-plugin/public'; + +export interface PluginContextValue { + isDev?: boolean; + appMountParameters?: AppMountParameters; + observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry; + ObservabilityPageTemplate: React.ComponentType; +} + +export const PluginContext = createContext({} as PluginContextValue); diff --git a/x-pack/plugins/observability_solution/observability/public/data/slo/common.ts b/x-pack/plugins/observability_solution/slo/public/data/slo/common.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/data/slo/common.ts rename to x-pack/plugins/observability_solution/slo/public/data/slo/common.ts diff --git a/x-pack/plugins/observability_solution/observability/public/data/slo/historical_summary_data.ts b/x-pack/plugins/observability_solution/slo/public/data/slo/historical_summary_data.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/data/slo/historical_summary_data.ts rename to x-pack/plugins/observability_solution/slo/public/data/slo/historical_summary_data.ts diff --git a/x-pack/plugins/observability_solution/observability/public/data/slo/indicator.ts b/x-pack/plugins/observability_solution/slo/public/data/slo/indicator.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/data/slo/indicator.ts rename to x-pack/plugins/observability_solution/slo/public/data/slo/indicator.ts diff --git a/x-pack/plugins/observability_solution/observability/public/data/slo/slo.ts b/x-pack/plugins/observability_solution/slo/public/data/slo/slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/data/slo/slo.ts rename to x-pack/plugins/observability_solution/slo/public/data/slo/slo.ts diff --git a/x-pack/plugins/observability_solution/observability/public/data/slo/time_window.ts b/x-pack/plugins/observability_solution/slo/public/data/slo/time_window.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/data/slo/time_window.ts rename to x-pack/plugins/observability_solution/slo/public/data/slo/time_window.ts diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/components/slo_alerts_summary.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_alerts_summary.tsx similarity index 85% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/components/slo_alerts_summary.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_alerts_summary.tsx index 5d2a11765583b..0e8f8fe2b3dee 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/components/slo_alerts_summary.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_alerts_summary.tsx @@ -6,11 +6,12 @@ */ import React, { useMemo } from 'react'; import type { TimeRange } from '@kbn/es-query'; +import { useTimeBuckets } from '@kbn/observability-plugin/public'; +import { getAlertSummaryTimeRange } from '@kbn/observability-plugin/public'; +import { calculateTimeRangeBucketSize } from '@kbn/observability-plugin/public'; +import { observabilityAlertFeatureIds } from '@kbn/observability-plugin/common'; import { useSloAlertsQuery } from './slo_alerts_table'; -import { getAlertSummaryTimeRange } from '../../../../utils/alert_summary_widget'; -import { observabilityAlertFeatureIds } from '../../../../../common/constants'; -import { useTimeBuckets } from '../../../../hooks/use_time_buckets'; -import { calculateTimeRangeBucketSize } from '../../../../pages/overview/helpers/calculate_bucket_size'; + import { SloEmbeddableDeps } from '../slo_alerts_embeddable'; import { SloItem } from '../types'; diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/components/slo_alerts_table.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_alerts_table.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/components/slo_alerts_table.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_alerts_table.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/components/slo_included_count.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_included_count.tsx similarity index 80% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/components/slo_included_count.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_included_count.tsx index a8822ae0e2a2f..be3d358c96889 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/components/slo_included_count.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/components/slo_included_count.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { useFetchSloList } from '../../../../hooks/slo/use_fetch_slo_list'; +import { useFetchSloList } from '../../../../hooks/use_fetch_slo_list'; import { SloItem } from '../types'; export function SloIncludedCount({ slos }: { slos: SloItem[] }) { @@ -18,12 +18,12 @@ export function SloIncludedCount({ slos }: { slos: SloItem[] }) { return ( { const { overlays } = coreStart; diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/index.ts b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/index.ts rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/index.ts diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_alerts_embeddable.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable.tsx similarity index 98% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_alerts_embeddable.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable.tsx index aba254429c730..c0eb269f35f1d 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_alerts_embeddable.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable.tsx @@ -84,7 +84,7 @@ export class SLOAlertsEmbeddable extends AbstractEmbeddable< this.setTitle( this.input.title || - i18n.translate('xpack.observability.sloAlertsEmbeddable.displayTitle', { + i18n.translate('xpack.slo.sloAlertsEmbeddable.displayTitle', { defaultMessage: 'SLO Alerts', }) ); diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.ts b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.ts similarity index 84% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.ts rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.ts index dcdd632d6edb0..513fc314cd20d 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.ts +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_embeddable_factory.ts @@ -15,7 +15,7 @@ import { } from '@kbn/embeddable-plugin/public'; import { COMMON_SLO_GROUPING } from '../overview/slo_embeddable_factory'; import { SLO_ALERTS_EMBEDDABLE, SLOAlertsEmbeddable } from './slo_alerts_embeddable'; -import { ObservabilityPublicPluginsStart, ObservabilityPublicStart } from '../../..'; +import { SloPublicPluginsStart, SloPublicStart } from '../../..'; import { SloAlertsEmbeddableInput } from './types'; export type SloAlertsEmbeddableFactory = EmbeddableFactory; @@ -25,10 +25,7 @@ export class SloAlertsEmbeddableFactoryDefinition implements EmbeddableFactoryDe public readonly grouping = COMMON_SLO_GROUPING; constructor( - private getStartServices: CoreSetup< - ObservabilityPublicPluginsStart, - ObservabilityPublicStart - >['getStartServices'], + private getStartServices: CoreSetup['getStartServices'], private kibanaVersion: string ) {} @@ -57,13 +54,13 @@ export class SloAlertsEmbeddableFactoryDefinition implements EmbeddableFactoryDe } public getDescription() { - return i18n.translate('xpack.observability.sloAlertsEmbeddable.description', { + return i18n.translate('xpack.slo.sloAlertsEmbeddable.description', { defaultMessage: 'Get an overview of your SLO alerts', }); } public getDisplayName() { - return i18n.translate('xpack.observability.sloAlertsEmbeddable.displayName', { + return i18n.translate('xpack.slo.sloAlertsEmbeddable.displayName', { defaultMessage: 'SLO Alerts', }); } diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_alerts_wrapper.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_wrapper.tsx similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_alerts_wrapper.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_wrapper.tsx index d6ccf1746c154..413f92418d2cb 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_alerts_wrapper.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_alerts_wrapper.tsx @@ -14,6 +14,7 @@ import { IEmbeddable, EmbeddableOutput } from '@kbn/embeddable-plugin/public'; import { ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; import { Subject } from 'rxjs'; import styled from 'styled-components'; +import { observabilityPaths } from '@kbn/observability-plugin/common'; import { SloIncludedCount } from './components/slo_included_count'; import { SloAlertsSummary } from './components/slo_alerts_summary'; import { SloAlertsTable } from './components/slo_alerts_table'; @@ -21,7 +22,6 @@ import type { SloItem } from './types'; import { SloEmbeddableDeps } from './slo_alerts_embeddable'; import { SloAlertsEmbeddableInput } from './types'; import { EDIT_SLO_ALERTS_ACTION } from '../../../ui_actions/edit_slo_alerts_panel'; -import { paths } from '../../../../common/locators/paths'; interface Props { deps: SloEmbeddableDeps; @@ -95,7 +95,7 @@ export function SloAlertsWrapper({ } }); navigateToUrl( - `${basePath.prepend(paths.observability.alerts)}?_a=(kuery:'${kuery}',rangeFrom:${ + `${basePath.prepend(observabilityPaths.alerts)}?_a=(kuery:'${kuery}',rangeFrom:${ timeRange.from },rangeTo:${timeRange.to})` ); @@ -124,7 +124,7 @@ export function SloAlertsWrapper({ {showAllGroupByInstances ? ( ) : ( - i18n.translate('xpack.observability.sloAlertsWrapper.sLOsIncludedFlexItemLabel', { + i18n.translate('xpack.slo.sloAlertsWrapper.sLOsIncludedFlexItemLabel', { defaultMessage: '{numOfSlos, number} {numOfSlos, plural, one {SLO} other {SLOs}} included', values: { @@ -140,7 +140,7 @@ export function SloAlertsWrapper({ onClick={handleGoToAlertsClick} > diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_configuration.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_configuration.tsx similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_configuration.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_configuration.tsx index 5011135d89b5f..39e1707dccca3 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_configuration.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_configuration.tsx @@ -53,9 +53,9 @@ export function SloConfiguration({ initialInput, onCreate, onCancel }: SloConfig > - {i18n.translate('xpack.observability.sloEmbeddable.config.sloSelector.headerTitle', { + {i18n.translate('xpack.slo.sloEmbeddable.config.sloSelector.headerTitle', { defaultMessage: 'SLO configuration', - })} + })}{' '} @@ -85,10 +85,9 @@ export function SloConfiguration({ initialInput, onCreate, onCancel }: SloConfig <> { setShowAllGroupByInstances(e.target.checked); @@ -100,7 +99,7 @@ export function SloConfiguration({ initialInput, onCreate, onCancel }: SloConfig @@ -112,7 +111,7 @@ export function SloConfiguration({ initialInput, onCreate, onCancel }: SloConfig fill > diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_selector.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_selector.tsx similarity index 84% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_selector.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_selector.tsx index 627bf039652c8..65f2c254c60b8 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/alerts/slo_selector.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/alerts/slo_selector.tsx @@ -10,7 +10,7 @@ import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { debounce } from 'lodash'; import { ALL_VALUE, SLOWithSummaryResponse } from '@kbn/slo-schema'; -import { useFetchSloList } from '../../../hooks/slo/use_fetch_slo_list'; +import { useFetchSloList } from '../../../hooks/use_fetch_slo_list'; import { SloItem } from './types'; interface Props { @@ -20,10 +20,9 @@ interface Props { singleSelection?: boolean; } -const SLO_REQUIRED = i18n.translate('xpack.observability.sloEmbeddable.config.errors.sloRequired', { +const SLO_REQUIRED = i18n.translate('xpack.slo.sloEmbeddable.config.errors.sloRequired', { defaultMessage: 'SLO is required.', }); - export function SloSelector({ initialSlos, onSelected, hasError, singleSelection }: Props) { const mapSlosToOptions = (slos: SloItem[] | SLOWithSummaryResponse[] | undefined) => slos?.map((slo) => ({ @@ -71,18 +70,12 @@ export function SloSelector({ initialSlos, onSelected, hasError, singleSelection return (

- {i18n.translate('xpack.observability.sloOverviewDetails.h2.detailsLabel', { + {i18n.translate('xpack.slo.sloOverviewDetails.h2.detailsLabel', { defaultMessage: '{sloName}', values: { sloName: slo.name }, })} @@ -96,7 +96,7 @@ export function SloOverviewDetails({ - {i18n.translate('xpack.observability.sloOverviewDetails.button.closeLabel', { + {i18n.translate('xpack.slo.sloOverviewDetails.button.closeLabel', { defaultMessage: 'Close', })} @@ -110,7 +110,7 @@ export function SloOverviewDetails({ }} data-test-subj="o11ySloOverviewDetailsDetailsButton" > - {i18n.translate('xpack.observability.sloOverviewDetails.button.detailsLabel', { + {i18n.translate('xpack.slo.sloOverviewDetails.button.detailsLabel', { defaultMessage: 'Details', })} diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/constants.ts b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/constants.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/constants.ts rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/constants.ts diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/handle_explicit_input.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/handle_explicit_input.tsx similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/handle_explicit_input.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/handle_explicit_input.tsx index 52ddee5ac64f1..786783eb7527b 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/handle_explicit_input.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/handle_explicit_input.tsx @@ -13,11 +13,11 @@ import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import type { SloErrorBudgetEmbeddableInput, EmbeddableSloProps } from './types'; -import { ObservabilityPublicPluginsStart } from '../../..'; +import { SloPublicPluginsStart } from '../../..'; import { SloConfiguration } from './slo_configuration'; export async function resolveEmbeddableSloUserInput( coreStart: CoreStart, - pluginStart: ObservabilityPublicPluginsStart, + pluginStart: SloPublicPluginsStart, input?: SloErrorBudgetEmbeddableInput ): Promise { const { overlays } = coreStart; diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/index.ts b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/index.ts rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/index.ts diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_configuration.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_configuration.tsx similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_configuration.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_configuration.tsx index 40347d543eced..5cb1eb084593a 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_configuration.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_configuration.tsx @@ -41,7 +41,7 @@ export function SloConfiguration({ onCreate, onCancel }: SloConfigurationProps) - {i18n.translate('xpack.observability.sloEmbeddable.config.sloSelector.headerTitle', { + {i18n.translate('xpack.slo.sloEmbeddable.config.sloSelector.headerTitle', { defaultMessage: 'SLO configuration', })} @@ -65,7 +65,7 @@ export function SloConfiguration({ onCreate, onCancel }: SloConfigurationProps) @@ -77,7 +77,7 @@ export function SloConfiguration({ onCreate, onCancel }: SloConfigurationProps) fill > diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_error_budget_burn_down.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_error_budget_burn_down.tsx similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_error_budget_burn_down.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_error_budget_burn_down.tsx index 340ffd0344695..a7cf47ab4758d 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_error_budget_burn_down.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_error_budget_burn_down.tsx @@ -12,8 +12,8 @@ import { EuiFlexGroup, EuiFlexItem, EuiLoadingChart, EuiLink } from '@elastic/eu import { euiStyled } from '@kbn/kibana-react-plugin/common'; import { ALL_VALUE, SLOWithSummaryResponse } from '@kbn/slo-schema'; import { formatHistoricalData } from '../../../utils/slo/chart_data_formatter'; -import { useFetchHistoricalSummary } from '../../../hooks/slo/use_fetch_historical_summary'; -import { useFetchSloDetails } from '../../../hooks/slo/use_fetch_slo_details'; +import { useFetchHistoricalSummary } from '../../../hooks/use_fetch_historical_summary'; +import { useFetchSloDetails } from '../../../hooks/use_fetch_slo_details'; import { ErrorBudgetChart } from '../../../pages/slo_details/components/error_budget_chart'; import { EmbeddableSloProps } from './types'; @@ -94,7 +94,7 @@ export function SloErrorBudget({ return ( - {i18n.translate('xpack.observability.sloEmbeddable.overview.sloNotFoundText', { + {i18n.translate('xpack.slo.sloEmbeddable.overview.sloNotFoundText', { defaultMessage: 'The SLO has been deleted. You can safely delete the widget from the dashboard.', })} diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_error_budget_embeddable.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_error_budget_embeddable.tsx similarity index 97% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_error_budget_embeddable.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_error_budget_embeddable.tsx index 8e47234492faf..9f1d9f5a9f003 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_error_budget_embeddable.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_error_budget_embeddable.tsx @@ -53,7 +53,7 @@ export class SLOErrorBudgetEmbeddable extends AbstractEmbeddable< this.setTitle( this.input.title || - i18n.translate('xpack.observability.sloErrorBudgetEmbeddable.displayTitle', { + i18n.translate('xpack.slo.sloErrorBudgetEmbeddable.displayTitle', { defaultMessage: 'SLO Error Budget burn down', }) ); diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_error_budget_embeddable_factory.ts b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_error_budget_embeddable_factory.ts similarity index 83% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_error_budget_embeddable_factory.ts rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_error_budget_embeddable_factory.ts index 010a4118c1781..8563d793a0913 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/slo_error_budget_embeddable_factory.ts +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/slo_error_budget_embeddable_factory.ts @@ -18,7 +18,7 @@ import { SLO_ERROR_BUDGET_EMBEDDABLE, SLOErrorBudgetEmbeddable, } from './slo_error_budget_embeddable'; -import { ObservabilityPublicPluginsStart, ObservabilityPublicStart } from '../../..'; +import { SloPublicPluginsStart, SloPublicStart } from '../../..'; import { SloErrorBudgetEmbeddableInput } from './types'; export type SloErrorBudgetEmbeddableFactory = EmbeddableFactory; @@ -28,10 +28,7 @@ export class SloErrorBudgetEmbeddableFactoryDefinition implements EmbeddableFact public readonly grouping = COMMON_SLO_GROUPING; constructor( - private getStartServices: CoreSetup< - ObservabilityPublicPluginsStart, - ObservabilityPublicStart - >['getStartServices'] + private getStartServices: CoreSetup['getStartServices'] ) {} public async isEditable() { @@ -59,13 +56,13 @@ export class SloErrorBudgetEmbeddableFactoryDefinition implements EmbeddableFact } public getDescription() { - return i18n.translate('xpack.observability.sloErrorBudgetEmbeddable.description', { + return i18n.translate('xpack.slo.sloErrorBudgetEmbeddable.description', { defaultMessage: 'Get an error budget burn down chart of your SLOs', }); } public getDisplayName() { - return i18n.translate('xpack.observability.sloErrorBudgetEmbeddable.displayName', { + return i18n.translate('xpack.slo.sloErrorBudgetEmbeddable.displayName', { defaultMessage: 'SLO Error budget burn down', }); } diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/types.ts b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/error_budget/types.ts rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/error_budget/types.ts diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/handle_explicit_input.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/handle_explicit_input.tsx similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/handle_explicit_input.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/handle_explicit_input.tsx index 72e460e6f1890..4ebbd14b50055 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/handle_explicit_input.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/handle_explicit_input.tsx @@ -13,11 +13,11 @@ import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import type { SloEmbeddableInput, EmbeddableSloProps } from './types'; -import { ObservabilityPublicPluginsStart } from '../../..'; +import { SloPublicPluginsStart } from '../../..'; import { SloConfiguration } from './slo_configuration'; export async function resolveEmbeddableSloUserInput( coreStart: CoreStart, - pluginStart: ObservabilityPublicPluginsStart, + pluginStart: SloPublicPluginsStart, input?: SloEmbeddableInput ): Promise { const { overlays } = coreStart; diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/index.ts b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/index.ts rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/index.ts diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_configuration.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_configuration.tsx similarity index 86% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_configuration.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_configuration.tsx index 223c350124e76..82e836a526f86 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_configuration.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_configuration.tsx @@ -46,7 +46,7 @@ export function SloConfiguration({ onCreate, onCancel }: SloConfigurationProps) - {i18n.translate('xpack.observability.sloEmbeddable.config.sloSelector.headerTitle', { + {i18n.translate('xpack.slo.sloEmbeddable.config.sloSelector.headerTitle', { defaultMessage: 'SLO configuration', })} @@ -70,10 +70,9 @@ export function SloConfiguration({ onCreate, onCancel }: SloConfigurationProps) <> { setShowAllGroupByInstances(e.target.checked); @@ -85,7 +84,7 @@ export function SloConfiguration({ onCreate, onCancel }: SloConfigurationProps) @@ -97,7 +96,7 @@ export function SloConfiguration({ onCreate, onCancel }: SloConfigurationProps) fill > diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_embeddable.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable.tsx similarity index 97% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_embeddable.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable.tsx index da4a50ca219b0..2e0ce844a54cf 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_embeddable.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_embeddable.tsx @@ -56,7 +56,7 @@ export class SLOEmbeddable extends AbstractEmbeddable['getStartServices'] + private getStartServices: CoreSetup['getStartServices'] ) {} public async isEditable() { @@ -76,13 +73,13 @@ export class SloOverviewEmbeddableFactoryDefinition } public getDescription() { - return i18n.translate('xpack.observability.sloEmbeddable.description', { + return i18n.translate('xpack.slo.sloEmbeddable.description', { defaultMessage: 'Get an overview of your SLO health', }); } public getDisplayName() { - return i18n.translate('xpack.observability.sloEmbeddable.displayName', { + return i18n.translate('xpack.slo.sloEmbeddable.displayName', { defaultMessage: 'SLO Overview', }); } diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_overview.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview.tsx similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_overview.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview.tsx index 49cdd96bb3459..25ee1b1d03547 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_overview.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview.tsx @@ -12,12 +12,12 @@ import { euiStyled } from '@kbn/kibana-react-plugin/common'; import { ALL_VALUE, SLOWithSummaryResponse } from '@kbn/slo-schema'; import { SloOverviewDetails } from '../common/slo_overview_details'; import { formatHistoricalData } from '../../../utils/slo/chart_data_formatter'; -import { useFetchHistoricalSummary } from '../../../hooks/slo/use_fetch_historical_summary'; -import { useFetchActiveAlerts } from '../../../hooks/slo/use_fetch_active_alerts'; -import { useFetchRulesForSlo } from '../../../hooks/slo/use_fetch_rules_for_slo'; +import { useFetchHistoricalSummary } from '../../../hooks/use_fetch_historical_summary'; +import { useFetchActiveAlerts } from '../../../hooks/use_fetch_active_alerts'; +import { useFetchRulesForSlo } from '../../../hooks/use_fetch_rules_for_slo'; import { SloCardItemBadges } from '../../../pages/slos/components/card_view/slo_card_item_badges'; import { SloCardChart } from '../../../pages/slos/components/card_view/slo_card_item'; -import { useFetchSloDetails } from '../../../hooks/slo/use_fetch_slo_details'; +import { useFetchSloDetails } from '../../../hooks/use_fetch_slo_details'; import { EmbeddableSloProps } from './types'; @@ -89,7 +89,7 @@ export function SloOverview({ return ( - {i18n.translate('xpack.observability.sloEmbeddable.overview.sloNotFoundText', { + {i18n.translate('xpack.slo.sloEmbeddable.overview.sloNotFoundText', { defaultMessage: 'The SLO has been deleted. You can safely delete the widget from the dashboard.', })} diff --git a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_overview_grid.tsx b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview_grid.tsx similarity index 92% rename from x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_overview_grid.tsx rename to x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview_grid.tsx index 030e619d7f379..abe30a84e5527 100644 --- a/x-pack/plugins/observability_solution/observability/public/embeddable/slo/overview/slo_overview_grid.tsx +++ b/x-pack/plugins/observability_solution/slo/public/embeddable/slo/overview/slo_overview_grid.tsx @@ -19,19 +19,19 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiLoadingSpinner } from '@elastic/eui'; +import { useKibana } from '../../../utils/kibana_react'; import { SloOverviewDetails } from '../common/slo_overview_details'; -import { useFetchSloList } from '../../../hooks/slo/use_fetch_slo_list'; +import { useFetchSloList } from '../../../hooks/use_fetch_slo_list'; import { formatHistoricalData } from '../../../utils/slo/chart_data_formatter'; -import { useFetchRulesForSlo } from '../../../hooks/slo/use_fetch_rules_for_slo'; -import { useFetchActiveAlerts } from '../../../hooks/slo/use_fetch_active_alerts'; +import { useFetchRulesForSlo } from '../../../hooks/use_fetch_rules_for_slo'; +import { useFetchActiveAlerts } from '../../../hooks/use_fetch_active_alerts'; import { SloCardItemBadges } from '../../../pages/slos/components/card_view/slo_card_item_badges'; import { getSloFormattedSummary } from '../../../pages/slos/hooks/use_slo_summary'; -import { useKibana } from '../../../utils/kibana_react'; import { getSubTitle, useSloCardColor, } from '../../../pages/slos/components/card_view/slo_card_item'; -import { useFetchHistoricalSummary } from '../../../hooks/slo/use_fetch_historical_summary'; +import { useFetchHistoricalSummary } from '../../../hooks/use_fetch_historical_summary'; const getSloChartData = ({ slo, @@ -61,7 +61,7 @@ const getSloChartData = ({ })), extra: ( { diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/active_alerts.ts b/x-pack/plugins/observability_solution/slo/public/hooks/active_alerts.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/active_alerts.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/active_alerts.ts diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/helpers/convert_error_for_use_in_toast.ts b/x-pack/plugins/observability_solution/slo/public/hooks/helpers/convert_error_for_use_in_toast.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/helpers/convert_error_for_use_in_toast.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/helpers/convert_error_for_use_in_toast.ts diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/query_key_factory.ts b/x-pack/plugins/observability_solution/slo/public/hooks/query_key_factory.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/query_key_factory.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/query_key_factory.ts diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_capabilities.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_capabilities.ts similarity index 81% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_capabilities.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_capabilities.ts index b2bc20d11fcbd..bc1856681b930 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_capabilities.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_capabilities.ts @@ -4,8 +4,8 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { sloFeatureId } from '../../../common'; -import { useKibana } from '../../utils/kibana_react'; +import { sloFeatureId } from '@kbn/observability-plugin/common'; +import { useKibana } from '../utils/kibana_react'; export function useCapabilities() { const { diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_clone_slo.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_clone_slo.ts similarity index 82% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_clone_slo.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_clone_slo.ts index 652b4cbaf52b6..076e6c0b001a3 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_clone_slo.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_clone_slo.ts @@ -8,8 +8,8 @@ import { encode } from '@kbn/rison'; import { useCallback } from 'react'; import { SLOWithSummaryResponse } from '@kbn/slo-schema'; -import { paths } from '../../../common/locators/paths'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; +import { paths } from '../../common/locators/paths'; export function useCloneSlo() { const { @@ -21,7 +21,7 @@ export function useCloneSlo() { (slo: SLOWithSummaryResponse) => { navigateToUrl( basePath.prepend( - paths.observability.sloCreateWithEncodedForm( + paths.sloCreateWithEncodedForm( encode({ ...slo, name: `[Copy] ${slo.name}`, id: undefined }) ) ) diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/use_create_data_view.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_create_data_view.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/hooks/use_create_data_view.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_create_data_view.ts diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_create_slo.tsx b/x-pack/plugins/observability_solution/slo/public/hooks/use_create_slo.tsx similarity index 82% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_create_slo.tsx rename to x-pack/plugins/observability_solution/slo/public/hooks/use_create_slo.tsx index 4ce4451c68094..fcb02315a847a 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_create_slo.tsx +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_create_slo.tsx @@ -15,8 +15,8 @@ import { toMountPoint } from '@kbn/react-kibana-mount'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app'; -import { paths } from '../../../common/locators/paths'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; +import { paths } from '../../common/locators/paths'; import { sloKeys } from './query_key_factory'; type ServerError = IHttpFetchError; @@ -47,20 +47,20 @@ export function useCreateSlo() { onSuccess: (data, { slo }) => { queryClient.invalidateQueries({ queryKey: sloKeys.lists(), exact: false }); - const sloEditUrl = http.basePath.prepend(paths.observability.sloEdit(data.id)); + const sloEditUrl = http.basePath.prepend(paths.sloEdit(data.id)); toasts.addSuccess( { title: toMountPoint( - {i18n.translate('xpack.observability.useCreateSlo.editSLOLinkLabel', { + {i18n.translate('xpack.slo.useCreateSlo.editSLOLinkLabel', { defaultMessage: 'Edit SLO', })} @@ -81,15 +81,13 @@ export function useCreateSlo() { }, onError: (error, { slo }, context) => { toasts.addError(new Error(error.body?.message ?? error.message), { - title: i18n.translate('xpack.observability.slo.create.errorNotification', { + title: i18n.translate('xpack.slo.create.errorNotification', { defaultMessage: 'Something went wrong while creating {name}', values: { name: slo.name }, }), }); - navigateToUrl( - http.basePath.prepend(paths.observability.sloCreateWithEncodedForm(encode(slo))) - ); + navigateToUrl(http.basePath.prepend(paths.sloCreateWithEncodedForm(encode(slo)))); }, } ); diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_delete_slo.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_delete_slo.ts similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_delete_slo.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_delete_slo.ts index 2e77623fc991f..23d0d2f4407f0 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_delete_slo.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_delete_slo.ts @@ -9,7 +9,7 @@ import { IHttpFetchError, ResponseErrorBody } from '@kbn/core/public'; import { i18n } from '@kbn/i18n'; import { FindSLOResponse } from '@kbn/slo-schema'; import { QueryKey, useMutation, useQueryClient } from '@tanstack/react-query'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; import { sloKeys } from './query_key_factory'; type ServerError = IHttpFetchError; @@ -38,7 +38,7 @@ export function useDeleteSlo() { { onError: (error, { name }, context) => { toasts.addError(new Error(error.body?.message ?? error.message), { - title: i18n.translate('xpack.observability.slo.slo.delete.errorNotification', { + title: i18n.translate('xpack.slo.slo.delete.errorNotification', { defaultMessage: 'Failed to delete {name}', values: { name }, }), @@ -48,7 +48,7 @@ export function useDeleteSlo() { queryClient.invalidateQueries({ queryKey: sloKeys.lists(), exact: false }); toasts.addSuccess( - i18n.translate('xpack.observability.slo.slo.delete.successNotification', { + i18n.translate('xpack.slo.slo.delete.successNotification', { defaultMessage: 'Deleted {name}', values: { name }, }) diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_active_alerts.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_active_alerts.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_active_alerts.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_active_alerts.ts index d59ff20a6064d..1f353e6a38558 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_active_alerts.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_active_alerts.ts @@ -9,11 +9,11 @@ import { useQuery } from '@tanstack/react-query'; import { BASE_RAC_ALERTS_API_PATH } from '@kbn/rule-registry-plugin/common'; import { AlertConsumers } from '@kbn/rule-registry-plugin/common/technical_rule_data_field_names'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; import { sloKeys } from './query_key_factory'; import { ActiveAlerts } from './active_alerts'; -import { SLO_LONG_REFETCH_INTERVAL } from '../../constants'; +import { SLO_LONG_REFETCH_INTERVAL } from '../constants'; type SloIdAndInstanceId = [string, string]; diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_apm_indices.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_apm_indices.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_apm_indices.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_apm_indices.ts index 702573fa570dd..e21df7b56a964 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_apm_indices.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_apm_indices.ts @@ -7,7 +7,7 @@ import { useQuery } from '@tanstack/react-query'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; type ApmIndex = string; diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_apm_suggestions.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_apm_suggestions.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_apm_suggestions.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_apm_suggestions.ts index df90faf6bb734..c6484076b1d72 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_apm_suggestions.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_apm_suggestions.ts @@ -7,8 +7,7 @@ import { useQuery } from '@tanstack/react-query'; import moment from 'moment'; - -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; export type Suggestion = string; diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_global_diagnosis.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_global_diagnosis.ts similarity index 93% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_global_diagnosis.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_global_diagnosis.ts index 45ef877bf2472..22862110910da 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_global_diagnosis.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_global_diagnosis.ts @@ -9,7 +9,7 @@ import type { SecurityHasPrivilegesResponse } from '@elastic/elasticsearch/lib/a import { i18n } from '@kbn/i18n'; import type { PublicLicenseJSON } from '@kbn/licensing-plugin/public'; import { useQuery } from '@tanstack/react-query'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; import { convertErrorForUseInToast } from './helpers/convert_error_for_use_in_toast'; import { sloKeys } from './query_key_factory'; @@ -55,7 +55,7 @@ export function useFetchSloGlobalDiagnosis(): UseFetchSloGlobalDiagnoseResponse retry: false, onError: (error: Error) => { toasts.addError(error, { - title: i18n.translate('xpack.observability.slo.globalDiagnosis.errorNotification', { + title: i18n.translate('xpack.slo.globalDiagnosis.errorNotification', { defaultMessage: 'You do not have the right permissions to use this feature.', }), }); diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_group_by_cardinality.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_group_by_cardinality.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_group_by_cardinality.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_group_by_cardinality.ts index db791c3ba5b42..a5a193db672fb 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_group_by_cardinality.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_group_by_cardinality.ts @@ -9,8 +9,8 @@ import { debounce } from 'lodash'; import { ALL_VALUE, QuerySchema } from '@kbn/slo-schema'; import { useQuery } from '@tanstack/react-query'; import { lastValueFrom } from 'rxjs'; -import { useKibana } from '../../utils/kibana_react'; -import { getElasticsearchQueryOrThrow } from '../../../common/utils/parse_kuery'; +import { getElasticsearchQueryOrThrow } from '@kbn/observability-plugin/public'; +import { useKibana } from '../utils/kibana_react'; export interface UseFetchGroupByCardinalityResponse { isLoading: boolean; diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_historical_summary.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_historical_summary.ts similarity index 93% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_historical_summary.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_historical_summary.ts index afa1c6e597723..e17c6a8f65557 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_historical_summary.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_historical_summary.ts @@ -7,10 +7,9 @@ import { useQuery } from '@tanstack/react-query'; import { FetchHistoricalSummaryResponse } from '@kbn/slo-schema'; - -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; import { sloKeys } from './query_key_factory'; -import { SLO_LONG_REFETCH_INTERVAL } from '../../constants'; +import { SLO_LONG_REFETCH_INTERVAL } from '../constants'; export interface UseFetchHistoricalSummaryResponse { data: FetchHistoricalSummaryResponse | undefined; diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/use_fetch_indices.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_indices.ts similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/hooks/use_fetch_indices.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_indices.ts index bd5aae9c30df8..e5c4f3db3493d 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/use_fetch_indices.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_indices.ts @@ -6,7 +6,7 @@ */ import { useQuery } from '@tanstack/react-query'; -import { useKibana } from '../utils/kibana_react'; +import { useKibana } from '@kbn/observability-plugin/public/utils/kibana_react'; export type Index = string; diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_rules_for_slo.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_rules_for_slo.ts similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_rules_for_slo.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_rules_for_slo.ts index d3c9626fe9f17..80c3b315bfa48 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_rules_for_slo.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_rules_for_slo.ts @@ -7,8 +7,8 @@ import type { Rule } from '@kbn/triggers-actions-ui-plugin/public'; import { useQuery } from '@tanstack/react-query'; -import { BurnRateRuleParams } from '../../typings'; -import { useKibana } from '../../utils/kibana_react'; +import { BurnRateRuleParams } from '../typings'; +import { useKibana } from '../utils/kibana_react'; import { sloKeys } from './query_key_factory'; type SloId = string; diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_burn_rates.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_burn_rates.ts similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_burn_rates.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_burn_rates.ts index 61017d6339b80..30793619dd255 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_burn_rates.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_burn_rates.ts @@ -11,9 +11,9 @@ import { useQuery, } from '@tanstack/react-query'; import { ALL_VALUE, GetSLOBurnRatesResponse, SLOWithSummaryResponse } from '@kbn/slo-schema'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; import { sloKeys } from './query_key_factory'; -import { SLO_LONG_REFETCH_INTERVAL } from '../../constants'; +import { SLO_LONG_REFETCH_INTERVAL } from '../constants'; export interface UseFetchSloBurnRatesResponse { isInitialLoading: boolean; diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_definitions.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_definitions.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_definitions.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_definitions.ts index 6b6893afb1189..8aae512faab44 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_definitions.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_definitions.ts @@ -7,7 +7,7 @@ import { FindSLODefinitionsResponse } from '@kbn/slo-schema'; import { useQuery } from '@tanstack/react-query'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; import { sloKeys } from './query_key_factory'; export interface UseFetchSloDefinitionsResponse { diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_details.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_details.ts similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_details.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_details.ts index 76864996168bb..d835a94e77031 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_details.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_details.ts @@ -12,8 +12,8 @@ import { RefetchQueryFilters, useQuery, } from '@tanstack/react-query'; -import { SLO_LONG_REFETCH_INTERVAL } from '../../constants'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; +import { SLO_LONG_REFETCH_INTERVAL } from '../constants'; import { sloKeys } from './query_key_factory'; export interface UseFetchSloDetailsResponse { diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_groups.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_groups.ts similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_groups.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_groups.ts index 9ca0ffa0cbfb7..d595211b0106f 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_groups.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_groups.ts @@ -9,12 +9,12 @@ import { i18n } from '@kbn/i18n'; import { buildQueryFromFilters, Filter } from '@kbn/es-query'; import { useMemo } from 'react'; import { FindSLOGroupsResponse } from '@kbn/slo-schema'; -import { useKibana } from '../../utils/kibana_react'; -import { useCreateDataView } from '../use_create_data_view'; +import { useKibana } from '../utils/kibana_react'; +import { useCreateDataView } from './use_create_data_view'; import { sloKeys } from './query_key_factory'; -import { DEFAULT_SLO_GROUPS_PAGE_SIZE } from '../../../common/slo/constants'; -import { SearchState } from '../../pages/slos/hooks/use_url_search_state'; -import { SLO_SUMMARY_DESTINATION_INDEX_NAME } from '../../../common/slo/constants'; +import { DEFAULT_SLO_GROUPS_PAGE_SIZE } from '../../common/constants'; +import { SearchState } from '../pages/slos/hooks/use_url_search_state'; +import { SLO_SUMMARY_DESTINATION_INDEX_NAME } from '../../common/constants'; interface SLOGroupsParams { page?: number; @@ -102,7 +102,7 @@ export function useFetchSloGroups({ }, onError: (error: Error) => { toasts.addError(error, { - title: i18n.translate('xpack.observability.slo.groups.list.errorNotification', { + title: i18n.translate('xpack.slo.groups.list.errorNotification', { defaultMessage: 'Something went wrong while fetching SLO Groups', }), }); diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_inspect.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_inspect.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_inspect.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_inspect.ts index c83b398a8fb3b..983097a5eb721 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_inspect.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_inspect.ts @@ -8,7 +8,7 @@ import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import type { CreateSLOInput, SLOResponse } from '@kbn/slo-schema'; import { useQuery } from '@tanstack/react-query'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; interface SLOInspectResponse { slo: SLOResponse; diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_instances.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_instances.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_instances.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_instances.ts index 0e1e50d32a397..26367dcad3f6b 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_instances.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_instances.ts @@ -7,8 +7,7 @@ import { GetSLOInstancesResponse } from '@kbn/slo-schema'; import { useQuery } from '@tanstack/react-query'; - -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; import { sloKeys } from './query_key_factory'; export interface UseFetchSloInstancesResponse { diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_list.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_list.ts similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_list.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_list.ts index 762c49439f416..96769f93d5027 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_slo_list.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_slo_list.ts @@ -10,14 +10,11 @@ import { FindSLOResponse } from '@kbn/slo-schema'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import { useMemo } from 'react'; import { buildQueryFromFilters, Filter } from '@kbn/es-query'; -import { SearchState } from '../../pages/slos/hooks/use_url_search_state'; -import { useCreateDataView } from '../use_create_data_view'; -import { - DEFAULT_SLO_PAGE_SIZE, - SLO_SUMMARY_DESTINATION_INDEX_NAME, -} from '../../../common/slo/constants'; +import { useKibana } from '../utils/kibana_react'; +import { SearchState } from '../pages/slos/hooks/use_url_search_state'; +import { useCreateDataView } from './use_create_data_view'; +import { DEFAULT_SLO_PAGE_SIZE, SLO_SUMMARY_DESTINATION_INDEX_NAME } from '../../common/constants'; -import { useKibana } from '../../utils/kibana_react'; import { sloKeys } from './query_key_factory'; export interface SLOListParams { @@ -123,7 +120,7 @@ export function useFetchSloList({ }, onError: (error: Error) => { toasts.addError(error, { - title: i18n.translate('xpack.observability.slo.list.errorNotification', { + title: i18n.translate('xpack.slo.list.errorNotification', { defaultMessage: 'Something went wrong while fetching SLOs', }), }); diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_synthetics_suggestions.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_synthetics_suggestions.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_synthetics_suggestions.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_synthetics_suggestions.ts index 8510f5d059fea..f985b1f53ca94 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_fetch_synthetics_suggestions.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_fetch_synthetics_suggestions.ts @@ -7,7 +7,7 @@ import { useQuery } from '@tanstack/react-query'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; export interface Suggestion { label: string; diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_get_filtered_rule_types.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_get_filtered_rule_types.ts new file mode 100644 index 0000000000000..99a448a36405d --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_get_filtered_rule_types.ts @@ -0,0 +1,22 @@ +/* + * 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 { useMemo } from 'react'; +import { ES_QUERY_ID, ML_ANOMALY_DETECTION_RULE_TYPE_ID } from '@kbn/rule-data-utils'; +import { usePluginContext } from './use_plugin_context'; + +export function useGetFilteredRuleTypes() { + const { observabilityRuleTypeRegistry } = usePluginContext(); + + return useMemo(() => { + return [ + ES_QUERY_ID, + ML_ANOMALY_DETECTION_RULE_TYPE_ID, + ...observabilityRuleTypeRegistry.list(), + ]; + }, [observabilityRuleTypeRegistry]); +} diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_get_preview_data.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_get_preview_data.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_get_preview_data.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_get_preview_data.ts index 23d90f487dab0..427db4546ee6c 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_get_preview_data.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_get_preview_data.ts @@ -7,7 +7,7 @@ import { GetPreviewDataResponse, Indicator, Objective } from '@kbn/slo-schema'; import { useQuery } from '@tanstack/react-query'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; import { sloKeys } from './query_key_factory'; export interface UseGetPreviewData { diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_license.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_license.ts new file mode 100644 index 0000000000000..823c9e4135bf7 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_license.ts @@ -0,0 +1,34 @@ +/* + * 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 { useCallback } from 'react'; +import { Observable } from 'rxjs'; +import useObservable from 'react-use/lib/useObservable'; +import type { ILicense, LicenseType } from '@kbn/licensing-plugin/public'; +import { useKibana } from '../utils/kibana_react'; + +interface UseLicenseReturnValue { + getLicense: () => ILicense | null; + hasAtLeast: (level: LicenseType) => boolean | undefined; +} + +export const useLicense = (): UseLicenseReturnValue => { + const { licensing } = useKibana().services; + const license = useObservable(licensing?.license$ ?? new Observable(), null); + + return { + getLicense: () => license, + hasAtLeast: useCallback( + (level: LicenseType) => { + if (!license) return; + + return !!license && license.isAvailable && license.isActive && license.hasAtLeast(level); + }, + [license] + ), + }; +}; diff --git a/x-pack/plugins/observability_solution/slo/public/hooks/use_plugin_context.tsx b/x-pack/plugins/observability_solution/slo/public/hooks/use_plugin_context.tsx new file mode 100644 index 0000000000000..5ea1d46ac7af3 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_plugin_context.tsx @@ -0,0 +1,13 @@ +/* + * 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 { useContext } from 'react'; +import { PluginContext } from '../context/plugin_context'; + +export function usePluginContext() { + return useContext(PluginContext); +} diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_reset_slo.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_reset_slo.ts similarity index 84% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_reset_slo.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_reset_slo.ts index 9f67c5efe3972..e1a3a5a1dac1b 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_reset_slo.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_reset_slo.ts @@ -7,7 +7,7 @@ import { IHttpFetchError, ResponseErrorBody } from '@kbn/core/public'; import { i18n } from '@kbn/i18n'; import { useMutation, useQueryClient } from '@tanstack/react-query'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; import { sloKeys } from './query_key_factory'; type ServerError = IHttpFetchError; @@ -26,7 +26,7 @@ export function useResetSlo() { return http.post(`/api/observability/slos/${id}/_reset`); } catch (error) { return Promise.reject( - i18n.translate('xpack.observability.slo.slo.reset.errorMessage', { + i18n.translate('xpack.slo.slo.reset.errorMessage', { defaultMessage: 'Failed to reset {name} (id: {id}), something went wrong: {error}', values: { error: String(error), name, id }, }) @@ -36,7 +36,7 @@ export function useResetSlo() { { onError: (error, { name, id }) => { toasts.addError(new Error(error.body?.message ?? error.message), { - title: i18n.translate('xpack.observability.slo.slo.reset.errorNotification', { + title: i18n.translate('xpack.slo.slo.reset.errorNotification', { defaultMessage: 'Failed to reset {name} (id: {id})', values: { name, id }, }), @@ -45,7 +45,7 @@ export function useResetSlo() { onSuccess: (_data, { name }) => { queryClient.invalidateQueries({ queryKey: sloKeys.lists(), exact: false }); toasts.addSuccess( - i18n.translate('xpack.observability.slo.slo.reset.successNotification', { + i18n.translate('xpack.slo.slo.reset.successNotification', { defaultMessage: '{name} reset successfully', values: { name }, }) diff --git a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_update_slo.ts b/x-pack/plugins/observability_solution/slo/public/hooks/use_update_slo.ts similarity index 81% rename from x-pack/plugins/observability_solution/observability/public/hooks/slo/use_update_slo.ts rename to x-pack/plugins/observability_solution/slo/public/hooks/use_update_slo.ts index ff12ab2acdfe2..21e9aa57c142d 100644 --- a/x-pack/plugins/observability_solution/observability/public/hooks/slo/use_update_slo.ts +++ b/x-pack/plugins/observability_solution/slo/public/hooks/use_update_slo.ts @@ -10,8 +10,8 @@ import { i18n } from '@kbn/i18n'; import { encode } from '@kbn/rison'; import type { FindSLOResponse, UpdateSLOInput, UpdateSLOResponse } from '@kbn/slo-schema'; import { QueryKey, useMutation, useQueryClient } from '@tanstack/react-query'; -import { paths } from '../../../common/locators/paths'; -import { useKibana } from '../../utils/kibana_react'; +import { useKibana } from '../utils/kibana_react'; +import { paths } from '../../common/locators/paths'; import { sloKeys } from './query_key_factory'; type ServerError = IHttpFetchError; @@ -40,7 +40,7 @@ export function useUpdateSlo() { queryClient.invalidateQueries({ queryKey: sloKeys.lists(), exact: false }); toasts.addSuccess( - i18n.translate('xpack.observability.slo.update.successNotification', { + i18n.translate('xpack.slo.update.successNotification', { defaultMessage: 'Successfully updated {name}', values: { name }, }) @@ -48,15 +48,13 @@ export function useUpdateSlo() { }, onError: (error, { slo, sloId }, context) => { toasts.addError(new Error(error.body?.message ?? error.message), { - title: i18n.translate('xpack.observability.slo.update.errorNotification', { + title: i18n.translate('xpack.slo.update.errorNotification', { defaultMessage: 'Something went wrong when updating {name}', values: { name: slo.name }, }), }); - navigateToUrl( - http.basePath.prepend(paths.observability.sloEditWithEncodedForm(sloId, encode(slo))) - ); + navigateToUrl(http.basePath.prepend(paths.sloEditWithEncodedForm(sloId, encode(slo)))); }, } ); diff --git a/x-pack/plugins/observability_solution/slo/public/index.ts b/x-pack/plugins/observability_solution/slo/public/index.ts new file mode 100644 index 0000000000000..e57edb2205208 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/index.ts @@ -0,0 +1,24 @@ +/* + * 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 { PluginInitializer, PluginInitializerContext } from '@kbn/core/public'; +import { SloPlugin } from './plugin'; +import type { + SloPublicSetup, + SloPublicStart, + SloPublicPluginsSetup, + SloPublicPluginsStart, +} from './types'; + +export const plugin: PluginInitializer< + SloPublicSetup, + SloPublicStart, + SloPublicPluginsSetup, + SloPublicPluginsStart +> = (initializerContext: PluginInitializerContext) => { + return new SloPlugin(initializerContext); +}; +export type { SloPublicPluginsSetup, SloPublicPluginsStart, SloPublicStart } from './types'; diff --git a/x-pack/plugins/observability_solution/observability/public/locators/slo_details.test.ts b/x-pack/plugins/observability_solution/slo/public/locators/slo_details.test.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/public/locators/slo_details.test.ts rename to x-pack/plugins/observability_solution/slo/public/locators/slo_details.test.ts index 9c5440232457a..08d0c948002fc 100644 --- a/x-pack/plugins/observability_solution/observability/public/locators/slo_details.test.ts +++ b/x-pack/plugins/observability_solution/slo/public/locators/slo_details.test.ts @@ -12,7 +12,7 @@ describe('SloDetailsLocator', () => { it('returns correct url when empty params are provided', async () => { const location = await locator.getLocation({}); - expect(location.app).toEqual('observability'); + expect(location.app).toEqual('slo'); expect(location.path).toEqual('/slos'); }); diff --git a/x-pack/plugins/observability_solution/observability/public/locators/slo_details.ts b/x-pack/plugins/observability_solution/slo/public/locators/slo_details.ts similarity index 78% rename from x-pack/plugins/observability_solution/observability/public/locators/slo_details.ts rename to x-pack/plugins/observability_solution/slo/public/locators/slo_details.ts index e07648f71bd56..1e9063b9c7a37 100644 --- a/x-pack/plugins/observability_solution/observability/public/locators/slo_details.ts +++ b/x-pack/plugins/observability_solution/slo/public/locators/slo_details.ts @@ -7,8 +7,8 @@ import type { SerializableRecord } from '@kbn/utility-types'; import type { LocatorDefinition } from '@kbn/share-plugin/public'; -import { sloDetailsLocatorID } from '../../common'; -import { SLOS_PATH } from '../../common/locators/paths'; +import { sloDetailsLocatorID } from '@kbn/observability-plugin/common'; +import { SLO_PREFIX } from '../../common/locators/paths'; export interface SloDetailsLocatorParams extends SerializableRecord { sloId?: string; @@ -21,10 +21,10 @@ export class SloDetailsLocatorDefinition implements LocatorDefinition { const queryParams = !!instanceId && instanceId !== '*' ? `?instanceId=${encodeURIComponent(instanceId)}` : ''; - const path = !!sloId ? `${SLOS_PATH}/${encodeURIComponent(sloId)}${queryParams}` : SLOS_PATH; + const path = !!sloId ? `${SLO_PREFIX}/${encodeURIComponent(sloId)}${queryParams}` : SLO_PREFIX; return { - app: 'observability', + app: 'slo', path, state: {}, }; diff --git a/x-pack/plugins/observability_solution/observability/public/locators/slo_edit.test.ts b/x-pack/plugins/observability_solution/slo/public/locators/slo_edit.test.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/public/locators/slo_edit.test.ts rename to x-pack/plugins/observability_solution/slo/public/locators/slo_edit.test.ts index c75b1100fa6ff..7d25405daaf33 100644 --- a/x-pack/plugins/observability_solution/observability/public/locators/slo_edit.test.ts +++ b/x-pack/plugins/observability_solution/slo/public/locators/slo_edit.test.ts @@ -13,7 +13,7 @@ describe('SloEditLocator', () => { it('should return correct url when empty params are provided', async () => { const location = await locator.getLocation({}); - expect(location.app).toEqual('observability'); + expect(location.app).toEqual('slo'); expect(location.path).toEqual('/slos/create?_a=()'); }); diff --git a/x-pack/plugins/observability_solution/observability/public/locators/slo_edit.ts b/x-pack/plugins/observability_solution/slo/public/locators/slo_edit.ts similarity index 79% rename from x-pack/plugins/observability_solution/observability/public/locators/slo_edit.ts rename to x-pack/plugins/observability_solution/slo/public/locators/slo_edit.ts index f5442ce31c3c9..5ea89ac66d546 100644 --- a/x-pack/plugins/observability_solution/observability/public/locators/slo_edit.ts +++ b/x-pack/plugins/observability_solution/slo/public/locators/slo_edit.ts @@ -9,9 +9,9 @@ import { setStateToKbnUrl } from '@kbn/kibana-utils-plugin/public'; import type { RecursivePartial } from '@elastic/charts'; import type { SerializableRecord } from '@kbn/utility-types'; import type { LocatorDefinition } from '@kbn/share-plugin/public'; +import { sloEditLocatorID } from '@kbn/observability-plugin/common'; import type { CreateSLOForm } from '../pages/slo_edit/types'; -import { sloEditLocatorID } from '../../common'; -import { SLO_CREATE_PATH, SLOS_PATH } from '../../common/locators/paths'; +import { SLO_CREATE_PATH, SLO_PREFIX } from '../../common/locators/paths'; export type SloEditParams = RecursivePartial; @@ -22,14 +22,16 @@ export class SloEditLocatorDefinition implements LocatorDefinition { return { - app: 'observability', + app: 'slo', path: setStateToKbnUrl( '_a', { ...slo, }, { useHash: false, storeInHashQuery: false }, - slo.id ? `${SLOS_PATH}/edit/${encodeURIComponent(String(slo.id))}` : SLO_CREATE_PATH + slo.id + ? `${SLO_PREFIX}/edit/${encodeURIComponent(String(slo.id))}` + : `${SLO_PREFIX}${SLO_CREATE_PATH}` ), state: {}, }; diff --git a/x-pack/plugins/observability_solution/observability/public/locators/slo_list.test.ts b/x-pack/plugins/observability_solution/slo/public/locators/slo_list.test.ts similarity index 92% rename from x-pack/plugins/observability_solution/observability/public/locators/slo_list.test.ts rename to x-pack/plugins/observability_solution/slo/public/locators/slo_list.test.ts index f78746964334c..ea4ef901acd0e 100644 --- a/x-pack/plugins/observability_solution/observability/public/locators/slo_list.test.ts +++ b/x-pack/plugins/observability_solution/slo/public/locators/slo_list.test.ts @@ -12,7 +12,7 @@ describe('SloListLocator', () => { it("returns the correct url with the default search state when no 'kqlQuery' provided", async () => { const location = await locator.getLocation({}); - expect(location.app).toEqual('observability'); + expect(location.app).toEqual('slo'); expect(location.path).toMatchInlineSnapshot( `"/slos?search=(filters:!(),groupBy:ungrouped,kqlQuery:'',lastRefresh:0,page:0,perPage:25,sort:(by:status,direction:desc),view:cardView)"` ); @@ -22,7 +22,7 @@ describe('SloListLocator', () => { const location = await locator.getLocation({ kqlQuery: 'slo.name: "Service Availability" and slo.indicator.type : "sli.kql.custom"', }); - expect(location.app).toEqual('observability'); + expect(location.app).toEqual('slo'); expect(location.path).toMatchInlineSnapshot( `"/slos?search=(filters:!(),groupBy:ungrouped,kqlQuery:'slo.name:%20%22Service%20Availability%22%20and%20slo.indicator.type%20:%20%22sli.kql.custom%22',lastRefresh:0,page:0,perPage:25,sort:(by:status,direction:desc),view:cardView)"` ); diff --git a/x-pack/plugins/observability_solution/observability/public/locators/slo_list.ts b/x-pack/plugins/observability_solution/slo/public/locators/slo_list.ts similarity index 88% rename from x-pack/plugins/observability_solution/observability/public/locators/slo_list.ts rename to x-pack/plugins/observability_solution/slo/public/locators/slo_list.ts index 49acf4154afdc..1e4d1ee87cf8f 100644 --- a/x-pack/plugins/observability_solution/observability/public/locators/slo_list.ts +++ b/x-pack/plugins/observability_solution/slo/public/locators/slo_list.ts @@ -9,8 +9,8 @@ import { setStateToKbnUrl } from '@kbn/kibana-utils-plugin/public'; import type { LocatorDefinition } from '@kbn/share-plugin/public'; import type { SerializableRecord } from '@kbn/utility-types'; import deepmerge from 'deepmerge'; -import { sloListLocatorID } from '../../common'; -import { SLOS_PATH } from '../../common/locators/paths'; +import { sloListLocatorID } from '@kbn/observability-plugin/common'; +import { SLO_PREFIX } from '../../common/locators/paths'; import { DEFAULT_STATE, SearchState, @@ -28,7 +28,7 @@ export class SloListLocatorDefinition implements LocatorDefinition(DEFAULT_STATE, { kqlQuery }); return { - app: 'observability', + app: 'slo', path: setStateToKbnUrl( SLO_LIST_SEARCH_URL_STORAGE_KEY, state, @@ -36,7 +36,7 @@ export class SloListLocatorDefinition implements LocatorDefinition + + } + data-test-subj={'observabilityPageNotFoundBanner'} + > +

+ +

+
+ + ); +} + +// eslint-disable-next-line import/no-default-export +export default PageNotFound; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/error_budget_actions.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_actions.tsx similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/error_budget_actions.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_actions.tsx index 8770375530e1e..c224fbb6d7bee 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/error_budget_actions.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_actions.tsx @@ -42,7 +42,7 @@ export function ErrorBudgetActions({ setDashboardAttachmentReady }: Props) { onClick={handleAddToDashboard} data-test-subj="sloActionsAddToDashboard" > - {i18n.translate('xpack.observability.slo.item.actions.addToDashboard', { + {i18n.translate('xpack.slo.item.actions.addToDashboard', { defaultMessage: 'Add to Dashboard', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/error_budget_chart.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_chart.tsx similarity index 74% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/error_budget_chart.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_chart.tsx index 857c37d050e13..552198aec1fa1 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/error_budget_chart.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/error_budget_chart.tsx @@ -19,15 +19,12 @@ function formatTime(minutes: number) { if (minutes > 59) { const mins = minutes % 60; const hours = (minutes - mins) / 60; - return i18n.translate( - 'xpack.observability.slo.sloDetails.errorBudgetChartPanel.minuteHoursLabel', - { - defaultMessage: '{hours}h {mins}m', - values: { hours: Math.trunc(hours), mins: Math.trunc(mins) }, - } - ); + return i18n.translate('xpack.slo.sloDetails.errorBudgetChartPanel.minuteHoursLabel', { + defaultMessage: '{hours}h {mins}m', + values: { hours: Math.trunc(hours), mins: Math.trunc(mins) }, + }); } - return i18n.translate('xpack.observability.slo.sloDetails.errorBudgetChartPanel.minuteLabel', { + return i18n.translate('xpack.slo.sloDetails.errorBudgetChartPanel.minuteLabel', { defaultMessage: '{minutes}m', values: { minutes }, }); @@ -62,10 +59,9 @@ export function ErrorBudgetChart({ data, isLoading, slo }: Props) { titleColor={isSloFailed ? 'danger' : 'success'} title={numeral(slo.summary.errorBudget.remaining).format(percentFormat)} titleSize="s" - description={i18n.translate( - 'xpack.observability.slo.sloDetails.errorBudgetChartPanel.remaining', - { defaultMessage: 'Remaining' } - )} + description={i18n.translate('xpack.slo.sloDetails.errorBudgetChartPanel.remaining', { + defaultMessage: 'Remaining', + })} reverse />
@@ -75,10 +71,9 @@ export function ErrorBudgetChart({ data, isLoading, slo }: Props) { titleColor={isSloFailed ? 'danger' : 'success'} title={errorBudgetTimeRemainingFormatted} titleSize="s" - description={i18n.translate( - 'xpack.observability.slo.sloDetails.errorBudgetChartPanel.remaining', - { defaultMessage: 'Remaining' } - )} + description={i18n.translate('xpack.slo.sloDetails.errorBudgetChartPanel.remaining', { + defaultMessage: 'Remaining', + })} reverse /> @@ -88,12 +83,9 @@ export function ErrorBudgetChart({ data, isLoading, slo }: Props) {

- {i18n.translate( - 'xpack.observability.slo.sloDetails.errorBudgetChartPanel.title', - { - defaultMessage: 'Error budget burn down', - } - )} + {i18n.translate('xpack.slo.sloDetails.errorBudgetChartPanel.title', { + defaultMessage: 'Error budget burn down', + })}

@@ -63,7 +60,7 @@ export function ErrorBudgetHeader({ {rollingTimeWindowTypeSchema.is(slo.timeWindow.type) - ? i18n.translate('xpack.observability.slo.sloDetails.errorBudgetChartPanel.duration', { + ? i18n.translate('xpack.slo.sloDetails.errorBudgetChartPanel.duration', { defaultMessage: 'Last {duration}', values: { duration: toDurationLabel(slo.timeWindow.duration) }, }) diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/events_chart_panel.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/events_chart_panel.tsx similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/events_chart_panel.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/events_chart_panel.tsx index 96b0f0b29e998..764dcda8e04b3 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/events_chart_panel.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/events_chart_panel.tsx @@ -36,7 +36,7 @@ import { max, min } from 'lodash'; import moment from 'moment'; import React, { useRef } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; -import { useGetPreviewData } from '../../../hooks/slo/use_get_preview_data'; +import { useGetPreviewData } from '../../../hooks/use_get_preview_data'; import { useKibana } from '../../../utils/kibana_react'; import { COMPARATOR_MAPPING } from '../../slo_edit/constants'; import { GoodBadEventsChart } from '../../slos/components/common/good_bad_events_chart'; @@ -73,7 +73,7 @@ export function EventsChartPanel({ slo, range }: Props) { slo.indicator.type !== 'sli.metric.timeslice' ? (

- {i18n.translate('xpack.observability.slo.sloDetails.eventsChartPanel.title', { + {i18n.translate('xpack.slo.sloDetails.eventsChartPanel.title', { defaultMessage: 'Good vs bad events', })}

@@ -81,7 +81,7 @@ export function EventsChartPanel({ slo, range }: Props) { ) : (

- {i18n.translate('xpack.observability.slo.sloDetails.eventsChartPanel.timesliceTitle', { + {i18n.translate('xpack.slo.sloDetails.eventsChartPanel.timesliceTitle', { defaultMessage: 'Timeslice metric', })}

@@ -158,7 +158,7 @@ export function EventsChartPanel({ slo, range }: Props) { {title} - {i18n.translate('xpack.observability.slo.sloDetails.eventsChartPanel.duration', { + {i18n.translate('xpack.slo.sloDetails.eventsChartPanel.duration', { defaultMessage: 'Last 24h', })} @@ -177,7 +177,7 @@ export function EventsChartPanel({ slo, range }: Props) { > diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_control.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_control.stories.tsx similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_control.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_control.stories.tsx index af6338d4a3977..3f4efc2f9bf73 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_control.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_control.stories.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { buildSlo } from '../../../data/slo/slo'; import { HeaderControl as Component, Props } from './header_control'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_control.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_control.tsx similarity index 82% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_control.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_control.tsx index b8bad5b98c4c5..5e0652e85cdff 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_control.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_control.tsx @@ -10,15 +10,16 @@ import { i18n } from '@kbn/i18n'; import { SLOWithSummaryResponse } from '@kbn/slo-schema'; import React, { useCallback, useState } from 'react'; -import { rulesLocatorID, sloFeatureId } from '../../../../common'; -import { SLO_BURN_RATE_RULE_TYPE_ID } from '../../../../common/constants'; +import type { RulesParams } from '@kbn/observability-plugin/public'; +import { rulesLocatorID } from '@kbn/observability-plugin/common'; +import { SLO_BURN_RATE_RULE_TYPE_ID } from '@kbn/rule-data-utils'; +import { sloFeatureId } from '@kbn/observability-plugin/common'; +import { useKibana } from '../../../utils/kibana_react'; import { paths } from '../../../../common/locators/paths'; import { SloDeleteConfirmationModal } from '../../../components/slo/delete_confirmation_modal/slo_delete_confirmation_modal'; -import { useCapabilities } from '../../../hooks/slo/use_capabilities'; -import { useCloneSlo } from '../../../hooks/slo/use_clone_slo'; -import { useDeleteSlo } from '../../../hooks/slo/use_delete_slo'; -import type { RulesParams } from '../../../locators/rules'; -import { useKibana } from '../../../utils/kibana_react'; +import { useCapabilities } from '../../../hooks/use_capabilities'; +import { useCloneSlo } from '../../../hooks/use_clone_slo'; +import { useDeleteSlo } from '../../../hooks/use_delete_slo'; import { convertSliApmParamsToApmAppDeeplinkUrl } from '../../../utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url'; import { isApmIndicatorType } from '../../../utils/slo/indicator'; @@ -50,7 +51,7 @@ export function HeaderControl({ isLoading, slo }: Props) { const handleEdit = () => { if (slo) { - navigate(basePath.prepend(paths.observability.sloEdit(slo.id))); + navigate(basePath.prepend(paths.sloEdit(slo.id))); } }; @@ -103,7 +104,7 @@ export function HeaderControl({ isLoading, slo }: Props) { const handleDeleteConfirm = async () => { if (slo) { deleteSlo({ id: slo.id, name: slo.name }); - navigate(basePath.prepend(paths.observability.slos)); + navigate(basePath.prepend(paths.slos)); } }; @@ -126,7 +127,7 @@ export function HeaderControl({ isLoading, slo }: Props) { onClick={handleActionsClick} disabled={isLoading || !slo} > - {i18n.translate('xpack.observability.slo.sloDetails.headerControl.actions', { + {i18n.translate('xpack.slo.sloDetails.headerControl.actions', { defaultMessage: 'Actions', })} @@ -144,7 +145,7 @@ export function HeaderControl({ isLoading, slo }: Props) { onClick={handleEdit} data-test-subj="sloDetailsHeaderControlPopoverEdit" > - {i18n.translate('xpack.observability.slo.sloDetails.headerControl.edit', { + {i18n.translate('xpack.slo.sloDetails.headerControl.edit', { defaultMessage: 'Edit', })} , @@ -155,12 +156,9 @@ export function HeaderControl({ isLoading, slo }: Props) { onClick={handleOpenRuleFlyout} data-test-subj="sloDetailsHeaderControlPopoverCreateRule" > - {i18n.translate( - 'xpack.observability.slo.sloDetails.headerControl.createBurnRateRule', - { - defaultMessage: 'Create new alert rule', - } - )} + {i18n.translate('xpack.slo.sloDetails.headerControl.createBurnRateRule', { + defaultMessage: 'Create new alert rule', + })} , - {i18n.translate('xpack.observability.slo.sloDetails.headerControl.manageRules', { + {i18n.translate('xpack.slo.sloDetails.headerControl.manageRules', { defaultMessage: 'Manage rules', })} , @@ -183,12 +181,9 @@ export function HeaderControl({ isLoading, slo }: Props) { onClick={handleNavigateToApm} data-test-subj="sloDetailsHeaderControlPopoverExploreInApm" > - {i18n.translate( - 'xpack.observability.slos.sloDetails.headerControl.exploreInApm', - { - defaultMessage: 'Service details', - } - )} + {i18n.translate('xpack.slo.sloDetails.headerControl.exploreInApm', { + defaultMessage: 'Service details', + })} ) : ( [] @@ -202,7 +197,7 @@ export function HeaderControl({ isLoading, slo }: Props) { onClick={handleClone} data-test-subj="sloDetailsHeaderControlPopoverClone" > - {i18n.translate('xpack.observability.slo.slo.item.actions.clone', { + {i18n.translate('xpack.slo.slo.item.actions.clone', { defaultMessage: 'Clone', })} , @@ -213,7 +208,7 @@ export function HeaderControl({ isLoading, slo }: Props) { onClick={handleDelete} data-test-subj="sloDetailsHeaderControlPopoverDelete" > - {i18n.translate('xpack.observability.slo.slo.item.actions.delete', { + {i18n.translate('xpack.slo.slo.item.actions.delete', { defaultMessage: 'Delete', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_title.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_title.stories.tsx similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_title.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_title.stories.tsx index daf5e8038fdd3..3a4289a840765 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_title.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_title.stories.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { buildSlo } from '../../../data/slo/slo'; import { HeaderTitle as Component, Props } from './header_title'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_title.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_title.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_title.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_title.tsx index 151d459cab667..4fa331b3e847b 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/header_title.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/header_title.tsx @@ -45,7 +45,7 @@ export function HeaderTitle({ isLoading, slo, showTitle = true }: Props) { - {i18n.translate('xpack.observability.slo.sloDetails.headerTitle.lastUpdatedMessage', { + {i18n.translate('xpack.slo.sloDetails.headerTitle.lastUpdatedMessage', { defaultMessage: 'Last updated on', })} @@ -56,7 +56,7 @@ export function HeaderTitle({ isLoading, slo, showTitle = true }: Props) { - {i18n.translate('xpack.observability.slo.sloDetails.headerTitle.createdMessage', { + {i18n.translate('xpack.slo.sloDetails.headerTitle.createdMessage', { defaultMessage: 'Created on', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/overview/apm_indicator_overview.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/apm_indicator_overview.tsx similarity index 69% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/overview/apm_indicator_overview.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/apm_indicator_overview.tsx index 1441f8752d296..6520c061d6d07 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/overview/apm_indicator_overview.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/apm_indicator_overview.tsx @@ -46,46 +46,46 @@ export function ApmIndicatorOverview({ slo }: Props) { return ( - {i18n.translate( - 'xpack.observability.slo.sloDetails.overview.apmSource.serviceLabel', - { defaultMessage: 'service: {value}', values: { value: service } } - )} + {i18n.translate('xpack.slo.sloDetails.overview.apmSource.serviceLabel', { + defaultMessage: 'service: {value}', + values: { value: service }, + })} {environment !== ALL_VALUE && ( - {i18n.translate( - 'xpack.observability.slo.sloDetails.overview.apmSource.environmentLabel', - { defaultMessage: 'environment: {value}', values: { value: environment } } - )} + {i18n.translate('xpack.slo.sloDetails.overview.apmSource.environmentLabel', { + defaultMessage: 'environment: {value}', + values: { value: environment }, + })} )} {transactionType !== ALL_VALUE && ( - {i18n.translate( - 'xpack.observability.slo.sloDetails.overview.apmSource.transactionTypeLabel', - { defaultMessage: 'transactionType: {value}', values: { value: transactionType } } - )} + {i18n.translate('xpack.slo.sloDetails.overview.apmSource.transactionTypeLabel', { + defaultMessage: 'transactionType: {value}', + values: { value: transactionType }, + })} )} {transactionName !== ALL_VALUE && ( - {i18n.translate( - 'xpack.observability.slo.sloDetails.overview.apmSource.transactionNameLabel', - { defaultMessage: 'transactionName: {value}', values: { value: transactionName } } - )} + {i18n.translate('xpack.slo.sloDetails.overview.apmSource.transactionNameLabel', { + defaultMessage: 'transactionName: {value}', + values: { value: transactionName }, + })} )} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/overview/display_query.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/display_query.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/overview/display_query.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/display_query.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/overview/overview.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview.stories.tsx similarity index 88% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/overview/overview.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview.stories.tsx index c393846e23a7d..4e04957b631fd 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/overview/overview.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview.stories.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; -import { KibanaReactStorybookDecorator } from '../../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { buildSlo } from '../../../../data/slo/slo'; import { Overview as Component, Props } from './overview'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/overview/overview.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview.tsx similarity index 79% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/overview/overview.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview.tsx index 303fc6d66a3eb..c974c91b00a69 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/overview/overview.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/overview/overview.tsx @@ -54,12 +54,12 @@ export function Overview({ slo }: Props) { - {i18n.translate('xpack.observability.slo.sloDetails.overview.observedValueSubtitle', { + {i18n.translate('xpack.slo.sloDetails.overview.observedValueSubtitle', { defaultMessage: '{value} (objective is {objective})', values: { value: hasNoData ? '-' : numeral(slo.summary.sliValue).format(percentFormat), @@ -70,22 +70,21 @@ export function Overview({ slo }: Props) { } /> {toIndicatorTypeLabel(slo.indicator.type)}} /> {BUDGETING_METHOD_OCCURRENCES} @@ -94,7 +93,7 @@ export function Overview({ slo }: Props) { {BUDGETING_METHOD_TIMESLICES} ( {slo.indicator.type === 'sli.metric.timeslice' ? i18n.translate( - 'xpack.observability.slo.sloDetails.overview.timeslicesBudgetingMethodDetailsForTimesliceMetric', + 'xpack.slo.sloDetails.overview.timeslicesBudgetingMethodDetailsForTimesliceMetric', { defaultMessage: '{duration} slices', values: { @@ -103,7 +102,7 @@ export function Overview({ slo }: Props) { } ) : i18n.translate( - 'xpack.observability.slo.sloDetails.overview.timeslicesBudgetingMethodDetails', + 'xpack.slo.sloDetails.overview.timeslicesBudgetingMethodDetails', { defaultMessage: '{duration} slices, {target} target', values: { @@ -118,13 +117,13 @@ export function Overview({ slo }: Props) { } /> {!!slo.description ? slo.description : '-'}
} /> } @@ -132,7 +131,7 @@ export function Overview({ slo }: Props) { {IndicatorOverview} {'index' in slo.indicator.params && ( - {i18n.translate( - 'xpack.observability.slo.sloDetails.overview.syntheticsMonitor.name', - { defaultMessage: 'Name: {value}', values: { value: name } } - )} + {i18n.translate('xpack.slo.sloDetails.overview.syntheticsMonitor.name', { + defaultMessage: 'Name: {value}', + values: { value: name }, + })}
)} {location && ( - {i18n.translate( - 'xpack.observability.slo.sloDetails.overview.syntheticsMonitor.locationName', - { defaultMessage: 'Location: {value}', values: { value: location } } - )} + {i18n.translate('xpack.slo.sloDetails.overview.syntheticsMonitor.locationName', { + defaultMessage: 'Location: {value}', + values: { value: location }, + })} )} @@ -78,15 +78,12 @@ export function SyntheticsIndicatorOverview({ slo }: Props) { ); } -const MONITOR_LABEL = i18n.translate( - 'xpack.observability.slo.sloDetails.overview.syntheticsMonitor', - { - defaultMessage: 'Synthetics monitor', - } -); +const MONITOR_LABEL = i18n.translate('xpack.slo.sloDetails.overview.syntheticsMonitor', { + defaultMessage: 'Synthetics monitor', +}); const MONITOR_ARIA_LABEL = i18n.translate( - 'xpack.observability.slo.sloDetails.overview.syntheticsMonitorDetails', + 'xpack.slo.sloDetails.overview.syntheticsMonitorDetails', { defaultMessage: 'Synthetics monitor details', } diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/sli_chart_panel.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/sli_chart_panel.tsx similarity index 73% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/sli_chart_panel.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/sli_chart_panel.tsx index cbda5b41cb0ca..788303b43ffa1 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/sli_chart_panel.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/sli_chart_panel.tsx @@ -10,8 +10,8 @@ import numeral from '@elastic/numeral'; import { i18n } from '@kbn/i18n'; import { rollingTimeWindowTypeSchema, SLOWithSummaryResponse } from '@kbn/slo-schema'; import React from 'react'; -import { ChartData } from '../../../typings/slo'; import { useKibana } from '../../../utils/kibana_react'; +import { ChartData } from '../../../typings/slo'; import { toDurationAdverbLabel, toDurationLabel } from '../../../utils/slo/labels'; import { WideChart } from './wide_chart'; @@ -35,7 +35,7 @@ export function SliChartPanel({ data, isLoading, slo }: Props) {

- {i18n.translate('xpack.observability.slo.sloDetails.sliHistoryChartPanel.title', { + {i18n.translate('xpack.slo.sloDetails.sliHistoryChartPanel.title', { defaultMessage: 'Historical SLI', })}

@@ -44,13 +44,10 @@ export function SliChartPanel({ data, isLoading, slo }: Props) { {rollingTimeWindowTypeSchema.is(slo.timeWindow.type) - ? i18n.translate( - 'xpack.observability.slo.sloDetails.sliHistoryChartPanel.duration', - { - defaultMessage: 'Last {duration}', - values: { duration: toDurationLabel(slo.timeWindow.duration) }, - } - ) + ? i18n.translate('xpack.slo.sloDetails.sliHistoryChartPanel.duration', { + defaultMessage: 'Last {duration}', + values: { duration: toDurationLabel(slo.timeWindow.duration) }, + }) : toDurationAdverbLabel(slo.timeWindow.duration)} @@ -62,10 +59,9 @@ export function SliChartPanel({ data, isLoading, slo }: Props) { titleColor={isSloFailed ? 'danger' : 'success'} title={hasNoData ? '-' : numeral(slo.summary.sliValue).format(percentFormat)} titleSize="s" - description={i18n.translate( - 'xpack.observability.slo.sloDetails.sliHistoryChartPanel.current', - { defaultMessage: 'Observed value' } - )} + description={i18n.translate('xpack.slo.sloDetails.sliHistoryChartPanel.current', { + defaultMessage: 'Observed value', + })} reverse />
@@ -73,10 +69,9 @@ export function SliChartPanel({ data, isLoading, slo }: Props) { @@ -85,12 +80,9 @@ export function SliChartPanel({ data, isLoading, slo }: Props) { ({ id: htmlIdGenerator()(), - label: i18n.translate('xpack.observability.slo.burnRates.fromRange.label', { + label: i18n.translate('xpack.slo.burnRates.fromRange.label', { defaultMessage: '{duration}h', values: { duration: window.longWindow.value }, }), diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/wide_chart.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/wide_chart.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/wide_chart.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/wide_chart.tsx index ee3a475e13110..d737590b190a5 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/components/wide_chart.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/components/wide_chart.tsx @@ -24,8 +24,8 @@ import moment from 'moment'; import React, { useRef } from 'react'; import { i18n } from '@kbn/i18n'; -import { ChartData } from '../../../typings'; import { useKibana } from '../../../utils/kibana_react'; +import { ChartData } from '../../../typings'; type ChartType = 'area' | 'line'; type State = 'success' | 'error'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/hooks/use_error_budget_actions.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_error_budget_actions.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/hooks/use_error_budget_actions.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_error_budget_actions.ts diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/hooks/use_get_instance_id_query_param.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_get_instance_id_query_param.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/hooks/use_get_instance_id_query_param.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_get_instance_id_query_param.ts diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/hooks/use_slo_details_tabs.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_slo_details_tabs.tsx similarity index 86% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/hooks/use_slo_details_tabs.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_slo_details_tabs.tsx index b687616b747b7..b49446f1651a6 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/hooks/use_slo_details_tabs.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/hooks/use_slo_details_tabs.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { EuiNotificationBadge } from '@elastic/eui'; import React from 'react'; import { ALL_VALUE, SLOWithSummaryResponse } from '@kbn/slo-schema'; -import { useFetchActiveAlerts } from '../../../hooks/slo/use_fetch_active_alerts'; +import { useFetchActiveAlerts } from '../../../hooks/use_fetch_active_alerts'; import { ALERTS_TAB_ID, OVERVIEW_TAB_ID, SloTabId } from '../components/slo_details'; export const useSloDetailsTabs = ({ @@ -31,7 +31,7 @@ export const useSloDetailsTabs = ({ const tabs = [ { id: OVERVIEW_TAB_ID, - label: i18n.translate('xpack.observability.slo.sloDetails.tab.overviewLabel', { + label: i18n.translate('xpack.slo.sloDetails.tab.overviewLabel', { defaultMessage: 'Overview', }), 'data-test-subj': 'overviewTab', @@ -40,7 +40,7 @@ export const useSloDetailsTabs = ({ }, { id: ALERTS_TAB_ID, - label: i18n.translate('xpack.observability.slo.sloDetails.tab.alertsLabel', { + label: i18n.translate('xpack.slo.sloDetails.tab.alertsLabel', { defaultMessage: 'Alerts', }), 'data-test-subj': 'alertsTab', diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/slo_details.test.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/slo_details.test.tsx similarity index 92% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/slo_details.test.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/slo_details.test.tsx index d01151d943264..af985a8363493 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/slo_details.test.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/slo_details.test.tsx @@ -20,17 +20,17 @@ import { } from '../../data/slo/historical_summary_data'; import { buildApmAvailabilityIndicator } from '../../data/slo/indicator'; import { buildSlo } from '../../data/slo/slo'; -import { ActiveAlerts } from '../../hooks/slo/active_alerts'; -import { useCapabilities } from '../../hooks/slo/use_capabilities'; -import { useDeleteSlo } from '../../hooks/slo/use_delete_slo'; -import { useFetchActiveAlerts } from '../../hooks/slo/use_fetch_active_alerts'; -import { useFetchHistoricalSummary } from '../../hooks/slo/use_fetch_historical_summary'; -import { useFetchSloDetails } from '../../hooks/slo/use_fetch_slo_details'; +import { ActiveAlerts } from '../../hooks/active_alerts'; +import { useCapabilities } from '../../hooks/use_capabilities'; +import { useDeleteSlo } from '../../hooks/use_delete_slo'; +import { useFetchActiveAlerts } from '../../hooks/use_fetch_active_alerts'; +import { useFetchHistoricalSummary } from '../../hooks/use_fetch_historical_summary'; +import { useFetchSloDetails } from '../../hooks/use_fetch_slo_details'; import { useLicense } from '../../hooks/use_license'; import { useKibana } from '../../utils/kibana_react'; import { render } from '../../utils/test_helper'; import { SloDetailsPage } from './slo_details'; -import { TagsList } from '@kbn/observability-shared-plugin/public'; +import { TagsList, HeaderMenuPortal } from '@kbn/observability-shared-plugin/public'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), @@ -40,11 +40,11 @@ jest.mock('react-router-dom', () => ({ jest.mock('@kbn/observability-shared-plugin/public'); jest.mock('../../utils/kibana_react'); jest.mock('../../hooks/use_license'); -jest.mock('../../hooks/slo/use_capabilities'); -jest.mock('../../hooks/slo/use_fetch_active_alerts'); -jest.mock('../../hooks/slo/use_fetch_slo_details'); -jest.mock('../../hooks/slo/use_fetch_historical_summary'); -jest.mock('../../hooks/slo/use_delete_slo'); +jest.mock('../../hooks/use_capabilities'); +jest.mock('../../hooks/use_fetch_active_alerts'); +jest.mock('../../hooks/use_fetch_slo_details'); +jest.mock('../../hooks/use_fetch_historical_summary'); +jest.mock('../../hooks/use_delete_slo'); const useKibanaMock = useKibana as jest.Mock; @@ -57,6 +57,9 @@ const useDeleteSloMock = useDeleteSlo as jest.Mock; const TagsListMock = TagsList as jest.Mock; TagsListMock.mockReturnValue(
Tags list
); +const HeaderMenuPortalMock = HeaderMenuPortal as jest.Mock; +HeaderMenuPortalMock.mockReturnValue(
Portal node
); + const mockNavigate = jest.fn(); const mockLocator = jest.fn(); const mockDelete = jest.fn(); @@ -144,7 +147,7 @@ describe('SLO Details Page', () => { render(); - expect(mockNavigate).toBeCalledWith(paths.observability.slos); + expect(mockNavigate).toBeCalledWith(paths.slos); }); }); @@ -260,7 +263,7 @@ describe('SLO Details Page', () => { await waitFor(() => { expect(mockNavigate).toBeCalledWith( - paths.observability.sloCreateWithEncodedForm( + paths.sloCreateWithEncodedForm( encode({ ...slo, name: `[Copy] ${slo.name}`, id: undefined }) ) ); @@ -293,7 +296,7 @@ describe('SLO Details Page', () => { }); await waitFor(() => { - expect(mockNavigate).toBeCalledWith(paths.observability.slos); + expect(mockNavigate).toBeCalledWith(paths.slos); }); }); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/slo_details.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/slo_details.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/slo_details.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/slo_details.tsx index 19e032bbad8a3..d5e2665d4a9cb 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/slo_details.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/slo_details.tsx @@ -16,10 +16,11 @@ import type { SLOWithSummaryResponse } from '@kbn/slo-schema'; import { useBreadcrumbs } from '@kbn/observability-shared-plugin/public'; import dedent from 'dedent'; +import { HeaderMenu } from '../../components/header_menu/header_menu'; import { useSloDetailsTabs } from './hooks/use_slo_details_tabs'; import { useKibana } from '../../utils/kibana_react'; import { usePluginContext } from '../../hooks/use_plugin_context'; -import { useFetchSloDetails } from '../../hooks/slo/use_fetch_slo_details'; +import { useFetchSloDetails } from '../../hooks/use_fetch_slo_details'; import { useLicense } from '../../hooks/use_license'; import PageNotFound from '../404'; import { @@ -36,7 +37,6 @@ import type { SloDetailsPathParams } from './types'; import { AutoRefreshButton } from '../../components/slo/auto_refresh_button'; import { useGetInstanceIdQueryParam } from './hooks/use_get_instance_id_query_param'; import { useAutoRefreshStorage } from '../../components/slo/auto_refresh_button/hooks/use_auto_refresh_storage'; -import { HeaderMenu } from '../overview/components/header_menu/header_menu'; export function SloDetailsPage() { const { @@ -111,7 +111,7 @@ export function SloDetailsPage() { } if (hasRightLicense === false) { - navigateToUrl(basePath.prepend(paths.observability.slos)); + navigateToUrl(basePath.prepend(paths.slos)); } const isPerformingAction = isLoading || isDeleting; @@ -152,16 +152,16 @@ function getBreadcrumbs( ): ChromeBreadcrumb[] { return [ { - href: basePath.prepend(paths.observability.slos), - text: i18n.translate('xpack.observability.breadcrumbs.slosLinkText', { + href: basePath.prepend(paths.slos), + text: i18n.translate('xpack.slo.breadcrumbs.slosLinkText', { defaultMessage: 'SLOs', }), - deepLinkId: 'observability-overview:slos', + deepLinkId: 'slo', }, { text: slo?.name ?? - i18n.translate('xpack.observability.breadcrumbs.sloDetailsLinkText', { + i18n.translate('xpack.slo.breadcrumbs.sloDetailsLinkText', { defaultMessage: 'Details', }), }, diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_details/types.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_details/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_details/types.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_details/types.ts diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.stories.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.stories.tsx index c3c506eb484eb..235c45db8c986 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { FormProvider, useForm } from 'react-hook-form'; -import { KibanaReactStorybookDecorator } from '../../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { ApmAvailabilityIndicatorTypeForm as Component } from './apm_availability_indicator_type_form'; import { SLO_EDIT_FORM_DEFAULT_VALUES } from '../../constants'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.tsx similarity index 70% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.tsx index ade6cc5c32008..cb50694027c14 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/apm_availability/apm_availability_indicator_type_form.tsx @@ -11,7 +11,7 @@ import React, { useEffect } from 'react'; import { useFormContext } from 'react-hook-form'; import { useCreateDataView } from '../../../../hooks/use_create_data_view'; import { GroupByField } from '../common/group_by_field'; -import { useFetchApmIndex } from '../../../../hooks/slo/use_fetch_apm_indices'; +import { useFetchApmIndex } from '../../../../hooks/use_fetch_apm_indices'; import { CreateSLOForm } from '../../types'; import { FieldSelector } from '../apm_common/field_selector'; import { DataPreviewChart } from '../common/data_preview_chart'; @@ -36,19 +36,18 @@ export function ApmAvailabilityIndicatorTypeForm() { - {i18n.translate( - 'xpack.observability.slo.sloEdit.apmLatency.threshold.placeholder', - { defaultMessage: 'Threshold (ms)' } - )}{' '} + {i18n.translate('xpack.slo.sloEdit.apmLatency.threshold.placeholder', { + defaultMessage: 'Threshold (ms)', + })}{' '} @@ -153,19 +140,16 @@ export function ApmLatencyIndicatorTypeForm() {

@@ -136,13 +136,10 @@ export function DataPreviewChart({ - {i18n.translate( - 'xpack.observability.slo.sloEdit.dataPreviewChart.explanationMessage', - { - defaultMessage: - 'Fill the indicator fields to see visualisation of the current metrics', - } - )} + {i18n.translate('xpack.slo.sloEdit.dataPreviewChart.explanationMessage', { + defaultMessage: + 'Fill the indicator fields to see visualisation of the current metrics', + })} @@ -223,7 +220,7 @@ export function DataPreviewChart({ } {isError && ( - {i18n.translate( - 'xpack.observability.slo.sloEdit.dataPreviewChart.errorMessage', - { - defaultMessage: 'The current indicator settings are invalid', - } - )} + {i18n.translate('xpack.slo.sloEdit.dataPreviewChart.errorMessage', { + defaultMessage: 'The current indicator settings are invalid', + })} )}
@@ -272,23 +266,17 @@ export function DataPreviewChart({ ...firstItem, formattedValue: events.good, value: events.good, - label: i18n.translate( - 'xpack.observability.slo.sloEdit.dataPreviewChart.goodEvents', - { - defaultMessage: 'Good events', - } - ), + label: i18n.translate('xpack.slo.sloEdit.dataPreviewChart.goodEvents', { + defaultMessage: 'Good events', + }), }); rows.push({ ...firstItem, value: events.total, formattedValue: events.total, - label: i18n.translate( - 'xpack.observability.slo.sloEdit.dataPreviewChart.badEvents', - { - defaultMessage: 'Total events', - } - ), + label: i18n.translate('xpack.slo.sloEdit.dataPreviewChart.badEvents', { + defaultMessage: 'Total events', + }), }); } @@ -315,7 +303,7 @@ export function DataPreviewChart({

- {i18n.translate( - 'xpack.observability.equivalentApiRequest.h2.equivalentAPIRequestToLabel', - { defaultMessage: 'Equivalent API request' } - )} + {i18n.translate('xpack.slo.equivalentApiRequest.h2.equivalentAPIRequestToLabel', { + defaultMessage: 'Equivalent API request', + })}

@@ -75,7 +74,7 @@ export function EquivalentApiRequest({ disabled, isEditMode, slo }: Props) { @@ -85,10 +84,9 @@ export function EquivalentApiRequest({ disabled, isEditMode, slo }: Props) { ) : ( - {i18n.translate( - 'xpack.observability.equivalentApiRequest.formIsNotValidCodeBlockLabel', - { defaultMessage: 'Form is not valid' } - )} + {i18n.translate('xpack.slo.equivalentApiRequest.formIsNotValidCodeBlockLabel', { + defaultMessage: 'Form is not valid', + })} )} @@ -99,7 +97,7 @@ export function EquivalentApiRequest({ disabled, isEditMode, slo }: Props) { onClick={() => setIsFlyoutVisible(false)} flush="left" > - {i18n.translate('xpack.observability.equivalentApiRequest.closeButtonEmptyLabel', { + {i18n.translate('xpack.slo.equivalentApiRequest.closeButtonEmptyLabel', { defaultMessage: 'Close', })} @@ -116,7 +114,7 @@ export function EquivalentApiRequest({ disabled, isEditMode, slo }: Props) { disabled={disabled} onClick={() => setIsFlyoutVisible(true)} > - {i18n.translate('xpack.observability.slo.sloEdit.equivalentApiRequest', { + {i18n.translate('xpack.slo.sloEdit.equivalentApiRequest', { defaultMessage: 'Equivalent API request', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/group_by_field.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/group_by_field.tsx similarity index 85% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/group_by_field.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/group_by_field.tsx index ff50fa882cd06..b8dd052f61ebc 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/group_by_field.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/group_by_field.tsx @@ -12,7 +12,7 @@ import React from 'react'; import { DataView } from '@kbn/data-views-plugin/common'; import { useFormContext } from 'react-hook-form'; import { OptionalText } from './optional_text'; -import { useFetchGroupByCardinality } from '../../../../hooks/slo/use_fetch_group_by_cardinality'; +import { useFetchGroupByCardinality } from '../../../../hooks/use_fetch_group_by_cardinality'; import { CreateSLOForm } from '../../types'; import { IndexFieldSelector } from './index_field_selector'; import { getGroupKeysProse } from '../../../../utils/slo/groupings'; @@ -39,11 +39,11 @@ export function GroupByField({ dataView, isLoading }: { dataView?: DataView; isL defaultValue={ALL_VALUE} label={ - {i18n.translate('xpack.observability.slo.sloEdit.groupBy.label', { + {i18n.translate('xpack.slo.sloEdit.groupBy.label', { defaultMessage: 'Group by', })}{' '} } labelAppend={} - placeholder={i18n.translate('xpack.observability.slo.sloEdit.groupBy.placeholder', { + placeholder={i18n.translate('xpack.slo.sloEdit.groupBy.placeholder', { defaultMessage: 'Select an optional field to group by', })} isLoading={!!index && isLoading} @@ -62,7 +62,7 @@ export function GroupByField({ dataView, isLoading }: { dataView?: DataView; isL size="s" iconType={groupByCardinality.isHighCardinality ? 'warning' : ''} color={groupByCardinality.isHighCardinality ? 'warning' : 'primary'} - title={i18n.translate('xpack.observability.slo.sloEdit.groupBy.cardinalityInfo', { + title={i18n.translate('xpack.slo.sloEdit.groupBy.cardinalityInfo', { defaultMessage: 'Selected group by field {groupBy} will generate at least {card} SLO instances based on the last 24h sample data.', values: { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/index_field_selector.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/index_field_selector.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/index_field_selector.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/index_field_selector.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/optional_text.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/optional_text.tsx similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/optional_text.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/optional_text.tsx index b73ef8c08098e..863c1e498dca7 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/optional_text.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/optional_text.tsx @@ -12,7 +12,7 @@ import React from 'react'; export function OptionalText() { return ( - {i18n.translate('xpack.observability.slo.sloEdit.optionalLabel', { + {i18n.translate('xpack.slo.sloEdit.optionalLabel', { defaultMessage: 'Optional', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_builder.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_builder.stories.tsx similarity index 92% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_builder.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_builder.stories.tsx index 88d2679ceb6e9..a20e00985a66e 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_builder.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_builder.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { FormProvider, useForm } from 'react-hook-form'; -import { KibanaReactStorybookDecorator } from '../../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { QueryBuilder as Component, SearchBarProps } from './query_builder'; import { SLO_EDIT_FORM_DEFAULT_VALUES } from '../../constants'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_builder.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_builder.tsx similarity index 95% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_builder.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_builder.tsx index 63252f2286157..b3847404f4995 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_builder.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_builder.tsx @@ -51,7 +51,7 @@ export function QueryBuilder(props: SearchBarProps) { data-test-subj="o11yQueryBuilderButton" iconType="documents" onClick={() => setIsFlyoutOpen(true)} - aria-label={i18n.translate('xpack.observability.queryBuilder.documentsButtonLabel', { + aria-label={i18n.translate('xpack.slo.queryBuilder.documentsButtonLabel', { defaultMessage: 'View documents', })} /> diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_documents_flyout.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_documents_flyout.tsx similarity index 92% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_documents_flyout.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_documents_flyout.tsx index d11b9bb496b64..1f2760a1bdd56 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_documents_flyout.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_documents_flyout.tsx @@ -47,7 +47,7 @@ export function QueryDocumentsFlyout({

- {i18n.translate('xpack.observability.queryBuilder.h2.documentsLabel', { + {i18n.translate('xpack.slo.queryBuilder.h2.documentsLabel', { defaultMessage: 'Documents for {indexPattern}', values: { indexPattern: dataView.getIndexPattern() }, })} @@ -70,7 +70,7 @@ export function QueryDocumentsFlyout({ data-test-subj="o11yQueryBuilderCloseButton" onClick={() => setIsFlyoutOpen(false)} > - {i18n.translate('xpack.observability.queryBuilder.closeButtonLabel', { + {i18n.translate('xpack.slo.queryBuilder.closeButtonLabel', { defaultMessage: 'Close', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_search_bar.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_search_bar.tsx similarity index 98% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_search_bar.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_search_bar.tsx index f3b6279ed39ed..49ddd17e65a4e 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/query_search_bar.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/query_search_bar.tsx @@ -11,11 +11,11 @@ import { fromKueryExpression, Query, TimeRange, toElasticsearchQuery } from '@kb import { kqlQuerySchema, kqlWithFiltersSchema } from '@kbn/slo-schema'; import React, { memo } from 'react'; import styled from 'styled-components'; +import { observabilityAppId } from '@kbn/observability-shared-plugin/common'; import { useCreateDataView } from '../../../../hooks/use_create_data_view'; import { SearchBarProps } from './query_builder'; import { useKibana } from '../../../../utils/kibana_react'; import { CreateSLOForm } from '../../types'; -import { observabilityAppId } from '../../../../../common'; import { OptionalText } from './optional_text'; export const QuerySearchBar = memo( diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/slo_inspect.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/slo_inspect.tsx similarity index 85% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/slo_inspect.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/slo_inspect.tsx index 9f911bb1787ea..223105572f667 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/slo_inspect.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/slo_inspect.tsx @@ -27,14 +27,13 @@ import { INGEST_PIPELINES_APP_LOCATOR, INGEST_PIPELINES_PAGES, } from '@kbn/ingest-pipelines-plugin/public'; -import { useKibana } from '@kbn/kibana-react-plugin/public'; import { useFetcher } from '@kbn/observability-shared-plugin/public'; import { GetSLOResponse } from '@kbn/slo-schema'; import React, { ReactNode, useState } from 'react'; import { useFormContext } from 'react-hook-form'; -import { ObservabilityPublicPluginsStart } from '../../../..'; -import { enableInspectEsQueries } from '../../../../../common'; -import { useFetchSloInspect } from '../../../../hooks/slo/use_fetch_slo_inspect'; +import { enableInspectEsQueries } from '@kbn/observability-plugin/common'; +import { useKibana } from '../../../../utils/kibana_react'; +import { useFetchSloInspect } from '../../../../hooks/use_fetch_slo_inspect'; import { usePluginContext } from '../../../../hooks/use_plugin_context'; import { transformCreateSLOFormToCreateSLOInput } from '../../helpers/process_slo_form_values'; import { CreateSLOForm } from '../../types'; @@ -56,7 +55,7 @@ export function SLOInspectWrapper({ slo, disabled }: Props) { } function SLOInspect({ slo, disabled }: Props) { - const { share, http } = useKibana().services; + const { share, http } = useKibana().services; const { trigger, getValues } = useFormContext(); const [isFlyoutVisible, setIsFlyoutVisible] = useState(false); @@ -102,7 +101,7 @@ function SLOInspect({ slo, disabled }: Props) {

- {i18n.translate('xpack.observability.monitorInspect.configLabel', { + {i18n.translate('xpack.slo.monitorInspect.configLabel', { defaultMessage: 'SLO Configurations', })}

@@ -116,7 +115,7 @@ function SLOInspect({ slo, disabled }: Props) { - {i18n.translate('xpack.observability.sLOInspect.closeButtonLabel', { + {i18n.translate('xpack.slo.sLOInspect.closeButtonLabel', { defaultMessage: 'Close', })} @@ -204,10 +203,10 @@ function SLOInspect({ slo, disabled }: Props) { - {i18n.translate('xpack.observability.sLOInspect.sLOInspectButtonLabel', { + {i18n.translate('xpack.slo.sLOInspect.sLOInspectButtonLabel', { defaultMessage: 'SLO Inspect', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/use_field_sidebar.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/use_field_sidebar.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/use_field_sidebar.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/use_field_sidebar.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/use_table_docs.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/use_table_docs.tsx similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/use_table_docs.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/use_table_docs.tsx index 7ecc90dddcdb6..d1b17b6747fa1 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/common/use_table_docs.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/common/use_table_docs.tsx @@ -10,7 +10,7 @@ import { FieldPath, useFormContext } from 'react-hook-form'; import { DataView } from '@kbn/data-views-plugin/common'; import { TimeRange } from '@kbn/es-query'; import { QuerySchema } from '@kbn/slo-schema'; -import { getElasticsearchQueryOrThrow } from '../../../../../common/utils/parse_kuery'; +import { getElasticsearchQueryOrThrow } from '@kbn/observability-plugin/public'; import { CreateSLOForm } from '../../types'; export const useTableDocs = ({ diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_common/index_selection.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_common/index_selection.stories.tsx similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_common/index_selection.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_common/index_selection.stories.tsx index 4b8dce62f43bb..d9a8386b7ed84 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_common/index_selection.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_common/index_selection.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { FormProvider, useForm } from 'react-hook-form'; -import { KibanaReactStorybookDecorator } from '../../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { IndexSelection as Component } from './index_selection'; import { SLO_EDIT_FORM_DEFAULT_VALUES } from '../../constants'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_common/index_selection.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_common/index_selection.tsx similarity index 88% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_common/index_selection.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_common/index_selection.tsx index 45ce367c9ca79..880c15e6a67be 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_common/index_selection.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_common/index_selection.tsx @@ -11,9 +11,8 @@ import { i18n } from '@kbn/i18n'; import React, { useEffect, useState } from 'react'; import { Controller, useFormContext } from 'react-hook-form'; import { DataViewPicker } from '@kbn/unified-search-plugin/public'; +import { useFetchDataViews } from '@kbn/observability-plugin/public'; import { useKibana } from '../../../../utils/kibana_react'; -import { ObservabilityPublicPluginsStart } from '../../../..'; -import { useFetchDataViews } from '../../../../hooks/use_fetch_data_views'; import { CreateSLOForm } from '../../types'; export function IndexSelection() { @@ -22,7 +21,7 @@ export function IndexSelection() { const { isLoading: isDataViewsLoading, data: dataViews = [] } = useFetchDataViews(); - const { dataViewEditor } = useKibana().services; + const { dataViewEditor } = useKibana().services; const [adHocDataViews, setAdHocDataViews] = useState([]); @@ -116,16 +115,10 @@ export function IndexSelection() { ); } -const SELECT_DATA_VIEW = i18n.translate( - 'xpack.observability.slo.sloEdit.customKql.dataViewSelection.label', - { - defaultMessage: 'Select a Data view', - } -); +const SELECT_DATA_VIEW = i18n.translate('xpack.slo.sloEdit.customKql.dataViewSelection.label', { + defaultMessage: 'Select a Data view', +}); -const INDEX_LABEL = i18n.translate( - 'xpack.observability.slo.sloEdit.customKql.indexSelection.label', - { - defaultMessage: 'Index', - } -); +const INDEX_LABEL = i18n.translate('xpack.slo.sloEdit.customKql.indexSelection.label', { + defaultMessage: 'Index', +}); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.stories.tsx similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.stories.tsx index 5eb0b68070789..24342ce10a64c 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { FormProvider, useForm } from 'react-hook-form'; -import { KibanaReactStorybookDecorator } from '../../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { CustomKqlIndicatorTypeForm as Component } from './custom_kql_indicator_type_form'; import { SLO_EDIT_FORM_DEFAULT_VALUES } from '../../constants'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.tsx similarity index 56% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.tsx index f76dd7fabcfb2..b1dc9da27762f 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_kql/custom_kql_indicator_type_form.tsx @@ -36,13 +36,12 @@ export function CustomKqlIndicatorTypeForm() { } @@ -80,26 +75,20 @@ export function CustomKqlIndicatorTypeForm() { } @@ -110,25 +99,19 @@ export function CustomKqlIndicatorTypeForm() { } diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.stories.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.stories.tsx index 1abbff61a0dc8..499e87f04d09f 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { FormProvider, useForm } from 'react-hook-form'; -import { KibanaReactStorybookDecorator } from '../../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { CustomMetricIndicatorTypeForm as Component } from './custom_metric_type_form'; import { SLO_EDIT_FORM_DEFAULT_VALUES_CUSTOM_METRIC } from '../../constants'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.tsx similarity index 80% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.tsx index b40a7cd43227a..5dfbb381f6924 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_metric/custom_metric_type_form.tsx @@ -48,7 +48,7 @@ export function CustomMetricIndicatorTypeForm() {

@@ -63,13 +63,12 @@ export function CustomMetricIndicatorTypeForm() {

@@ -136,7 +131,7 @@ export function CustomMetricIndicatorTypeForm() {

diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_metric/metric_indicator.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_metric/metric_indicator.tsx similarity index 79% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_metric/metric_indicator.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_metric/metric_indicator.tsx index 3e077ab2280a6..de19f2f5146c9 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/custom_metric/metric_indicator.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/custom_metric/metric_indicator.tsx @@ -51,42 +51,33 @@ function createEquationFromMetric(names: string[]) { return names.join(' + '); } -const metricLabel = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.metricLabel', - { defaultMessage: 'Metric' } -); +const metricLabel = i18n.translate('xpack.slo.sloEdit.sliType.customMetric.metricLabel', { + defaultMessage: 'Metric', +}); -const filterLabel = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.filterLabel', - { defaultMessage: 'Filter' } -); +const filterLabel = i18n.translate('xpack.slo.sloEdit.sliType.customMetric.filterLabel', { + defaultMessage: 'Filter', +}); const metricTooltip = ( ); -const equationLabel = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.equationLabel', - { defaultMessage: 'Equation' } -); +const equationLabel = i18n.translate('xpack.slo.sloEdit.sliType.customMetric.equationLabel', { + defaultMessage: 'Equation', +}); const equationTooltip = ( ); @@ -145,10 +136,9 @@ export function MetricIndicator({ type, metricFields, isLoadingIndex }: MetricIn } label={ - {i18n.translate( - 'xpack.observability.slo.sloEdit.customMetric.aggregationLabel', - { defaultMessage: 'Aggregation' } - )}{' '} + {i18n.translate('xpack.slo.sloEdit.customMetric.aggregationLabel', { + defaultMessage: 'Aggregation', + })}{' '} {metric.name} } @@ -165,11 +155,11 @@ export function MetricIndicator({ type, metricFields, isLoadingIndex }: MetricIn fullWidth singleSelection={{ asPlainText: true }} placeholder={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.aggregation.placeholder', + 'xpack.slo.sloEdit.sliType.customMetric.aggregation.placeholder', { defaultMessage: 'Select an aggregation' } )} aria-label={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.aggregation.placeholder', + 'xpack.slo.sloEdit.sliType.customMetric.aggregation.placeholder', { defaultMessage: 'Select an aggregation' } )} isClearable @@ -233,11 +223,11 @@ export function MetricIndicator({ type, metricFields, isLoadingIndex }: MetricIn fullWidth singleSelection={{ asPlainText: true }} placeholder={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.metricField.placeholder', + 'xpack.slo.sloEdit.sliType.customMetric.metricField.placeholder', { defaultMessage: 'Select a metric field' } )} aria-label={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.metricField.placeholder', + 'xpack.slo.sloEdit.sliType.customMetric.metricField.placeholder', { defaultMessage: 'Select a metric field' } )} isClearable @@ -282,19 +272,15 @@ export function MetricIndicator({ type, metricFields, isLoadingIndex }: MetricIn indexPatternString={watch('indicator.params.index')} label={`${filterLabel} ${metric.name}`} name={`indicator.params.${type}.metrics.${index}.filter`} - placeholder={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.placeholder', - { defaultMessage: 'KQL filter' } - )} + placeholder={i18n.translate('xpack.slo.sloEdit.sliType.customMetric.placeholder', { + defaultMessage: 'KQL filter', + })} required={false} tooltip={ } @@ -308,14 +294,12 @@ export function MetricIndicator({ type, metricFields, isLoadingIndex }: MetricIn style={{ marginTop: '1.5em' }} onClick={handleDeleteMetric(index)} disabled={disableDelete} - title={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.deleteLabel', - { defaultMessage: 'Delete metric' } - )} - aria-label={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.deleteLabel', - { defaultMessage: 'Delete metric' } - )} + title={i18n.translate('xpack.slo.sloEdit.sliType.customMetric.deleteLabel', { + defaultMessage: 'Delete metric', + })} + aria-label={i18n.translate('xpack.slo.sloEdit.sliType.customMetric.deleteLabel', { + defaultMessage: 'Delete metric', + })} /> @@ -331,12 +315,12 @@ export function MetricIndicator({ type, metricFields, isLoadingIndex }: MetricIn onClick={handleAddMetric} isDisabled={disableAdd} aria-label={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.addMetricAriaLabel', + 'xpack.slo.sloEdit.sliType.customMetric.addMetricAriaLabel', { defaultMessage: 'Add metric' } )} > @@ -361,17 +345,14 @@ export function MetricIndicator({ type, metricFields, isLoadingIndex }: MetricIn {equationLabel} {equationTooltip} } - helpText={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.equationHelpText', - { - defaultMessage: - 'Supports basic math equations, valid charaters are: A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =', - } - )} + helpText={i18n.translate('xpack.slo.sloEdit.sliType.customMetric.equationHelpText', { + defaultMessage: + 'Supports basic math equations, valid charaters are: A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =', + })} isInvalid={fieldState.invalid} error={[ i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.customMetric.equation.invalidCharacters', + 'xpack.slo.sloEdit.sliType.customMetric.equation.invalidCharacters', { defaultMessage: 'The equation field only supports the following characters: A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =', diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/histogram/histogram_indicator.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/histogram/histogram_indicator.tsx similarity index 80% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/histogram/histogram_indicator.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/histogram/histogram_indicator.tsx index 4efcc1bfb5b8b..3cbe4dcb798e4 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/histogram/histogram_indicator.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/histogram/histogram_indicator.tsx @@ -32,13 +32,13 @@ interface HistogramIndicatorProps { const AGGREGATIONS = { value_count: { value: 'value_count', - label: i18n.translate('xpack.observability.slo.sloEdit.sliType.histogram.valueCountLabel', { + label: i18n.translate('xpack.slo.sloEdit.sliType.histogram.valueCountLabel', { defaultMessage: 'Value count', }), }, range: { value: 'range', - label: i18n.translate('xpack.observability.slo.sloEdit.sliType.histogram.rangeLabel', { + label: i18n.translate('xpack.slo.sloEdit.sliType.histogram.rangeLabel', { defaultMessage: 'Range', }), }, @@ -48,20 +48,17 @@ const AGGREGATION_OPTIONS = Object.values(AGGREGATIONS); const aggregationTooltip = ( ); const fromTooltip = ( ); -const aggregationLabel = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.histogram.aggregationLabel', - { defaultMessage: 'Aggregation' } -); +const aggregationLabel = i18n.translate('xpack.slo.sloEdit.sliType.histogram.aggregationLabel', { + defaultMessage: 'Aggregation', +}); -const metricLabel = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.histogram.metricLabel', - { defaultMessage: 'Field' } -); +const metricLabel = i18n.translate('xpack.slo.sloEdit.sliType.histogram.metricLabel', { + defaultMessage: 'Field', +}); -const toLabel = i18n.translate('xpack.observability.slo.sloEdit.sliType.histogram.toLabel', { +const toLabel = i18n.translate('xpack.slo.sloEdit.sliType.histogram.toLabel', { defaultMessage: 'To', }); -const fromLabel = i18n.translate('xpack.observability.slo.sloEdit.sliType.histogram.fromLabel', { +const fromLabel = i18n.translate('xpack.slo.sloEdit.sliType.histogram.fromLabel', { defaultMessage: 'From', }); @@ -133,11 +128,11 @@ export function HistogramIndicator({ fullWidth singleSelection={{ asPlainText: true }} placeholder={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.histogram.aggregation.placeholder', + 'xpack.slo.sloEdit.sliType.histogram.aggregation.placeholder', { defaultMessage: 'Select an aggregation' } )} aria-label={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.histogram.aggregation.placeholder', + 'xpack.slo.sloEdit.sliType.histogram.aggregation.placeholder', { defaultMessage: 'Select an aggregation' } )} isInvalid={fieldState.invalid} @@ -174,11 +169,11 @@ export function HistogramIndicator({ fullWidth singleSelection={{ asPlainText: true }} placeholder={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.histogram.metricField.placeholder', + 'xpack.slo.sloEdit.sliType.histogram.metricField.placeholder', { defaultMessage: 'Select a histogram field' } )} aria-label={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.histogram.metricField.placeholder', + 'xpack.slo.sloEdit.sliType.histogram.metricField.placeholder', { defaultMessage: 'Select a histogram field' } )} isInvalid={fieldState.invalid} @@ -288,24 +283,18 @@ export function HistogramIndicator({ } diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/histogram/histogram_indicator_type_form.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/histogram/histogram_indicator_type_form.tsx similarity index 81% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/histogram/histogram_indicator_type_form.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/histogram/histogram_indicator_type_form.tsx index 9abe0828b6695..2451dbe1baaba 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/histogram/histogram_indicator_type_form.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/histogram/histogram_indicator_type_form.tsx @@ -42,7 +42,7 @@ export function HistogramIndicatorTypeForm() {

@@ -57,13 +57,12 @@ export function HistogramIndicatorTypeForm() {

@@ -123,7 +121,7 @@ export function HistogramIndicatorTypeForm() {

diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form.stories.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form.stories.tsx index ace1088d4a3bb..9e90d5e315db8 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { FormProvider, useForm } from 'react-hook-form'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloEditForm as Component, Props } from './slo_edit_form'; import { SLO_EDIT_FORM_DEFAULT_VALUES } from '../constants'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form.tsx similarity index 92% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form.tsx index 111d4cf5243d8..6c0c90de89386 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form.tsx @@ -65,21 +65,21 @@ export function SloEditForm({ slo, initialValues, onSave }: Props) { , status: isIndicatorSectionValid ? 'complete' : 'incomplete', }, { - title: i18n.translate('xpack.observability.slo.sloEdit.objectives.title', { + title: i18n.translate('xpack.slo.sloEdit.objectives.title', { defaultMessage: 'Set objectives', }), children: showObjectiveSection ? : null, status: showObjectiveSection && isObjectiveSectionValid ? 'complete' : 'incomplete', }, { - title: i18n.translate('xpack.observability.slo.sloEdit.description.title', { + title: i18n.translate('xpack.slo.sloEdit.description.title', { defaultMessage: 'Describe SLO', }), children: showDescriptionSection ? : null, diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_description_section.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_description_section.stories.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_description_section.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_description_section.stories.tsx index 8365b8ef27545..bac591b6ec365 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_description_section.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_description_section.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { FormProvider, useForm } from 'react-hook-form'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloEditFormDescriptionSection as Component } from './slo_edit_form_description_section'; import { SLO_EDIT_FORM_DEFAULT_VALUES } from '../constants'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_description_section.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_description_section.tsx similarity index 85% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_description_section.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_description_section.tsx index 8e4e2f26ea19a..0e9af3602b9db 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_description_section.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_description_section.tsx @@ -42,7 +42,7 @@ export function SloEditFormDescriptionSection() { @@ -57,12 +57,9 @@ export function SloEditFormDescriptionSection() { isInvalid={fieldState.invalid} id={sloNameId} data-test-subj="sloFormNameInput" - placeholder={i18n.translate( - 'xpack.observability.slo.sloEdit.description.sloNamePlaceholder', - { - defaultMessage: 'Name for the SLO', - } - )} + placeholder={i18n.translate('xpack.slo.sloEdit.description.sloNamePlaceholder', { + defaultMessage: 'Name for the SLO', + })} /> )} /> @@ -72,7 +69,7 @@ export function SloEditFormDescriptionSection() { } @@ -89,7 +86,7 @@ export function SloEditFormDescriptionSection() { id={descriptionId} data-test-subj="sloFormDescriptionTextArea" placeholder={i18n.translate( - 'xpack.observability.slo.sloEdit.description.sloDescriptionPlaceholder', + 'xpack.slo.sloEdit.description.sloDescriptionPlaceholder', { defaultMessage: 'A short description of the SLO', } @@ -103,7 +100,7 @@ export function SloEditFormDescriptionSection() { @@ -117,10 +114,10 @@ export function SloEditFormDescriptionSection() { {...field} id={tagsId} fullWidth - aria-label={i18n.translate('xpack.observability.slo.sloEdit.tags.placeholder', { + aria-label={i18n.translate('xpack.slo.sloEdit.tags.placeholder', { defaultMessage: 'Add tags', })} - placeholder={i18n.translate('xpack.observability.slo.sloEdit.tags.placeholder', { + placeholder={i18n.translate('xpack.slo.sloEdit.tags.placeholder', { defaultMessage: 'Add tags', })} isInvalid={fieldState.invalid} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_footer.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_footer.tsx similarity index 86% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_footer.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_footer.tsx index 4b0e75f30c981..7a52a07c6d0b0 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_footer.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_footer.tsx @@ -11,13 +11,13 @@ import type { GetSLOResponse } from '@kbn/slo-schema'; import React, { useCallback, useMemo } from 'react'; import { useFormContext } from 'react-hook-form'; import { InPortal } from 'react-reverse-portal'; +import { useCreateRule } from '@kbn/observability-plugin/public'; +import { useKibana } from '../../../utils/kibana_react'; import { sloEditFormFooterPortal } from '../shared_flyout/slo_add_form_flyout'; import { paths } from '../../../../common/locators/paths'; -import { useCreateSlo } from '../../../hooks/slo/use_create_slo'; -import { useUpdateSlo } from '../../../hooks/slo/use_update_slo'; -import { useCreateRule } from '../../../hooks/use_create_rule'; +import { useCreateSlo } from '../../../hooks/use_create_slo'; +import { useUpdateSlo } from '../../../hooks/use_update_slo'; import { BurnRateRuleParams } from '../../../typings'; -import { useKibana } from '../../../utils/kibana_react'; import { createBurnRateRuleRequestBody } from '../helpers/create_burn_rate_rule_request_body'; import { transformCreateSLOFormToCreateSLOInput, @@ -66,7 +66,7 @@ export function SloEditFormFooter({ slo, onSave }: Props) { if (isEditMode) { const processedValues = transformValuesToUpdateSLOInput(values); await updateSlo({ sloId: slo.id, slo: processedValues }); - navigate(basePath.prepend(paths.observability.slos)); + navigate(basePath.prepend(paths.slos)); } else { const processedValues = transformCreateSLOFormToCreateSLOInput(values); const resp = await createSlo({ slo: processedValues }); @@ -76,7 +76,7 @@ export function SloEditFormFooter({ slo, onSave }: Props) { if (onSave) { onSave(); } else { - navigate(basePath.prepend(paths.observability.slos)); + navigate(basePath.prepend(paths.slos)); } } }, [ @@ -104,10 +104,10 @@ export function SloEditFormFooter({ slo, onSave }: Props) { onClick={handleSubmit} > {isEditMode - ? i18n.translate('xpack.observability.slo.sloEdit.editSloButton', { + ? i18n.translate('xpack.slo.sloEdit.editSloButton', { defaultMessage: 'Update SLO', }) - : i18n.translate('xpack.observability.slo.sloEdit.createSloButton', { + : i18n.translate('xpack.slo.sloEdit.createSloButton', { defaultMessage: 'Create SLO', })} @@ -117,13 +117,9 @@ export function SloEditFormFooter({ slo, onSave }: Props) { color="primary" data-test-subj="sloFormCancelButton" disabled={isCreateSloLoading || isUpdateSloLoading || isCreateBurnRateRuleLoading} - onClick={ - onSave - ? () => onSave() - : () => navigateToUrl(basePath.prepend(paths.observability.slos)) - } + onClick={onSave ? () => onSave() : () => navigateToUrl(basePath.prepend(paths.slos))} > - {i18n.translate('xpack.observability.slo.sloEdit.cancelButton', { + {i18n.translate('xpack.slo.sloEdit.cancelButton', { defaultMessage: 'Cancel', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_indicator_section.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_indicator_section.tsx similarity index 97% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_indicator_section.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_indicator_section.tsx index 099ae458a8ca4..156f45c2c982c 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_indicator_section.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_indicator_section.tsx @@ -86,6 +86,6 @@ export function SloEditFormIndicatorSection({ isEditMode }: SloEditFormIndicator ); } -const indicatorLabel = i18n.translate('xpack.observability.slo.sloEdit.definition.sliType', { +const indicatorLabel = i18n.translate('xpack.slo.sloEdit.definition.sliType', { defaultMessage: 'Choose the SLI type', }); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_objective_section.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.stories.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_objective_section.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.stories.tsx index ee2938321d136..8f5a0e73d424c 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_objective_section.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.stories.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { FormProvider, useForm } from 'react-hook-form'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloEditFormObjectiveSection as Component } from './slo_edit_form_objective_section'; import { SLO_EDIT_FORM_DEFAULT_VALUES } from '../constants'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_objective_section.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.tsx similarity index 84% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_objective_section.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.tsx index 073248d844fed..ad8baf52be88f 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/slo_edit_form_objective_section.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/slo_edit_form_objective_section.tsx @@ -97,16 +97,13 @@ export function SloEditFormObjectiveSection() { - {i18n.translate('xpack.observability.slo.sloEdit.timeWindowType.label', { + {i18n.translate('xpack.slo.sloEdit.timeWindowType.label', { defaultMessage: 'Time window', })}{' '} @@ -133,16 +130,13 @@ export function SloEditFormObjectiveSection() { - {i18n.translate('xpack.observability.slo.sloEdit.timeWindowDuration.label', { + {i18n.translate('xpack.slo.sloEdit.timeWindowDuration.label', { defaultMessage: 'Duration', })}{' '} @@ -177,7 +171,7 @@ export function SloEditFormObjectiveSection() {

@@ -191,7 +185,7 @@ export function SloEditFormObjectiveSection() {

@@ -205,17 +199,14 @@ export function SloEditFormObjectiveSection() { - {i18n.translate('xpack.observability.slo.sloEdit.budgetingMethod.label', { + {i18n.translate('xpack.slo.sloEdit.budgetingMethod.label', { defaultMessage: 'Budgeting method', })}{' '} @@ -255,11 +246,11 @@ export function SloEditFormObjectiveSection() { isInvalid={getFieldState('objective.target').invalid} label={ - {i18n.translate('xpack.observability.slo.sloEdit.targetSlo.label', { + {i18n.translate('xpack.slo.sloEdit.targetSlo.label', { defaultMessage: 'Target / SLO (%)', })}{' '} - {i18n.translate('xpack.observability.slo.sloEdit.timeSliceTarget.label', { + {i18n.translate('xpack.slo.sloEdit.timeSliceTarget.label', { defaultMessage: 'Timeslice target (%)', })}{' '} - {i18n.translate('xpack.observability.slo.sloEdit.timesliceWindow.label', { + {i18n.translate('xpack.slo.sloEdit.timesliceWindow.label', { defaultMessage: 'Timeslice window (in minutes)', })}{' '} } /> } @@ -141,9 +132,6 @@ export function SyntheticsAvailabilityIndicatorTypeForm() { ); } -const LABEL = i18n.translate( - 'xpack.observability.slo.sloEdit.dataPreviewChart.syntheticsAvailability.xTitle', - { - defaultMessage: 'Last 24 hours', - } -); +const LABEL = i18n.translate('xpack.slo.sloEdit.dataPreviewChart.syntheticsAvailability.xTitle', { + defaultMessage: 'Last 24 hours', +}); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/synthetics_common/field_selector.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/synthetics_common/field_selector.tsx similarity index 95% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/synthetics_common/field_selector.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/synthetics_common/field_selector.tsx index 1f4b27b3b135f..5bc77b186f960 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/synthetics_common/field_selector.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/synthetics_common/field_selector.tsx @@ -15,7 +15,7 @@ import { OptionalText } from '../common/optional_text'; import { useFetchSyntheticsSuggestions, Suggestion, -} from '../../../../hooks/slo/use_fetch_synthetics_suggestions'; +} from '../../../../hooks/use_fetch_synthetics_suggestions'; import { CreateSLOForm } from '../../types'; interface Option { @@ -62,9 +62,7 @@ export function FieldSelector({ const ALL_VALUE_OPTION = { value: ALL_VALUE, - label: i18n.translate('xpack.observability.slo.sloEdit.fieldSelector.all', { - defaultMessage: 'All', - }), + label: i18n.translate('xpack.slo.fieldSelector.all', { defaultMessage: 'All' }), }; const options = (allowAllOption ? [ALL_VALUE_OPTION] : []).concat(createOptions(suggestions)); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/timeslice_metric/metric_indicator.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/timeslice_metric/metric_indicator.tsx similarity index 82% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/timeslice_metric/metric_indicator.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/timeslice_metric/metric_indicator.tsx index d3098208fa6c1..cc10844c3c9d7 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/timeslice_metric/metric_indicator.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/timeslice_metric/metric_indicator.tsx @@ -48,39 +48,29 @@ function createEquationFromMetric(names: string[]) { return names.join(' + '); } -const equationLabel = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.equationLabel', - { defaultMessage: 'Equation' } -); +const equationLabel = i18n.translate('xpack.slo.sloEdit.sliType.timesliceMetric.equationLabel', { + defaultMessage: 'Equation', +}); const equationTooltip = ( ); -const thresholdLabel = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.thresholdLabel', - { - defaultMessage: 'Threshold', - } -); +const thresholdLabel = i18n.translate('xpack.slo.sloEdit.sliType.timesliceMetric.thresholdLabel', { + defaultMessage: 'Threshold', +}); const thresholdTooltip = ( ); @@ -140,12 +130,11 @@ export function MetricIndicator({ indexFields, isLoadingIndex }: MetricIndicator style={{ marginTop: '1.5em' }} onClick={handleDeleteMetric(index)} disabled={disableDelete} - title={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.deleteLabel', - { defaultMessage: 'Delete metric' } - )} + title={i18n.translate('xpack.slo.sloEdit.sliType.timesliceMetric.deleteLabel', { + defaultMessage: 'Delete metric', + })} aria-label={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.deleteLabel', + 'xpack.slo.sloEdit.sliType.timesliceMetric.deleteLabel', { defaultMessage: 'Delete metric' } )} /> @@ -165,12 +154,12 @@ export function MetricIndicator({ indexFields, isLoadingIndex }: MetricIndicator onClick={handleAddMetric} isDisabled={disableAdd} aria-label={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.addMetricAriaLabel', + 'xpack.slo.sloEdit.sliType.timesliceMetric.addMetricAriaLabel', { defaultMessage: 'Add metric' } )} > @@ -200,7 +189,7 @@ export function MetricIndicator({ indexFields, isLoadingIndex }: MetricIndicator isInvalid={fieldState.invalid} error={[ i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.equation.invalidCharacters', + 'xpack.slo.sloEdit.sliType.timesliceMetric.equation.invalidCharacters', { defaultMessage: 'The equation field only supports the following characters: A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =', @@ -233,7 +222,7 @@ export function MetricIndicator({ indexFields, isLoadingIndex }: MetricIndicator fullWidth isInvalid={fieldState.invalid} label={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.comparatorLabel', + 'xpack.slo.sloEdit.sliType.timesliceMetric.comparatorLabel', { defaultMessage: 'Comparator', } @@ -288,13 +277,10 @@ export function MetricIndicator({ indexFields, isLoadingIndex }: MetricIndicator

- {i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.equationHelpText', - { - defaultMessage: - 'Supports basic math equations, valid charaters are: A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =', - } - )} + {i18n.translate('xpack.slo.sloEdit.sliType.timesliceMetric.equationHelpText', { + defaultMessage: + 'Supports basic math equations, valid charaters are: A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =', + })}

diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/timeslice_metric/metric_input.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/timeslice_metric/metric_input.tsx similarity index 86% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/timeslice_metric/metric_input.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/timeslice_metric/metric_input.tsx index 22cbc42366baa..f4cb60d81daf2 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/components/timeslice_metric/metric_input.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/components/timeslice_metric/metric_input.tsx @@ -21,29 +21,24 @@ import { createOptionsFromFields, Option } from '../../helpers/create_options'; import { CreateSLOForm } from '../../types'; import { QueryBuilder } from '../common/query_builder'; -const fieldLabel = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.fieldLabel', - { defaultMessage: 'Field' } -); +const fieldLabel = i18n.translate('xpack.slo.sloEdit.sliType.timesliceMetric.fieldLabel', { + defaultMessage: 'Field', +}); const aggregationLabel = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.aggregationLabel', + 'xpack.slo.sloEdit.sliType.timesliceMetric.aggregationLabel', { defaultMessage: 'Aggregation' } ); -const filterLabel = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.filterLabel', - { defaultMessage: 'Filter' } -); +const filterLabel = i18n.translate('xpack.slo.sloEdit.sliType.timesliceMetric.filterLabel', { + defaultMessage: 'Filter', +}); const fieldTooltip = ( ); @@ -113,11 +108,11 @@ export function MetricInput({ isClearable={false} singleSelection={{ asPlainText: true }} placeholder={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.aggregationField.placeholder', + 'xpack.slo.sloEdit.sliType.timesliceMetric.aggregationField.placeholder', { defaultMessage: 'Select an aggregation' } )} aria-label={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.aggregationField.placeholder', + 'xpack.slo.sloEdit.sliType.timesliceMetric.aggregationField.placeholder', { defaultMessage: 'Select an aggregation' } )} isInvalid={fieldState.invalid} @@ -170,10 +165,9 @@ export function MetricInput({ isInvalid={fieldState.invalid} label={ - {i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.percentileLabel', - { defaultMessage: 'Percentile' } - )}{' '} + {i18n.translate('xpack.slo.sloEdit.sliType.timesliceMetric.percentileLabel', { + defaultMessage: 'Percentile', + })}{' '} {metric.name} } @@ -221,11 +215,11 @@ export function MetricInput({ fullWidth singleSelection={{ asPlainText: true }} placeholder={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.metricField.placeholder', + 'xpack.slo.sloEdit.sliType.timesliceMetric.metricField.placeholder', { defaultMessage: 'Select a metric field' } )} aria-label={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.metricField.placeholder', + 'xpack.slo.sloEdit.sliType.timesliceMetric.metricField.placeholder', { defaultMessage: 'Select a metric field' } )} isInvalid={fieldState.invalid} @@ -270,14 +264,14 @@ export function MetricInput({ label={`${filterLabel} ${metric.name}`} name={`indicator.params.metric.metrics.${index}.filter`} placeholder={i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.goodQuery.placeholder', + 'xpack.slo.sloEdit.sliType.timesliceMetric.goodQuery.placeholder', { defaultMessage: 'KQL filter' } )} required={false} tooltip={

- +

@@ -65,13 +62,12 @@ export function TimesliceMetricIndicatorTypeForm() {

diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/constants.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/constants.ts similarity index 83% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/constants.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/constants.ts index 9ad1e622a2fa5..0259095558a6d 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/constants.ts +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/constants.ts @@ -30,7 +30,7 @@ import { INDICATOR_HISTOGRAM, INDICATOR_TIMESLICE_METRIC, } from '../../utils/slo/labels'; -import { SYNTHETICS_INDEX_PATTERN } from '../../../common/slo/constants'; +import { SYNTHETICS_INDEX_PATTERN } from '../../../common/constants'; import { CreateSLOForm } from './types'; export const SLI_OPTIONS: Array<{ @@ -81,13 +81,13 @@ export const BUDGETING_METHOD_OPTIONS: Array<{ value: BudgetingMethod; text: str export const TIMEWINDOW_TYPE_OPTIONS: Array<{ value: TimeWindow; text: string }> = [ { value: 'rolling', - text: i18n.translate('xpack.observability.slo.sloEdit.timeWindow.rolling', { + text: i18n.translate('xpack.slo.sloEdit.timeWindow.rolling', { defaultMessage: 'Rolling', }), }, { value: 'calendarAligned', - text: i18n.translate('xpack.observability.slo.sloEdit.timeWindow.calendarAligned', { + text: i18n.translate('xpack.slo.sloEdit.timeWindow.calendarAligned', { defaultMessage: 'Calendar aligned', }), }, @@ -96,13 +96,13 @@ export const TIMEWINDOW_TYPE_OPTIONS: Array<{ value: TimeWindow; text: string }> export const CALENDARALIGNED_TIMEWINDOW_OPTIONS = [ { value: '1w', - text: i18n.translate('xpack.observability.slo.sloEdit.calendarTimeWindow.weekly', { + text: i18n.translate('xpack.slo.sloEdit.calendarTimeWindow.weekly', { defaultMessage: 'Weekly', }), }, { value: '1M', - text: i18n.translate('xpack.observability.slo.sloEdit.calendarTimeWindow.monthly', { + text: i18n.translate('xpack.slo.sloEdit.calendarTimeWindow.monthly', { defaultMessage: 'Monthly', }), }, @@ -110,7 +110,7 @@ export const CALENDARALIGNED_TIMEWINDOW_OPTIONS = [ export const ROLLING_TIMEWINDOW_OPTIONS = [90, 30, 7].map((number) => ({ value: `${number}d`, - text: i18n.translate('xpack.observability.slo.sloEdit.rollingTimeWindow.days', { + text: i18n.translate('xpack.slo.sloEdit.rollingTimeWindow.days', { defaultMessage: '{number} days', values: { number }, }), @@ -253,33 +253,21 @@ export const SLO_EDIT_FORM_DEFAULT_VALUES_SYNTHETICS_AVAILABILITY: CreateSLOForm groupBy: ['monitor.name', 'observer.geo.name'], }; -export const COMPARATOR_GT = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.gtLabel', - { - defaultMessage: 'Greater than', - } -); +export const COMPARATOR_GT = i18n.translate('xpack.slo.sloEdit.sliType.timesliceMetric.gtLabel', { + defaultMessage: 'Greater than', +}); -export const COMPARATOR_GTE = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.gteLabel', - { - defaultMessage: 'Greater than or equal to', - } -); +export const COMPARATOR_GTE = i18n.translate('xpack.slo.sloEdit.sliType.timesliceMetric.gteLabel', { + defaultMessage: 'Greater than or equal to', +}); -export const COMPARATOR_LT = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.ltLabel', - { - defaultMessage: 'Less than', - } -); +export const COMPARATOR_LT = i18n.translate('xpack.slo.sloEdit.sliType.timesliceMetric.ltLabel', { + defaultMessage: 'Less than', +}); -export const COMPARATOR_LTE = i18n.translate( - 'xpack.observability.slo.sloEdit.sliType.timesliceMetric.lteLabel', - { - defaultMessage: 'Less than or equal to', - } -); +export const COMPARATOR_LTE = i18n.translate('xpack.slo.sloEdit.sliType.timesliceMetric.lteLabel', { + defaultMessage: 'Less than or equal to', +}); export const COMPARATOR_MAPPING = { GT: COMPARATOR_GT, diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/__snapshots__/process_slo_form_values.test.ts.snap b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/__snapshots__/process_slo_form_values.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/__snapshots__/process_slo_form_values.test.ts.snap rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/__snapshots__/process_slo_form_values.test.ts.snap diff --git a/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/aggregation_options.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/aggregation_options.ts new file mode 100644 index 0000000000000..d116ad5f0f138 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/aggregation_options.ts @@ -0,0 +1,76 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +export const AGGREGATION_OPTIONS = [ + { + value: 'avg', + label: i18n.translate('xpack.slo.sloEdit.timesliceMetric.aggregation.average', { + defaultMessage: 'Average', + }), + }, + { + value: 'max', + label: i18n.translate('xpack.slo.sloEdit.timesliceMetric.aggregation.max', { + defaultMessage: 'Max', + }), + }, + { + value: 'min', + label: i18n.translate('xpack.slo.sloEdit.timesliceMetric.aggregation.min', { + defaultMessage: 'Min', + }), + }, + { + value: 'sum', + label: i18n.translate('xpack.slo.sloEdit.timesliceMetric.aggregation.sum', { + defaultMessage: 'Sum', + }), + }, + { + value: 'cardinality', + label: i18n.translate('xpack.slo.sloEdit.timesliceMetric.aggregation.cardinality', { + defaultMessage: 'Cardinality', + }), + }, + { + value: 'last_value', + label: i18n.translate('xpack.slo.sloEdit.timesliceMetric.aggregation.last_value', { + defaultMessage: 'Last value', + }), + }, + { + value: 'std_deviation', + label: i18n.translate('xpack.slo.sloEdit.timesliceMetric.aggregation.std_deviation', { + defaultMessage: 'Std. Deviation', + }), + }, + { + value: 'doc_count', + label: i18n.translate('xpack.slo.sloEdit.timesliceMetric.aggregation.doc_count', { + defaultMessage: 'Doc count', + }), + }, + { + value: 'percentile', + label: i18n.translate('xpack.slo.sloEdit.timesliceMetric.aggregation.percentile', { + defaultMessage: 'Percentile', + }), + }, +]; + +export const CUSTOM_METRIC_AGGREGATION_OPTIONS = AGGREGATION_OPTIONS.filter((option) => + ['doc_count', 'sum'].includes(option.value) +); + +export function aggValueToLabel(value: string) { + const aggregation = AGGREGATION_OPTIONS.find((agg) => agg.value === value); + if (aggregation) { + return aggregation.label; + } + return value; +} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/create_burn_rate_rule_request_body.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/create_burn_rate_rule_request_body.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/create_burn_rate_rule_request_body.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/create_burn_rate_rule_request_body.ts index 0128d6c7d6360..da1ce026a1525 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/create_burn_rate_rule_request_body.ts +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/create_burn_rate_rule_request_body.ts @@ -30,7 +30,7 @@ export function createBurnRateRuleRequestBody( consumer: 'slo', schedule: { interval: '1m' }, tags: [], - name: i18n.translate('xpack.observability.slo.burnRateRule.name', { + name: i18n.translate('xpack.slo.burnRateRule.name', { defaultMessage: '{name} Burn Rate rule', values: { name: slo.name }, }), diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/create_options.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/create_options.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/create_options.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/create_options.ts diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/process_slo_form_values.test.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/process_slo_form_values.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/process_slo_form_values.test.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/process_slo_form_values.test.ts diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/process_slo_form_values.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/process_slo_form_values.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/helpers/process_slo_form_values.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/helpers/process_slo_form_values.ts diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_add_rule_flyout_state.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_add_rule_flyout_state.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_add_rule_flyout_state.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_add_rule_flyout_state.ts diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_parse_url_state.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_parse_url_state.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_parse_url_state.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_parse_url_state.ts diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_preview.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_preview.ts similarity index 93% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_preview.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_preview.ts index 146fe5ec737d7..8d21ac3938b8d 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_preview.ts +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_preview.ts @@ -8,7 +8,7 @@ import { Indicator } from '@kbn/slo-schema'; import { debounce } from 'lodash'; import { useCallback, useEffect, useState } from 'react'; -import { useGetPreviewData } from '../../../hooks/slo/use_get_preview_data'; +import { useGetPreviewData } from '../../../hooks/use_get_preview_data'; export function useDebouncedGetPreviewData( isIndicatorValid: boolean, diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_section_form_validation.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_section_form_validation.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_section_form_validation.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_section_form_validation.ts diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_show_sections.test.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_show_sections.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_show_sections.test.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_show_sections.test.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_show_sections.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_show_sections.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_show_sections.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_show_sections.ts diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_unregister_fields.ts b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_unregister_fields.ts similarity index 98% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_unregister_fields.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_unregister_fields.ts index 11d0ed133f7de..9d7752f190344 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/hooks/use_unregister_fields.ts +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/hooks/use_unregister_fields.ts @@ -10,7 +10,7 @@ import { assertNever } from '@kbn/std'; import deepmerge from 'deepmerge'; import { useEffect, useState } from 'react'; import { useFormContext } from 'react-hook-form'; -import { useFetchApmIndex } from '../../../hooks/slo/use_fetch_apm_indices'; +import { useFetchApmIndex } from '../../../hooks/use_fetch_apm_indices'; import { APM_AVAILABILITY_DEFAULT_VALUES, APM_LATENCY_DEFAULT_VALUES, diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/shared_flyout/get_create_slo_flyout.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/shared_flyout/get_create_slo_flyout.tsx similarity index 86% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/shared_flyout/get_create_slo_flyout.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/shared_flyout/get_create_slo_flyout.tsx index 085e6a176b68d..b7d3dd47819c2 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/shared_flyout/get_create_slo_flyout.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/shared_flyout/get_create_slo_flyout.tsx @@ -13,15 +13,14 @@ import { CoreStart } from '@kbn/core-lifecycle-browser'; import { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { RecursivePartial } from '@kbn/utility-types'; +import { ObservabilityRuleTypeRegistry } from '@kbn/observability-plugin/public'; import { CreateSLOForm } from '../types'; -import { PluginContext } from '../../../context/plugin_context/plugin_context'; -import { ObservabilityRuleTypeRegistry } from '../../..'; -import { ObservabilityPublicPluginsStart, ConfigSchema } from '../../../plugin'; +import { PluginContext } from '../../../context/plugin_context'; +import { SloPublicPluginsStart } from '../../../types'; import { SloAddFormFlyout } from './slo_form'; export const getCreateSLOFlyoutLazy = ({ core, - config, plugins, observabilityRuleTypeRegistry, ObservabilityPageTemplate, @@ -30,8 +29,7 @@ export const getCreateSLOFlyoutLazy = ({ isServerless, }: { core: CoreStart; - config: ConfigSchema; - plugins: ObservabilityPublicPluginsStart; + plugins: SloPublicPluginsStart; observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry; ObservabilityPageTemplate: React.ComponentType; isDev?: boolean; @@ -60,7 +58,6 @@ export const getCreateSLOFlyoutLazy = ({

- +

diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/shared_flyout/slo_form.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/shared_flyout/slo_form.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/shared_flyout/slo_form.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/shared_flyout/slo_form.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/slo_edit.test.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/slo_edit.test.tsx similarity index 93% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/slo_edit.test.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/slo_edit.test.tsx index 78a99d80790d7..8925c22f82050 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/slo_edit.test.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/slo_edit.test.tsx @@ -15,19 +15,19 @@ import Router from 'react-router-dom'; import { BehaviorSubject } from 'rxjs'; import { paths } from '../../../common/locators/paths'; import { buildSlo } from '../../data/slo/slo'; -import { useCapabilities } from '../../hooks/slo/use_capabilities'; -import { useCreateSlo } from '../../hooks/slo/use_create_slo'; -import { useFetchApmSuggestions } from '../../hooks/slo/use_fetch_apm_suggestions'; -import { useFetchSloDetails } from '../../hooks/slo/use_fetch_slo_details'; -import { useUpdateSlo } from '../../hooks/slo/use_update_slo'; -import { useCreateRule } from '../../hooks/use_create_rule'; -import { useFetchDataViews } from '../../hooks/use_fetch_data_views'; +import { useCapabilities } from '../../hooks/use_capabilities'; +import { useCreateSlo } from '../../hooks/use_create_slo'; +import { useFetchApmSuggestions } from '../../hooks/use_fetch_apm_suggestions'; +import { useFetchSloDetails } from '../../hooks/use_fetch_slo_details'; +import { useUpdateSlo } from '../../hooks/use_update_slo'; +import { useCreateRule, useFetchDataViews } from '@kbn/observability-plugin/public'; import { useFetchIndices } from '../../hooks/use_fetch_indices'; import { useKibana } from '../../utils/kibana_react'; import { kibanaStartMock } from '../../utils/kibana_react.mock'; import { render } from '../../utils/test_helper'; import { SLO_EDIT_FORM_DEFAULT_VALUES } from './constants'; import { SloEditPage } from './slo_edit'; +import { HeaderMenuPortal } from '@kbn/observability-shared-plugin/public'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), @@ -36,13 +36,12 @@ jest.mock('react-router-dom', () => ({ jest.mock('@kbn/observability-shared-plugin/public'); jest.mock('../../hooks/use_fetch_indices'); -jest.mock('../../hooks/use_fetch_data_views'); -jest.mock('../../hooks/slo/use_fetch_slo_details'); -jest.mock('../../hooks/slo/use_create_slo'); -jest.mock('../../hooks/slo/use_update_slo'); -jest.mock('../../hooks/use_create_rule'); -jest.mock('../../hooks/slo/use_fetch_apm_suggestions'); -jest.mock('../../hooks/slo/use_capabilities'); +jest.mock('../../hooks/use_fetch_slo_details'); +jest.mock('../../hooks/use_create_slo'); +jest.mock('../../hooks/use_update_slo'); +jest.mock('@kbn/observability-plugin/public'); +jest.mock('../../hooks/use_fetch_apm_suggestions'); +jest.mock('../../hooks/use_capabilities'); const mockUseKibanaReturnValue = kibanaStartMock.startContract(); @@ -60,6 +59,9 @@ const useCreateRuleMock = useCreateRule as jest.Mock; const useFetchApmSuggestionsMock = useFetchApmSuggestions as jest.Mock; const useCapabilitiesMock = useCapabilities as jest.Mock; +const HeaderMenuPortalMock = HeaderMenuPortal as jest.Mock; +HeaderMenuPortalMock.mockReturnValue(
Portal node
); + const mockAddSuccess = jest.fn(); const mockAddError = jest.fn(); const mockNavigate = jest.fn(); @@ -204,7 +206,7 @@ describe('SLO Edit Page', () => { render(); - expect(mockNavigate).toBeCalledWith(mockBasePathPrepend(paths.observability.slos)); + expect(mockNavigate).toBeCalledWith(mockBasePathPrepend(paths.slos)); }); }); @@ -227,7 +229,7 @@ describe('SLO Edit Page', () => { render(); - expect(mockNavigate).not.toBeCalledWith(mockBasePathPrepend(paths.observability.slos)); + expect(mockNavigate).not.toBeCalledWith(mockBasePathPrepend(paths.slos)); }); }); @@ -258,7 +260,7 @@ describe('SLO Edit Page', () => { render(); - expect(mockNavigate).toBeCalledWith(mockBasePathPrepend(paths.observability.slos)); + expect(mockNavigate).toBeCalledWith(mockBasePathPrepend(paths.slos)); }); }); @@ -423,7 +425,7 @@ describe('SLO Edit Page', () => { fireEvent.click(getByTestId('sloFormSubmitButton')); }); await waitFor(() => { - expect(mockNavigate).toBeCalledWith(mockBasePathPrepend(paths.observability.slos)); + expect(mockNavigate).toBeCalledWith(mockBasePathPrepend(paths.slos)); }); }); }); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/slo_edit.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/slo_edit.tsx similarity index 68% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_edit/slo_edit.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_edit/slo_edit.tsx index 09eafbfdcc8c7..09f3b257e6542 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_edit/slo_edit.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_edit/slo_edit.tsx @@ -9,14 +9,14 @@ import { i18n } from '@kbn/i18n'; import { useBreadcrumbs } from '@kbn/observability-shared-plugin/public'; import React from 'react'; import { useParams } from 'react-router-dom'; +import { HeaderMenu } from '../../components/header_menu/header_menu'; +import { useKibana } from '../../utils/kibana_react'; import { paths } from '../../../common/locators/paths'; -import { useCapabilities } from '../../hooks/slo/use_capabilities'; -import { useFetchSloGlobalDiagnosis } from '../../hooks/slo/use_fetch_global_diagnosis'; -import { useFetchSloDetails } from '../../hooks/slo/use_fetch_slo_details'; +import { useCapabilities } from '../../hooks/use_capabilities'; +import { useFetchSloGlobalDiagnosis } from '../../hooks/use_fetch_global_diagnosis'; +import { useFetchSloDetails } from '../../hooks/use_fetch_slo_details'; import { useLicense } from '../../hooks/use_license'; import { usePluginContext } from '../../hooks/use_plugin_context'; -import { useKibana } from '../../utils/kibana_react'; -import { HeaderMenu } from '../overview/components/header_menu/header_menu'; import { SloEditForm } from './components/slo_edit_form'; export function SloEditPage() { @@ -35,43 +35,43 @@ export function SloEditPage() { useBreadcrumbs([ { - href: basePath.prepend(paths.observability.slos), - text: i18n.translate('xpack.observability.breadcrumbs.sloLabel', { + href: basePath.prepend(paths.slos), + text: i18n.translate('xpack.slo.breadcrumbs.sloLabel', { defaultMessage: 'SLOs', }), - deepLinkId: 'observability-overview:slos', + deepLinkId: 'slo', }, ...(!!slo ? [ { - href: basePath.prepend(paths.observability.sloDetails(slo!.id)), + href: basePath.prepend(paths.sloDetails(slo!.id)), text: slo!.name, }, ] : []), { text: slo - ? i18n.translate('xpack.observability.breadcrumbs.sloEditLabel', { + ? i18n.translate('xpack.slo.breadcrumbs.sloEditLabel', { defaultMessage: 'Edit', }) - : i18n.translate('xpack.observability.breadcrumbs.sloCreateLabel', { + : i18n.translate('xpack.slo.breadcrumbs.sloCreateLabel', { defaultMessage: 'Create', }), }, ]); if (hasRightLicense === false || !hasWriteCapabilities || hasErrorInGlobalDiagnosis) { - navigateToUrl(basePath.prepend(paths.observability.slos)); + navigateToUrl(basePath.prepend(paths.slos)); } return ( - {i18n.translate('xpack.observability.slo.slosOutdatedDefinitions.sloPermissionsError', { + {i18n.translate('xpack.slo.slosOutdatedDefinitions.sloPermissionsError', { defaultMessage: 'You must have write permissions for SLOs to access this page', })} ) : !hasPlatinumLicense ? ( - {i18n.translate('xpack.observability.slo.slosOutdatedDefinitions.licenseError', { + {i18n.translate('xpack.slo.slosOutdatedDefinitions.licenseError', { defaultMessage: 'You must have atleast a platinum license to access this page', })} @@ -89,7 +89,7 @@ export function SlosOutdatedDefinitions() {

- {i18n.translate('xpack.observability.slo.slosOutdatedDefinitions.description', { + {i18n.translate('xpack.slo.slosOutdatedDefinitions.description', { defaultMessage: 'The following SLOs are from a previous version and need to either be reset to upgrade to the latest version OR deleted and removed from the system. When you reset the SLO, the transform will be updated to the latest version and the historical data will be regenerated from the source data.', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_outdated_definitions/outdated_slo.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/outdated_slo.tsx similarity index 93% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_outdated_definitions/outdated_slo.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/outdated_slo.tsx index f8f5cfeb46848..ad38471a15095 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_outdated_definitions/outdated_slo.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/outdated_slo.tsx @@ -11,8 +11,8 @@ import { SLOResponse } from '@kbn/slo-schema'; import { SloDeleteConfirmationModal } from '../../components/slo/delete_confirmation_modal/slo_delete_confirmation_modal'; import { SloTimeWindowBadge } from '../slos/components/badges/slo_time_window_badge'; import { SloIndicatorTypeBadge } from '../slos/components/badges/slo_indicator_type_badge'; -import { useDeleteSlo } from '../../hooks/slo/use_delete_slo'; -import { useResetSlo } from '../../hooks/slo/use_reset_slo'; +import { useDeleteSlo } from '../../hooks/use_delete_slo'; +import { useResetSlo } from '../../hooks/use_reset_slo'; import { SloResetConfirmationModal } from '../../components/slo/reset_confirmation_modal/slo_reset_confirmation_modal'; interface OutdatedSloProps { @@ -85,7 +85,7 @@ export function OutdatedSlo({ slo, onReset, onDelete }: OutdatedSloProps) { onClick={handleReset} > @@ -99,7 +99,7 @@ export function OutdatedSlo({ slo, onReset, onDelete }: OutdatedSloProps) { onClick={handleDelete} > diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slo_outdated_definitions/outdated_slo_search_bar.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/outdated_slo_search_bar.tsx similarity index 92% rename from x-pack/plugins/observability_solution/observability/public/pages/slo_outdated_definitions/outdated_slo_search_bar.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/outdated_slo_search_bar.tsx index 7e491f4933e20..0284ac8e7403e 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slo_outdated_definitions/outdated_slo_search_bar.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slo_outdated_definitions/outdated_slo_search_bar.tsx @@ -58,7 +58,7 @@ export function OutdatedSloSearchBar({ iconType="refresh" onClick={refreshOrUpdateSearch} > - {i18n.translate('xpack.observability.slosOutdatedDefinitions.refreshButtonLabel', { + {i18n.translate('xpack.slo.slosOutdatedDefinitions.refreshButtonLabel', { defaultMessage: 'Refresh', })} @@ -71,7 +71,7 @@ export function OutdatedSloSearchBar({ fill onClick={refreshOrUpdateSearch} > - {i18n.translate('xpack.observability.slosOutdatedDefinitions.updateButtonLabel', { + {i18n.translate('xpack.slo.slosOutdatedDefinitions.updateButtonLabel', { defaultMessage: 'Update', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_badges.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_badges.stories.tsx similarity index 90% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_badges.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_badges.stories.tsx index 67869e7f0e76e..7c84e7e570b3b 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_badges.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_badges.stories.tsx @@ -9,8 +9,8 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { EuiFlexGroup } from '@elastic/eui'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { buildForecastedSlo } from '../../../../data/slo/slo'; -import { KibanaReactStorybookDecorator } from '../../../../utils/kibana_react.storybook_decorator'; import { SloBadges as Component, SloBadgesProps } from './slo_badges'; export default { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_badges.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_badges.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_badges.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_badges.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_indicator_type_badge.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_indicator_type_badge.stories.tsx similarity index 93% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_indicator_type_badge.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_indicator_type_badge.stories.tsx index c8536bdc93ddd..727189580382b 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_indicator_type_badge.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_indicator_type_badge.stories.tsx @@ -9,12 +9,12 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; import { EuiFlexGroup } from '@elastic/eui'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { buildCustomKqlIndicator, buildApmAvailabilityIndicator, buildApmLatencyIndicator, } from '../../../../data/slo/indicator'; -import { KibanaReactStorybookDecorator } from '../../../../utils/kibana_react.storybook_decorator'; import { SloIndicatorTypeBadge as Component, Props } from './slo_indicator_type_badge'; import { buildSlo } from '../../../../data/slo/slo'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_indicator_type_badge.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_indicator_type_badge.tsx similarity index 81% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_indicator_type_badge.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_indicator_type_badge.tsx index 0196b1e174f77..727c3af91e5f5 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_indicator_type_badge.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_indicator_type_badge.tsx @@ -59,13 +59,10 @@ export function SloIndicatorTypeBadge({ slo, color }: Props) { onMouseDown={(e: MouseEvent) => { if (isSloPage) e.stopPropagation(); // stops propagation of metric onElementClick }} - onClickAriaLabel={i18n.translate( - 'xpack.observability.slo.indicatorTypeBadge.clickToFilter', - { - defaultMessage: 'Click to filter by {indicatorType} SLOs', - values: { indicatorType: toIndicatorTypeLabel(slo.indicator.type) }, - } - )} + onClickAriaLabel={i18n.translate('xpack.slo.sloIndicatorTypeBadge.clickToFilter', { + defaultMessage: 'Click to filter by {indicatorType} SLOs', + values: { indicatorType: toIndicatorTypeLabel(slo.indicator.type) }, + })} > {toIndicatorTypeLabel(slo.indicator.type)} @@ -75,7 +72,7 @@ export function SloIndicatorTypeBadge({ slo, color }: Props) { ) => { e.stopPropagation(); // stops propagation of metric onElementClick }} - onClickAriaLabel={i18n.translate( - 'xpack.observability.slo.indicatorTypeBadge.exploreInApm', - { - defaultMessage: 'View {service} details', - values: { service: slo.indicator.params.service }, - } - )} + onClickAriaLabel={i18n.translate('xpack.slo.indicatorTypeBadge.exploreInApm', { + defaultMessage: 'View {service} details', + values: { service: slo.indicator.params.service }, + })} > {slo.indicator.params.service} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_rules_badge.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_rules_badge.stories.tsx similarity index 92% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_rules_badge.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_rules_badge.stories.tsx index b88971e2a1355..ff11b8035d8b4 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_rules_badge.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_rules_badge.stories.tsx @@ -10,7 +10,7 @@ import { ComponentStory } from '@storybook/react'; import { EuiFlexGroup } from '@elastic/eui'; import { Rule } from '@kbn/triggers-actions-ui-plugin/public'; -import { KibanaReactStorybookDecorator } from '../../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloRulesBadge as Component, Props } from './slo_rules_badge'; import { BurnRateRuleParams } from '../../../../typings'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_rules_badge.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_rules_badge.tsx similarity index 93% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_rules_badge.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_rules_badge.tsx index c38bc204f7679..0f20ee3ef0b3a 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/badges/slo_rules_badge.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/badges/slo_rules_badge.tsx @@ -20,7 +20,7 @@ export function SloRulesBadge({ rules, onClick }: Props) { return rules === undefined || rules.length > 0 ? null : ( - {i18n.translate('xpack.observability.slo.slo.timeWindow.calendar', { + {i18n.translate('xpack.slo.slo.timeWindow.calendar', { defaultMessage: '{elapsed}/{total} days', values: { elapsed: Math.min(elapsedDurationInDays, totalDurationInDays), diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/card_view/slo_card_item.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slo_card_item.tsx similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/card_view/slo_card_item.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slo_card_item.tsx index e0dd19f34a7f5..802faafc014ce 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/card_view/slo_card_item.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slo_card_item.tsx @@ -148,15 +148,13 @@ export function SloCardItem({ slo, rules, activeAlerts, historicalSummary, cards ) : null} {isDashboardAttachmentReady ? ( { @@ -219,7 +217,7 @@ export function SloCardChart({ })), extra: ( { setIsPopoverOpen(!isPopoverOpen); }} - onClickAriaLabel={i18n.translate('xpack.observability.slo.instances.seeAllBadge', { + onClickAriaLabel={i18n.translate('xpack.slo.instances.seeAllBadge', { defaultMessage: 'see all instance ids', })} data-test-subj="o11ySlosSeeAllInstanceIdsBadge" > - {`${i18n.translate('xpack.observability.slos.extraInstanceIds.badge', { + {`${i18n.translate('xpack.slo.extraInstanceIds.badge', { defaultMessage: '+{count, plural, one {# more instance} other {# more instances}}', values: { count: entries.length - 1, diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/card_view/slos_card_view.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slos_card_view.tsx similarity index 92% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/card_view/slos_card_view.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slos_card_view.tsx index 8397a8ce99472..e662fb19f1035 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/card_view/slos_card_view.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/card_view/slos_card_view.tsx @@ -15,9 +15,9 @@ import { import { EuiFlexGridProps } from '@elastic/eui/src/components/flex/flex_grid'; import { ALL_VALUE, SLOWithSummaryResponse } from '@kbn/slo-schema'; import React from 'react'; -import { useFetchActiveAlerts } from '../../../../hooks/slo/use_fetch_active_alerts'; -import { useFetchHistoricalSummary } from '../../../../hooks/slo/use_fetch_historical_summary'; -import { useFetchRulesForSlo } from '../../../../hooks/slo/use_fetch_rules_for_slo'; +import { useFetchActiveAlerts } from '../../../../hooks/use_fetch_active_alerts'; +import { useFetchHistoricalSummary } from '../../../../hooks/use_fetch_historical_summary'; +import { useFetchRulesForSlo } from '../../../../hooks/use_fetch_rules_for_slo'; import { SloCardItem } from './slo_card_item'; export interface Props { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/burn_rate_rule_flyout.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/burn_rate_rule_flyout.tsx similarity index 85% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/burn_rate_rule_flyout.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/burn_rate_rule_flyout.tsx index 871c11d39bdde..609e4d02cd19a 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/burn_rate_rule_flyout.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/burn_rate_rule_flyout.tsx @@ -8,12 +8,12 @@ import React from 'react'; import { SLOWithSummaryResponse } from '@kbn/slo-schema'; import { useQueryClient } from '@tanstack/react-query'; -import { paths } from '../../../../../common/locators/paths'; +import { SLO_BURN_RATE_RULE_TYPE_ID } from '@kbn/rule-data-utils'; +import { sloFeatureId } from '@kbn/observability-plugin/common'; import { useGetFilteredRuleTypes } from '../../../../hooks/use_get_filtered_rule_types'; -import { sloKeys } from '../../../../hooks/slo/query_key_factory'; import { useKibana } from '../../../../utils/kibana_react'; -import { SLO_BURN_RATE_RULE_TYPE_ID } from '../../../../../common/constants'; -import { sloFeatureId } from '../../../../../common'; +import { paths } from '../../../../../common/locators/paths'; +import { sloKeys } from '../../../../hooks/query_key_factory'; export function BurnRateRuleFlyout({ slo, @@ -40,7 +40,7 @@ export function BurnRateRuleFlyout({ if (setIsAddRuleFlyoutOpen) { queryClient.invalidateQueries({ queryKey: sloKeys.rules(), exact: false }); } else { - navigateToUrl(basePath.prepend(paths.observability.slos)); + navigateToUrl(basePath.prepend(paths.slos)); } }; @@ -48,7 +48,7 @@ export function BurnRateRuleFlyout({ if (setIsAddRuleFlyoutOpen) { setIsAddRuleFlyoutOpen(false); } else { - navigateToUrl(basePath.prepend(paths.observability.slos)); + navigateToUrl(basePath.prepend(paths.slos)); } }; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/create_slo_btn.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/create_slo_btn.tsx similarity index 77% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/create_slo_btn.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/create_slo_btn.tsx index 1a71c82e23d3f..14701ef9e4f60 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/create_slo_btn.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/create_slo_btn.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { useKibana } from '../../../../utils/kibana_react'; import { paths } from '../../../../../common/locators/paths'; -import { useCapabilities } from '../../../../hooks/slo/use_capabilities'; +import { useCapabilities } from '../../../../hooks/use_capabilities'; export function CreateSloBtn() { const { @@ -21,7 +21,7 @@ export function CreateSloBtn() { const { hasWriteCapabilities } = useCapabilities(); const handleClickCreateSlo = () => { - navigateToUrl(basePath.prepend(paths.observability.sloCreate)); + navigateToUrl(basePath.prepend(paths.sloCreate)); }; return ( - {i18n.translate('xpack.observability.slo.sloList.pageHeader.create', { - defaultMessage: 'Create SLO', - })} + {i18n.translate('xpack.slo.sloList.pageHeader.create', { defaultMessage: 'Create SLO' })} ); } diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/feedback_button.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/feedback_button.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/feedback_button.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/feedback_button.tsx index dbd45bf74dee4..4641f8bd1d028 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/feedback_button.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/feedback_button.tsx @@ -25,7 +25,7 @@ export function FeedbackButton({ disabled }: Props) { color="warning" iconType="editorComment" > - {i18n.translate('xpack.observability.slo.feedbackButtonLabel', { + {i18n.translate('xpack.slo.feedbackButtonLabel', { defaultMessage: 'Tell us what you think!', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/good_bad_events_chart.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/good_bad_events_chart.tsx similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/good_bad_events_chart.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/good_bad_events_chart.tsx index 666a9a783f56f..f4d2b7aa2ceee 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/good_bad_events_chart.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/good_bad_events_chart.tsx @@ -64,15 +64,13 @@ export function GoodBadEventsChart({ ? moment(data[1].date).valueOf() - moment(data[0].date).valueOf() : 10 * 60000; - const goodEventId = i18n.translate( - 'xpack.observability.slo.sloDetails.eventsChartPanel.goodEventsLabel', - { defaultMessage: 'Good events' } - ); + const goodEventId = i18n.translate('xpack.slo.sloDetails.eventsChartPanel.goodEventsLabel', { + defaultMessage: 'Good events', + }); - const badEventId = i18n.translate( - 'xpack.observability.slo.sloDetails.eventsChartPanel.badEventsLabel', - { defaultMessage: 'Bad events' } - ); + const badEventId = i18n.translate('xpack.slo.sloDetails.eventsChartPanel.badEventsLabel', { + defaultMessage: 'Bad events', + }); const barClickHandler = (params: XYChartElementEvent[]) => { if (slo?.indicator?.type === 'sli.kql.custom') { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/quick_filters.test.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/quick_filters.test.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/quick_filters.test.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/quick_filters.test.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/quick_filters.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/quick_filters.tsx similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/quick_filters.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/quick_filters.tsx index e41f6113b551c..4636e68e3877d 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/quick_filters.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/quick_filters.tsx @@ -14,7 +14,7 @@ import { Filter } from '@kbn/es-query'; import { isEmpty } from 'lodash'; import { useCreateDataView } from '../../../../hooks/use_create_data_view'; import { SearchState } from '../../hooks/use_url_search_state'; -import { SLO_SUMMARY_DESTINATION_INDEX_NAME } from '../../../../../common/slo/constants'; +import { SLO_SUMMARY_DESTINATION_INDEX_NAME } from '../../../../../common/constants'; interface Props { initialState: SearchState; @@ -119,14 +119,12 @@ const Container = styled.div` } `; -const TAGS_LABEL = i18n.translate('xpack.observability.slo.list.tags', { +const TAGS_LABEL = i18n.translate('xpack.slo.list.tags', { defaultMessage: 'Tags', }); - -const STATUS_LABEL = i18n.translate('xpack.observability.slo.list.status', { +const STATUS_LABEL = i18n.translate('xpack.slo.list.status', { defaultMessage: 'Status', }); - -const ALL_LABEL = i18n.translate('xpack.observability.slo.list.all', { +const ALL_LABEL = i18n.translate('xpack.slo.list.all', { defaultMessage: 'All', }); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/slo_groupings.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/slo_groupings.tsx similarity index 97% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/slo_groupings.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/slo_groupings.tsx index 028353eaa067c..b61d1edc5ed93 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/slo_groupings.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/slo_groupings.tsx @@ -65,7 +65,7 @@ export function SLOGroupings({ slo, direction = 'row', truncate = true }: Props) {rest.length && ( - {`(${i18n.translate('xpack.observability.slos.andLabel', { + {`(${i18n.translate('xpack.slo.andLabel', { defaultMessage: 'and {count, plural, one {# more instance} other {# more instances}}', values: { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/slo_tags_list.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/slo_tags_list.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/slo_tags_list.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/slo_tags_list.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/sort_by_select.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/sort_by_select.tsx similarity index 81% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/sort_by_select.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/sort_by_select.tsx index 2982e8e67ef9d..214dad4e9a124 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/common/sort_by_select.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/common/sort_by_select.tsx @@ -39,7 +39,7 @@ export function SLOSortBy({ state, onStateChange, loading }: Props) { const sortByOptions: Option[] = [ { - label: i18n.translate('xpack.observability.slo.list.sortBy.sliValue', { + label: i18n.translate('xpack.slo.list.sortBy.sliValue', { defaultMessage: 'SLI value', }), checked: sortBy === 'sli_value', @@ -47,14 +47,14 @@ export function SLOSortBy({ state, onStateChange, loading }: Props) { onClick: () => { handleChangeSortBy({ value: 'sli_value', - label: i18n.translate('xpack.observability.slo.list.sortBy.sliValue', { + label: i18n.translate('xpack.slo.list.sortBy.sliValue', { defaultMessage: 'SLI value', }), }); }, }, { - label: i18n.translate('xpack.observability.slo.list.sortBy.sloStatus', { + label: i18n.translate('xpack.slo.list.sortBy.sloStatus', { defaultMessage: 'SLO status', }), checked: sortBy === 'status', @@ -62,14 +62,14 @@ export function SLOSortBy({ state, onStateChange, loading }: Props) { onClick: () => { handleChangeSortBy({ value: 'status', - label: i18n.translate('xpack.observability.slo.list.sortBy.sloStatus', { + label: i18n.translate('xpack.slo.list.sortBy.sloStatus', { defaultMessage: 'SLO status', }), }); }, }, { - label: i18n.translate('xpack.observability.slo.list.sortBy.errorBudgetConsumed', { + label: i18n.translate('xpack.slo.list.sortBy.errorBudgetConsumed', { defaultMessage: 'Error budget consumed', }), checked: sortBy === 'error_budget_consumed', @@ -77,14 +77,14 @@ export function SLOSortBy({ state, onStateChange, loading }: Props) { onClick: () => { handleChangeSortBy({ value: 'error_budget_consumed', - label: i18n.translate('xpack.observability.slo.list.sortBy.errorBudgetConsumed', { + label: i18n.translate('xpack.slo.list.sortBy.errorBudgetConsumed', { defaultMessage: 'Error budget consumed', }), }); }, }, { - label: i18n.translate('xpack.observability.slo.list.sortBy.errorBudgetRemaining', { + label: i18n.translate('xpack.slo.list.sortBy.errorBudgetRemaining', { defaultMessage: 'Error budget remaining', }), checked: sortBy === 'error_budget_remaining', @@ -92,7 +92,7 @@ export function SLOSortBy({ state, onStateChange, loading }: Props) { onClick: () => { handleChangeSortBy({ value: 'error_budget_remaining', - label: i18n.translate('xpack.observability.slo.list.sortBy.errorBudgetRemaining', { + label: i18n.translate('xpack.slo.list.sortBy.errorBudgetRemaining', { defaultMessage: 'Error budget remaining', }), }); @@ -131,6 +131,6 @@ export function SLOSortBy({ state, onStateChange, loading }: Props) { ); } -const SORT_BY_LABEL = i18n.translate('xpack.observability.slo.list.sortByTypeLabel', { +const SORT_BY_LABEL = i18n.translate('xpack.slo.list.sortByTypeLabel', { defaultMessage: 'Sort by', }); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/compact_view/slo_list_compact_view.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/compact_view/slo_list_compact_view.tsx similarity index 84% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/compact_view/slo_list_compact_view.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/compact_view/slo_list_compact_view.tsx index 5609a59c9c765..6e73cf875cf19 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/compact_view/slo_list_compact_view.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/compact_view/slo_list_compact_view.tsx @@ -18,23 +18,24 @@ import { i18n } from '@kbn/i18n'; import { ALL_VALUE, SLOWithSummaryResponse } from '@kbn/slo-schema'; import { useQueryClient } from '@tanstack/react-query'; import React, { useState } from 'react'; +import { RulesParams } from '@kbn/observability-plugin/public'; +import { rulesLocatorID } from '@kbn/observability-plugin/common'; +import { SLO_BURN_RATE_RULE_TYPE_ID } from '@kbn/rule-data-utils'; +import { sloFeatureId } from '@kbn/observability-plugin/common'; +import { useGetFilteredRuleTypes } from '../../../../hooks/use_get_filtered_rule_types'; +import { useKibana } from '../../../../utils/kibana_react'; import { SloTagsList } from '../common/slo_tags_list'; -import { useCloneSlo } from '../../../../hooks/slo/use_clone_slo'; -import { rulesLocatorID, sloFeatureId } from '../../../../../common'; -import { SLO_BURN_RATE_RULE_TYPE_ID } from '../../../../../common/constants'; +import { useCloneSlo } from '../../../../hooks/use_clone_slo'; import { paths } from '../../../../../common/locators/paths'; import { SloDeleteConfirmationModal } from '../../../../components/slo/delete_confirmation_modal/slo_delete_confirmation_modal'; import { SloStatusBadge } from '../../../../components/slo/slo_status_badge'; import { SloActiveAlertsBadge } from '../../../../components/slo/slo_status_badge/slo_active_alerts_badge'; -import { sloKeys } from '../../../../hooks/slo/query_key_factory'; -import { useCapabilities } from '../../../../hooks/slo/use_capabilities'; -import { useDeleteSlo } from '../../../../hooks/slo/use_delete_slo'; -import { useFetchActiveAlerts } from '../../../../hooks/slo/use_fetch_active_alerts'; -import { useFetchHistoricalSummary } from '../../../../hooks/slo/use_fetch_historical_summary'; -import { useFetchRulesForSlo } from '../../../../hooks/slo/use_fetch_rules_for_slo'; -import { useGetFilteredRuleTypes } from '../../../../hooks/use_get_filtered_rule_types'; -import { RulesParams } from '../../../../locators/rules'; -import { useKibana } from '../../../../utils/kibana_react'; +import { sloKeys } from '../../../../hooks/query_key_factory'; +import { useCapabilities } from '../../../../hooks/use_capabilities'; +import { useDeleteSlo } from '../../../../hooks/use_delete_slo'; +import { useFetchActiveAlerts } from '../../../../hooks/use_fetch_active_alerts'; +import { useFetchHistoricalSummary } from '../../../../hooks/use_fetch_historical_summary'; +import { useFetchRulesForSlo } from '../../../../hooks/use_fetch_rules_for_slo'; import { formatHistoricalData } from '../../../../utils/slo/chart_data_formatter'; import { SloRulesBadge } from '../badges/slo_rules_badge'; import { SloListEmpty } from '../slo_list_empty'; @@ -104,15 +105,15 @@ export function SloListCompactView({ sloList, loading, error }: Props) { { type: 'icon', icon: 'inspect', - name: i18n.translate('xpack.observability.slo.item.actions.details', { + name: i18n.translate('xpack.slo.item.actions.details', { defaultMessage: 'Details', }), - description: i18n.translate('xpack.observability.slo.item.actions.details', { + description: i18n.translate('xpack.slo.item.actions.details', { defaultMessage: 'Details', }), onClick: (slo: SLOWithSummaryResponse) => { const sloDetailsUrl = basePath.prepend( - paths.observability.sloDetails( + paths.sloDetails( slo.id, ![slo.groupBy].flat().includes(ALL_VALUE) && slo.instanceId ? slo.instanceId : undefined ) @@ -123,25 +124,25 @@ export function SloListCompactView({ sloList, loading, error }: Props) { { type: 'icon', icon: 'pencil', - name: i18n.translate('xpack.observability.slo.item.actions.edit', { + name: i18n.translate('xpack.slo.item.actions.edit', { defaultMessage: 'Edit', }), - description: i18n.translate('xpack.observability.slo.item.actions.edit', { + description: i18n.translate('xpack.slo.item.actions.edit', { defaultMessage: 'Edit', }), 'data-test-subj': 'sloActionsEdit', enabled: (_) => hasWriteCapabilities, onClick: (slo: SLOWithSummaryResponse) => { - navigateToUrl(basePath.prepend(paths.observability.sloEdit(slo.id))); + navigateToUrl(basePath.prepend(paths.sloEdit(slo.id))); }, }, { type: 'icon', icon: 'bell', - name: i18n.translate('xpack.observability.slo.item.actions.createRule', { + name: i18n.translate('xpack.slo.item.actions.createRule', { defaultMessage: 'Create new alert rule', }), - description: i18n.translate('xpack.observability.slo.item.actions.createRule', { + description: i18n.translate('xpack.slo.item.actions.createRule', { defaultMessage: 'Create new alert rule', }), 'data-test-subj': 'sloActionsCreateRule', @@ -153,10 +154,10 @@ export function SloListCompactView({ sloList, loading, error }: Props) { { type: 'icon', icon: 'gear', - name: i18n.translate('xpack.observability.slo.item.actions.manageRules', { + name: i18n.translate('xpack.slo.item.actions.manageRules', { defaultMessage: 'Manage rules', }), - description: i18n.translate('xpack.observability.slo.item.actions.manageRules', { + description: i18n.translate('xpack.slo.item.actions.manageRules', { defaultMessage: 'Manage rules', }), 'data-test-subj': 'sloActionsManageRules', @@ -169,10 +170,10 @@ export function SloListCompactView({ sloList, loading, error }: Props) { { type: 'icon', icon: 'copy', - name: i18n.translate('xpack.observability.slo.item.actions.clone', { + name: i18n.translate('xpack.slo.item.actions.clone', { defaultMessage: 'Clone', }), - description: i18n.translate('xpack.observability.slo.item.actions.clone', { + description: i18n.translate('xpack.slo.item.actions.clone', { defaultMessage: 'Clone', }), 'data-test-subj': 'sloActionsClone', @@ -184,10 +185,10 @@ export function SloListCompactView({ sloList, loading, error }: Props) { { type: 'icon', icon: 'trash', - name: i18n.translate('xpack.observability.slo.item.actions.delete', { + name: i18n.translate('xpack.slo.item.actions.delete', { defaultMessage: 'Delete', }), - description: i18n.translate('xpack.observability.slo.item.actions.delete', { + description: i18n.translate('xpack.slo.item.actions.delete', { defaultMessage: 'Delete', }), 'data-test-subj': 'sloActionsDelete', @@ -239,7 +240,7 @@ export function SloListCompactView({ sloList, loading, error }: Props) { 'data-test-subj': 'sloItem', render: (_, slo: SLOWithSummaryResponse) => { const sloDetailsUrl = basePath.prepend( - paths.observability.sloDetails( + paths.sloDetails( slo.id, ![slo.groupBy].flat().includes(ALL_VALUE) && slo.instanceId ? slo.instanceId : undefined ) @@ -406,10 +407,8 @@ export function SloListCompactView({ sloList, loading, error }: Props) { ); } -const LOADING_SLOS_LABEL = i18n.translate('xpack.observability.slo.loadingSlosLabel', { +const LOADING_SLOS_LABEL = i18n.translate('xpack.slo.loadingSlosLabel', { defaultMessage: 'Loading SLOs ...', }); -const NO_SLOS_FOUND = i18n.translate('xpack.observability.slo.noSlosFound', { - defaultMessage: 'No SLOs found', -}); +const NO_SLOS_FOUND = i18n.translate('xpack.slo.noSlosFound', { defaultMessage: 'No SLOs found' }); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/grouped_slos/group_list_empty.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_empty.tsx similarity index 81% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/grouped_slos/group_list_empty.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_empty.tsx index f23ff645b8fbd..d3110327b74eb 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/grouped_slos/group_list_empty.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_empty.tsx @@ -13,13 +13,13 @@ export function SloGroupListEmpty() { return ( - {i18n.translate('xpack.observability.slo.groupList.emptyMessage', { + {i18n.translate('xpack.slo.groupList.emptyMessage', { defaultMessage: 'There are no results for your criteria.', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/grouped_slos/group_list_error.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_error.tsx similarity index 67% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/grouped_slos/group_list_error.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_error.tsx index d67ef0548a949..a7aa8d321f885 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/grouped_slos/group_list_error.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_error.tsx @@ -4,12 +4,6 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -/* - * 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 React from 'react'; import { EuiEmptyPrompt } from '@elastic/eui'; @@ -23,14 +17,14 @@ export function SloGroupListError() { color="danger" title={

- {i18n.translate('xpack.observability.slo.groupList.errorTitle', { + {i18n.translate('xpack.slo.groupList.errorTitle', { defaultMessage: 'Unable to load SLO groups', })}

} body={

- {i18n.translate('xpack.observability.slo.groupList.errorMessage', { + {i18n.translate('xpack.slo.groupList.errorMessage', { defaultMessage: 'There was an error loading the SLO groups. Contact your administrator for help.', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/grouped_slos/group_list_view.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_view.tsx similarity index 80% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/grouped_slos/group_list_view.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_view.tsx index a9f39c4687173..5b95a0e8d97e3 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/grouped_slos/group_list_view.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/grouped_slos/group_list_view.tsx @@ -23,10 +23,10 @@ import { Filter } from '@kbn/es-query'; import { i18n } from '@kbn/i18n'; import React, { memo, useState } from 'react'; import { GroupSummary } from '@kbn/slo-schema'; -import { useKibana } from '@kbn/kibana-react-plugin/public'; import { CoreStart } from '@kbn/core-lifecycle-browser'; +import { useKibana } from '../../../../utils/kibana_react'; import { paths } from '../../../../../common/locators/paths'; -import { useFetchSloList } from '../../../../hooks/slo/use_fetch_slo_list'; +import { useFetchSloList } from '../../../../hooks/use_fetch_slo_list'; import { SLI_OPTIONS } from '../../../slo_edit/constants'; import { useSloFormattedSLIValue } from '../../hooks/use_slo_summary'; import { SlosView } from '../slos_view'; @@ -120,7 +120,7 @@ export function GroupListView({ {summary.violated > 0 && ( - {i18n.translate('xpack.observability.slo.group.totalViolated', { + {i18n.translate('xpack.slo.group.totalViolated', { defaultMessage: '{total} Violated', values: { total: summary.violated, @@ -131,7 +131,7 @@ export function GroupListView({ )} - {i18n.translate('xpack.observability.slo.group.totalHealthy', { + {i18n.translate('xpack.slo.group.totalHealthy', { defaultMessage: '{total} Healthy', values: { total: summary.healthy, @@ -144,26 +144,20 @@ export function GroupListView({ content={ <> - {i18n.translate( - 'xpack.observability.slo.group.totalSloViolatedTooltip', - { - defaultMessage: 'SLO: {name}', - values: { - name: summary.worst.slo?.name, - }, - } - )} + {i18n.translate('xpack.slo.group.totalSloViolatedTooltip', { + defaultMessage: 'SLO: {name}', + values: { + name: summary.worst.slo?.name, + }, + })} - {i18n.translate( - 'xpack.observability.slo.group.totalSloViolatedTooltip.instance', - { - defaultMessage: 'Instance: {instance}', - values: { - instance: summary.worst.slo?.instanceId, - }, - } - )} + {i18n.translate('xpack.slo.group.totalSloViolatedTooltip.instance', { + defaultMessage: 'Instance: {instance}', + values: { + instance: summary.worst.slo?.instanceId, + }, + })} } @@ -171,13 +165,10 @@ export function GroupListView({ - {i18n.translate('xpack.observability.slo.group.worstPerforming', { + {i18n.translate('xpack.slo.group.worstPerforming', { defaultMessage: 'Worst performing: ', })} - {i18n.translate('xpack.observability.slosPageTitle', { + {i18n.translate('xpack.slo.slosPageTitle', { defaultMessage: 'SLOs', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_context_menu.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_context_menu.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_context_menu.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_context_menu.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_item_actions.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_item_actions.tsx similarity index 83% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_item_actions.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_item_actions.tsx index 2aa5f3f0d66c4..26f4ba28546c2 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_item_actions.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_item_actions.tsx @@ -17,12 +17,12 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { ALL_VALUE, SLOWithSummaryResponse } from '@kbn/slo-schema'; import styled from 'styled-components'; -import { useCloneSlo } from '../../../hooks/slo/use_clone_slo'; -import { useCapabilities } from '../../../hooks/slo/use_capabilities'; +import { RulesParams } from '@kbn/observability-plugin/public'; +import { rulesLocatorID } from '@kbn/observability-plugin/common'; import { useKibana } from '../../../utils/kibana_react'; +import { useCloneSlo } from '../../../hooks/use_clone_slo'; +import { useCapabilities } from '../../../hooks/use_capabilities'; import { paths } from '../../../../common/locators/paths'; -import { RulesParams } from '../../../locators/rules'; -import { rulesLocatorID } from '../../../../common'; interface Props { slo: SLOWithSummaryResponse; @@ -73,7 +73,7 @@ export function SloItemActions({ const { hasWriteCapabilities } = useCapabilities(); const sloDetailsUrl = basePath.prepend( - paths.observability.sloDetails( + paths.sloDetails( slo.id, ![slo.groupBy].flat().includes(ALL_VALUE) && slo.instanceId ? slo.instanceId : undefined ) @@ -88,7 +88,7 @@ export function SloItemActions({ }; const handleEdit = () => { - navigateToUrl(basePath.prepend(paths.observability.sloEdit(slo.id))); + navigateToUrl(basePath.prepend(paths.sloEdit(slo.id))); }; const navigateToClone = useCloneSlo(); @@ -122,7 +122,7 @@ export function SloItemActions({ const btn = ( - {i18n.translate('xpack.observability.slo.item.actions.details', { + {i18n.translate('xpack.slo.item.actions.details', { defaultMessage: 'Details', })} , @@ -163,7 +163,7 @@ export function SloItemActions({ onClick={handleEdit} data-test-subj="sloActionsEdit" > - {i18n.translate('xpack.observability.slo.item.actions.edit', { + {i18n.translate('xpack.slo.item.actions.edit', { defaultMessage: 'Edit', })} , @@ -174,7 +174,7 @@ export function SloItemActions({ onClick={handleCreateRule} data-test-subj="sloActionsCreateRule" > - {i18n.translate('xpack.observability.slo.item.actions.createRule', { + {i18n.translate('xpack.slo.item.actions.createRule', { defaultMessage: 'Create new alert rule', })} , @@ -185,7 +185,7 @@ export function SloItemActions({ onClick={handleNavigateToRules} data-test-subj="sloActionsManageRules" > - {i18n.translate('xpack.observability.slo.item.actions.manageRules', { + {i18n.translate('xpack.slo.item.actions.manageRules', { defaultMessage: 'Manage rules', })} , @@ -196,9 +196,7 @@ export function SloItemActions({ onClick={handleClone} data-test-subj="sloActionsClone" > - {i18n.translate('xpack.observability.slo.item.actions.clone', { - defaultMessage: 'Clone', - })} + {i18n.translate('xpack.slo.item.actions.clone', { defaultMessage: 'Clone' })} , - {i18n.translate('xpack.observability.slo.item.actions.delete', { - defaultMessage: 'Delete', - })} + {i18n.translate('xpack.slo.item.actions.delete', { defaultMessage: 'Delete' })} , - {i18n.translate('xpack.observability.slo.item.actions.addToDashboard', { + {i18n.translate('xpack.slo.item.actions.addToDashboard', { defaultMessage: 'Add to Dashboard', })} , diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list.stories.tsx similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list.stories.tsx index 3e6dd1c87d798..132d96a669aa3 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list.stories.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloList as Component } from './slo_list'; export default { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list.tsx similarity index 98% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list.tsx index 76ed7992b66cc..c0a3d573577b2 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list.tsx @@ -10,12 +10,12 @@ import { useIsMutating } from '@tanstack/react-query'; import React, { useEffect } from 'react'; import dedent from 'dedent'; import { groupBy as _groupBy, mapValues } from 'lodash'; -import { useFetchSloList } from '../../../hooks/slo/use_fetch_slo_list'; +import { useKibana } from '../../../utils/kibana_react'; +import { useFetchSloList } from '../../../hooks/use_fetch_slo_list'; import { useUrlSearchState } from '../hooks/use_url_search_state'; import { SlosView } from './slos_view'; import { ToggleSLOView } from './toggle_slo_view'; import { GroupView } from './grouped_slos/group_view'; -import { useKibana } from '../../../utils/kibana_react'; export function SloList() { const { state, onStateChange } = useUrlSearchState(); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_empty.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_empty.stories.tsx similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_empty.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_empty.stories.tsx index b8c49050143fc..8204683836a13 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_empty.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_empty.stories.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloListEmpty as Component } from './slo_list_empty'; export default { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_empty.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_empty.tsx similarity index 81% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_empty.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_empty.tsx index 22bbaf11bdf84..1568d86c34cb4 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_empty.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_empty.tsx @@ -12,13 +12,13 @@ import { i18n } from '@kbn/i18n'; export function SloListEmpty() { return ( - {i18n.translate('xpack.observability.slo.list.emptyMessage', { + {i18n.translate('xpack.slo.list.emptyMessage', { defaultMessage: 'There are no results for your criteria.', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_error.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_error.stories.tsx similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_error.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_error.stories.tsx index a3e2503449da8..632dde7858ab0 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_error.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_error.stories.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloListError as Component } from './slo_list_error'; export default { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_error.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_error.tsx similarity index 84% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_error.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_error.tsx index 171ceeb341b2d..9d1bce9e60382 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_error.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_error.tsx @@ -16,14 +16,14 @@ export function SloListError() { color="danger" title={

- {i18n.translate('xpack.observability.slo.list.errorTitle', { + {i18n.translate('xpack.slo.list.errorTitle', { defaultMessage: 'Unable to load SLOs', })}

} body={

- {i18n.translate('xpack.observability.slo.list.errorMessage', { + {i18n.translate('xpack.slo.list.errorMessage', { defaultMessage: 'There was an error loading the SLOs. Contact your administrator for help.', })} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_group_by.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_group_by.tsx similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_group_by.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_group_by.tsx index a10fc2a114d5c..75aaa869d5d88 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_group_by.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_group_by.tsx @@ -45,7 +45,7 @@ export function SloGroupBy({ onStateChange, state, loading }: Props) { }, }, { - label: i18n.translate('xpack.observability.slo.list.groupBy.tags', { + label: i18n.translate('xpack.slo.list.groupBy.tags', { defaultMessage: 'Tags', }), checked: groupBy === 'slo.tags', @@ -55,7 +55,7 @@ export function SloGroupBy({ onStateChange, state, loading }: Props) { }, }, { - label: i18n.translate('xpack.observability.slo.list.groupBy.status', { + label: i18n.translate('xpack.slo.list.groupBy.status', { defaultMessage: 'Status', }), checked: groupBy === 'status', @@ -65,7 +65,7 @@ export function SloGroupBy({ onStateChange, state, loading }: Props) { }, }, { - label: i18n.translate('xpack.observability.slo.list.groupBy.sliType', { + label: i18n.translate('xpack.slo.list.groupBy.sliType', { defaultMessage: 'SLI type', }), checked: groupBy === 'slo.indicator.type', @@ -105,10 +105,9 @@ export function SloGroupBy({ onStateChange, state, loading }: Props) { ); } -export const NONE_LABEL = i18n.translate('xpack.observability.slo.list.groupBy.sliIndicator', { +export const NONE_LABEL = i18n.translate('xpack.slo.list.groupBy.sliIndicator', { defaultMessage: 'None', }); - -export const GROUP_TITLE = i18n.translate('xpack.observability.slo.groupPopover.group.title', { +export const GROUP_TITLE = i18n.translate('xpack.slo.groupPopover.group.title', { defaultMessage: 'Group by', }); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_item.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_item.stories.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_item.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_item.stories.tsx index 2b9b289eda626..87e9f75a0c65e 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_item.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_item.stories.tsx @@ -8,12 +8,12 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { HEALTHY_ROLLING_SLO, historicalSummaryData, } from '../../../data/slo/historical_summary_data'; import { buildSlo } from '../../../data/slo/slo'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; import { SloListItem as Component, SloListItemProps } from './slo_list_item'; export default { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_item.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_item.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_item.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_item.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_search_bar.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_search_bar.stories.tsx similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_search_bar.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_search_bar.stories.tsx index 0d36156cfeced..4d16c40c1edae 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_search_bar.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_search_bar.stories.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SloListSearchBar as Component } from './slo_list_search_bar'; export default { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_search_bar.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_search_bar.tsx similarity index 93% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_search_bar.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_search_bar.tsx index fb4274642e217..1af7d24717c38 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_search_bar.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_search_bar.tsx @@ -11,11 +11,11 @@ import { i18n } from '@kbn/i18n'; import React, { useEffect } from 'react'; import styled from 'styled-components'; import { Query } from '@kbn/es-query'; -import { useSloCrudLoading } from '../hooks/use_crud_loading'; +import { observabilityAppId } from '@kbn/observability-plugin/public'; import { useKibana } from '../../../utils/kibana_react'; -import { SLO_SUMMARY_DESTINATION_INDEX_NAME } from '../../../../common/slo/constants'; +import { useSloCrudLoading } from '../hooks/use_crud_loading'; +import { SLO_SUMMARY_DESTINATION_INDEX_NAME } from '../../../../common/constants'; import { useCreateDataView } from '../../../hooks/use_create_data_view'; -import { observabilityAppId, ObservabilityPublicPluginsStart } from '../../..'; import { useUrlSearchState } from '../hooks/use_url_search_state'; import { QuickFilters } from './common/quick_filters'; @@ -36,7 +36,7 @@ export function SloListSearchBar() { unifiedSearch: { ui: { SearchBar }, }, - } = useKibana().services; + } = useKibana().services; const { state, onStateChange } = useUrlSearchState(); const loading = useSloCrudLoading(); @@ -98,6 +98,6 @@ const Container = styled.div` } `; -const PLACEHOLDER = i18n.translate('xpack.observability.slo.list.search', { +const PLACEHOLDER = i18n.translate('xpack.slo.list.search', { defaultMessage: 'Search your SLOs ...', }); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_view/slo_list_view.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_view/slo_list_view.tsx similarity index 88% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_view/slo_list_view.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_view/slo_list_view.tsx index f353f4743775a..3b23d2234f7cf 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_list_view/slo_list_view.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_list_view/slo_list_view.tsx @@ -8,9 +8,9 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { ALL_VALUE, SLOWithSummaryResponse } from '@kbn/slo-schema'; import React from 'react'; -import { useFetchActiveAlerts } from '../../../../hooks/slo/use_fetch_active_alerts'; -import { useFetchHistoricalSummary } from '../../../../hooks/slo/use_fetch_historical_summary'; -import { useFetchRulesForSlo } from '../../../../hooks/slo/use_fetch_rules_for_slo'; +import { useFetchActiveAlerts } from '../../../../hooks/use_fetch_active_alerts'; +import { useFetchHistoricalSummary } from '../../../../hooks/use_fetch_historical_summary'; +import { useFetchRulesForSlo } from '../../../../hooks/use_fetch_rules_for_slo'; import { SloListEmpty } from '../slo_list_empty'; import { SloListError } from '../slo_list_error'; import { SloListItem } from '../slo_list_item'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_sparkline.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_sparkline.stories.tsx similarity index 97% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_sparkline.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_sparkline.stories.tsx index 0f2eeee498fba..3306f12b9962a 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_sparkline.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_sparkline.stories.tsx @@ -8,6 +8,7 @@ import { HistoricalSummaryResponse } from '@kbn/slo-schema'; import { ComponentStory } from '@storybook/react'; import React from 'react'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { DEGRADING_FAST_ROLLING_SLO, HEALTHY_RANDOM_ROLLING_SLO, @@ -16,7 +17,6 @@ import { historicalSummaryData, NO_DATA_TO_HEALTHY_ROLLING_SLO, } from '../../../data/slo/historical_summary_data'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; import { Props, SloSparkline as Component } from './slo_sparkline'; export default { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_sparkline.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_sparkline.tsx similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_sparkline.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_sparkline.tsx diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_summary.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_summary.stories.tsx similarity index 92% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_summary.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_summary.stories.tsx index 13d6365232ac2..d13b033ede550 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_summary.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_summary.stories.tsx @@ -7,12 +7,12 @@ import { ComponentStory } from '@storybook/react'; import React from 'react'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { HEALTHY_ROLLING_SLO, historicalSummaryData, } from '../../../data/slo/historical_summary_data'; import { buildSlo } from '../../../data/slo/slo'; -import { KibanaReactStorybookDecorator } from '../../../utils/kibana_react.storybook_decorator'; import { Props, SloSummary as Component } from './slo_summary'; export default { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_summary.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_summary.tsx similarity index 94% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_summary.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_summary.tsx index 77d23d6301aed..c320811329544 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/components/slo_summary.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/components/slo_summary.tsx @@ -38,7 +38,7 @@ export function SloSummary({ slo, historicalSummary = [], historicalSummaryLoadi > {`${rangeStart}-${rangeEnd}`}, total, slos: ( - + ), }} @@ -94,7 +91,7 @@ export function ToggleSLOView({ { @@ -46,7 +46,7 @@ export const getSloFormattedSummary = ( : numeral(errorBudgetRemaining).format(percentFormat); const sloDetailsUrl = basePath.prepend( - paths.observability.sloDetails( + paths.sloDetails( slo.id, ![slo.groupBy].flat().includes(ALL_VALUE) && slo.instanceId ? slo.instanceId : undefined ) diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/hooks/use_url_search_state.ts b/x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_url_search_state.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/hooks/use_url_search_state.ts rename to x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_url_search_state.ts index 8a1b639e67f54..dfbfa1b5ddeb0 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/hooks/use_url_search_state.ts +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/hooks/use_url_search_state.ts @@ -10,7 +10,7 @@ import deepmerge from 'deepmerge'; import { useHistory } from 'react-router-dom'; import { Filter } from '@kbn/es-query'; import { useCallback, useEffect, useRef, useState } from 'react'; -import { DEFAULT_SLO_PAGE_SIZE } from '../../../../common/slo/constants'; +import { DEFAULT_SLO_PAGE_SIZE } from '../../../../common/constants'; import type { SortField, SortDirection } from '../components/slo_list_search_bar'; import type { GroupByField } from '../components/slo_list_group_by'; import type { SLOView } from '../components/toggle_slo_view'; diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/slos.test.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/slos.test.tsx similarity index 91% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/slos.test.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/slos.test.tsx index 00e59a1461558..e019949027139 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/slos.test.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/slos.test.tsx @@ -15,13 +15,13 @@ import Router from 'react-router-dom'; import { paths } from '../../../common/locators/paths'; import { historicalSummaryData } from '../../data/slo/historical_summary_data'; import { emptySloList, sloList } from '../../data/slo/slo'; -import { useCapabilities } from '../../hooks/slo/use_capabilities'; -import { useCreateSlo } from '../../hooks/slo/use_create_slo'; -import { useDeleteSlo } from '../../hooks/slo/use_delete_slo'; -import { useFetchHistoricalSummary } from '../../hooks/slo/use_fetch_historical_summary'; -import { useFetchSloList } from '../../hooks/slo/use_fetch_slo_list'; +import { useCapabilities } from '../../hooks/use_capabilities'; +import { useCreateSlo } from '../../hooks/use_create_slo'; +import { useDeleteSlo } from '../../hooks/use_delete_slo'; +import { useFetchHistoricalSummary } from '../../hooks/use_fetch_historical_summary'; +import { useFetchSloList } from '../../hooks/use_fetch_slo_list'; import { useLicense } from '../../hooks/use_license'; -import { TagsList } from '@kbn/observability-shared-plugin/public'; +import { HeaderMenuPortal, TagsList } from '@kbn/observability-shared-plugin/public'; import { useKibana } from '../../utils/kibana_react'; import { render } from '../../utils/test_helper'; import { SlosPage } from './slos'; @@ -34,11 +34,11 @@ jest.mock('react-router-dom', () => ({ jest.mock('@kbn/observability-shared-plugin/public'); jest.mock('../../utils/kibana_react'); jest.mock('../../hooks/use_license'); -jest.mock('../../hooks/slo/use_fetch_slo_list'); -jest.mock('../../hooks/slo/use_create_slo'); -jest.mock('../../hooks/slo/use_delete_slo'); -jest.mock('../../hooks/slo/use_fetch_historical_summary'); -jest.mock('../../hooks/slo/use_capabilities'); +jest.mock('../../hooks/use_fetch_slo_list'); +jest.mock('../../hooks/use_create_slo'); +jest.mock('../../hooks/use_delete_slo'); +jest.mock('../../hooks/use_fetch_historical_summary'); +jest.mock('../../hooks/use_capabilities'); const useKibanaMock = useKibana as jest.Mock; const useLicenseMock = useLicense as jest.Mock; @@ -50,6 +50,9 @@ const useCapabilitiesMock = useCapabilities as jest.Mock; const TagsListMock = TagsList as jest.Mock; TagsListMock.mockReturnValue(

Tags list
); +const HeaderMenuPortalMock = HeaderMenuPortal as jest.Mock; +HeaderMenuPortalMock.mockReturnValue(
Portal node
); + const mockCreateSlo = jest.fn(); const mockDeleteSlo = jest.fn(); @@ -153,7 +156,7 @@ describe('SLOs Page', () => { }); await waitFor(() => { - expect(mockNavigate).toBeCalledWith(paths.observability.slosWelcome); + expect(mockNavigate).toBeCalledWith(paths.slosWelcome); }); }); }); @@ -175,7 +178,7 @@ describe('SLOs Page', () => { }); await waitFor(() => { - expect(mockNavigate).toBeCalledWith(paths.observability.slosWelcome); + expect(mockNavigate).toBeCalledWith(paths.slosWelcome); }); }); @@ -240,9 +243,7 @@ describe('SLOs Page', () => { button.click(); - expect(mockNavigate).toBeCalledWith( - `${paths.observability.sloEdit(sloList.results.at(0)?.id || '')}` - ); + expect(mockNavigate).toBeCalledWith(`${paths.sloEdit(sloList.results.at(0)?.id || '')}`); }); it('allows creating a new rule for an SLO', async () => { @@ -356,7 +357,7 @@ describe('SLOs Page', () => { await waitFor(() => { const slo = sloList.results.at(0); expect(mockNavigate).toBeCalledWith( - paths.observability.sloCreateWithEncodedForm( + paths.sloCreateWithEncodedForm( encode({ ...slo, name: `[Copy] ${slo!.name}`, id: undefined }) ) ); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos/slos.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos/slos.tsx similarity index 79% rename from x-pack/plugins/observability_solution/observability/public/pages/slos/slos.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos/slos.tsx index 259c2d7d2882a..9e152611ec00a 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos/slos.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos/slos.tsx @@ -9,16 +9,16 @@ import React, { useEffect } from 'react'; import { useBreadcrumbs } from '@kbn/observability-shared-plugin/public'; import { i18n } from '@kbn/i18n'; +import { HeaderMenu } from '../../components/header_menu/header_menu'; +import { useKibana } from '../../utils/kibana_react'; import { FeedbackButton } from './components/common/feedback_button'; import { CreateSloBtn } from './components/common/create_slo_btn'; import { SloListSearchBar } from './components/slo_list_search_bar'; -import { useKibana } from '../../utils/kibana_react'; import { usePluginContext } from '../../hooks/use_plugin_context'; import { useLicense } from '../../hooks/use_license'; -import { useFetchSloList } from '../../hooks/slo/use_fetch_slo_list'; +import { useFetchSloList } from '../../hooks/use_fetch_slo_list'; import { SloList } from './components/slo_list'; import { paths } from '../../../common/locators/paths'; -import { HeaderMenu } from '../overview/components/header_menu/header_menu'; import { SloOutdatedCallout } from '../../components/slo/slo_outdated_callout'; export const SLO_PAGE_ID = 'slo-page-container'; @@ -42,17 +42,17 @@ export function SlosPage() { useBreadcrumbs([ { - href: basePath.prepend(paths.observability.slos), - text: i18n.translate('xpack.observability.breadcrumbs.slosLinkText', { + href: basePath.prepend(paths.slos), + text: i18n.translate('xpack.slo.breadcrumbs.slosLinkText', { defaultMessage: 'SLOs', }), - deepLinkId: 'observability-overview:slos', + deepLinkId: 'slo', }, ]); useEffect(() => { if ((!isLoading && total === 0) || hasAtLeast('platinum') === false || isError) { - navigateToUrl(basePath.prepend(paths.observability.slosWelcome)); + navigateToUrl(basePath.prepend(paths.slosWelcome)); } }, [basePath, hasAtLeast, isError, isLoading, navigateToUrl, total]); @@ -60,9 +60,7 @@ export function SlosPage() { , ], }} topSearchBar={} diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos_welcome/assets/illustration.svg b/x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/assets/illustration.svg similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/pages/slos_welcome/assets/illustration.svg rename to x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/assets/illustration.svg diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos_welcome/slos_welcome.stories.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.stories.tsx similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/pages/slos_welcome/slos_welcome.stories.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.stories.tsx index cb3cb1710bf0e..2b050c76a3fe5 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos_welcome/slos_welcome.stories.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.stories.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { ComponentStory } from '@storybook/react'; -import { KibanaReactStorybookDecorator } from '../../utils/kibana_react.storybook_decorator'; +import { KibanaReactStorybookDecorator } from '@kbn/observability-plugin/public'; import { SlosWelcomePage as Component } from './slos_welcome'; export default { diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos_welcome/slos_welcome.test.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.test.tsx similarity index 89% rename from x-pack/plugins/observability_solution/observability/public/pages/slos_welcome/slos_welcome.test.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.test.tsx index f967b6cb40c69..e91730400b87b 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos_welcome/slos_welcome.test.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.test.tsx @@ -11,13 +11,14 @@ import React from 'react'; import Router from 'react-router-dom'; import { paths } from '../../../common/locators/paths'; import { emptySloList, sloList } from '../../data/slo/slo'; -import { useCapabilities } from '../../hooks/slo/use_capabilities'; -import { useFetchSloGlobalDiagnosis } from '../../hooks/slo/use_fetch_global_diagnosis'; -import { useFetchSloList } from '../../hooks/slo/use_fetch_slo_list'; +import { useCapabilities } from '../../hooks/use_capabilities'; +import { useFetchSloGlobalDiagnosis } from '../../hooks/use_fetch_global_diagnosis'; +import { useFetchSloList } from '../../hooks/use_fetch_slo_list'; import { useLicense } from '../../hooks/use_license'; import { useKibana } from '../../utils/kibana_react'; import { render } from '../../utils/test_helper'; import { SlosWelcomePage } from './slos_welcome'; +import { HeaderMenuPortal } from '@kbn/observability-shared-plugin/public'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), @@ -27,9 +28,12 @@ jest.mock('react-router-dom', () => ({ jest.mock('@kbn/observability-shared-plugin/public'); jest.mock('../../utils/kibana_react'); jest.mock('../../hooks/use_license'); -jest.mock('../../hooks/slo/use_fetch_slo_list'); -jest.mock('../../hooks/slo/use_capabilities'); -jest.mock('../../hooks/slo/use_fetch_global_diagnosis'); +jest.mock('../../hooks/use_fetch_slo_list'); +jest.mock('../../hooks/use_capabilities'); +jest.mock('../../hooks/use_fetch_global_diagnosis'); + +const HeaderMenuPortalMock = HeaderMenuPortal as jest.Mock; +HeaderMenuPortalMock.mockReturnValue(
Portal node
); const useKibanaMock = useKibana as jest.Mock; const useLicenseMock = useLicense as jest.Mock; @@ -151,7 +155,7 @@ describe('SLOs Welcome Page', () => { createNewSloButton?.click(); await waitFor(() => { - expect(mockNavigate).toBeCalledWith(paths.observability.sloCreate); + expect(mockNavigate).toBeCalledWith(paths.sloCreate); }); }); }); @@ -172,7 +176,7 @@ describe('SLOs Welcome Page', () => { it('should navigate to the SLO List page', async () => { render(); await waitFor(() => { - expect(mockNavigate).toBeCalledWith(paths.observability.slos); + expect(mockNavigate).toBeCalledWith(paths.slos); }); }); }); diff --git a/x-pack/plugins/observability_solution/observability/public/pages/slos_welcome/slos_welcome.tsx b/x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.tsx similarity index 71% rename from x-pack/plugins/observability_solution/observability/public/pages/slos_welcome/slos_welcome.tsx rename to x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.tsx index a27762d8553f9..53b08809ecc6a 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/slos_welcome/slos_welcome.tsx +++ b/x-pack/plugins/observability_solution/slo/public/pages/slos_welcome/slos_welcome.tsx @@ -21,13 +21,13 @@ import { i18n } from '@kbn/i18n'; import { useKibana } from '../../utils/kibana_react'; import { useLicense } from '../../hooks/use_license'; import { usePluginContext } from '../../hooks/use_plugin_context'; -import { useCapabilities } from '../../hooks/slo/use_capabilities'; -import { useFetchSloList } from '../../hooks/slo/use_fetch_slo_list'; +import { useCapabilities } from '../../hooks/use_capabilities'; +import { useFetchSloList } from '../../hooks/use_fetch_slo_list'; import { paths } from '../../../common/locators/paths'; import illustration from './assets/illustration.svg'; -import { useFetchSloGlobalDiagnosis } from '../../hooks/slo/use_fetch_global_diagnosis'; -import { HeaderMenu } from '../overview/components/header_menu/header_menu'; +import { useFetchSloGlobalDiagnosis } from '../../hooks/use_fetch_global_diagnosis'; import { SloOutdatedCallout } from '../../components/slo/slo_outdated_callout'; +import { HeaderMenu } from '../../components/header_menu/header_menu'; export function SlosWelcomePage() { const { @@ -48,7 +48,7 @@ export function SlosWelcomePage() { const hasRequiredReadPrivileges = !!globalDiagnosis?.userPrivileges.read.has_all_requested; const handleClickCreateSlo = () => { - navigateToUrl(basePath.prepend(paths.observability.sloCreate)); + navigateToUrl(basePath.prepend(paths.sloCreate)); }; const hasSlosAndHasPermissions = @@ -56,7 +56,7 @@ export function SlosWelcomePage() { useEffect(() => { if (hasSlosAndHasPermissions) { - navigateToUrl(basePath.prepend(paths.observability.slos)); + navigateToUrl(basePath.prepend(paths.slos)); } }, [basePath, hasSlosAndHasPermissions, navigateToUrl]); @@ -68,7 +68,7 @@ export function SlosWelcomePage() { title={

- {i18n.translate('xpack.observability.slo.sloList.welcomePrompt.title', { + {i18n.translate('xpack.slo.sloList.welcomePrompt.title', { defaultMessage: 'Track and deliver on your SLOs', })}

@@ -81,14 +81,14 @@ export function SlosWelcomePage() { body={ <>

- {i18n.translate('xpack.observability.slo.sloList.welcomePrompt.messageParagraph1', { + {i18n.translate('xpack.slo.sloList.welcomePrompt.messageParagraph1', { defaultMessage: 'Measure key metrics important to the business, such as service-level indicators and service-level objectives (SLIs/SLOs) to deliver on SLAs.', })}

- {i18n.translate('xpack.observability.slo.sloList.welcomePrompt.messageParagraph2', { + {i18n.translate('xpack.slo.sloList.welcomePrompt.messageParagraph2', { defaultMessage: 'Easily report the uptime and reliability of your services to stakeholders with real-time insights.', })} @@ -103,12 +103,9 @@ export function SlosWelcomePage() { - {i18n.translate( - 'xpack.observability.slo.sloList.welcomePrompt.getStartedMessage', - { - defaultMessage: 'To get started, create your first SLO.', - } - )} + {i18n.translate('xpack.slo.sloList.welcomePrompt.getStartedMessage', { + defaultMessage: 'To get started, create your first SLO.', + })} @@ -122,7 +119,7 @@ export function SlosWelcomePage() { onClick={handleClickCreateSlo} disabled={!hasWriteCapabilities || !hasRequiredWritePrivileges} > - {i18n.translate('xpack.observability.slo.sloList.welcomePrompt.buttonLabel', { + {i18n.translate('xpack.slo.sloList.welcomePrompt.buttonLabel', { defaultMessage: 'Create SLO', })} @@ -134,13 +131,10 @@ export function SlosWelcomePage() { - {i18n.translate( - 'xpack.observability.slo.sloList.welcomePrompt.needLicenseMessage', - { - defaultMessage: - 'You need an Elastic Cloud subscription or Platinum license to use SLOs.', - } - )} + {i18n.translate('xpack.slo.sloList.welcomePrompt.needLicenseMessage', { + defaultMessage: + 'You need an Elastic Cloud subscription or Platinum license to use SLOs.', + })} @@ -154,12 +148,9 @@ export function SlosWelcomePage() { target="_blank" data-test-subj="slosPageWelcomePromptSignupForCloudButton" > - {i18n.translate( - 'xpack.observability.slo.sloList.welcomePrompt.signupForCloud', - { - defaultMessage: 'Sign up for Elastic Cloud', - } - )} + {i18n.translate('xpack.slo.sloList.welcomePrompt.signupForCloud', { + defaultMessage: 'Sign up for Elastic Cloud', + })} @@ -169,12 +160,9 @@ export function SlosWelcomePage() { target="_blank" data-test-subj="slosPageWelcomePromptSignupForLicenseButton" > - {i18n.translate( - 'xpack.observability.slo.sloList.welcomePrompt.signupForLicense', - { - defaultMessage: 'Sign up for license', - } - )} + {i18n.translate('xpack.slo.sloList.welcomePrompt.signupForLicense', { + defaultMessage: 'Sign up for license', + })} @@ -187,7 +175,7 @@ export function SlosWelcomePage() { <> - {i18n.translate('xpack.observability.slo.sloList.welcomePrompt.learnMore', { + {i18n.translate('xpack.slo.sloList.welcomePrompt.learnMore', { defaultMessage: 'Want to learn more?', })} @@ -198,7 +186,7 @@ export function SlosWelcomePage() { href="https://www.elastic.co/guide/en/observability/current/slo.html" target="_blank" > - {i18n.translate('xpack.observability.slo.sloList.welcomePrompt.learnMoreLink', { + {i18n.translate('xpack.slo.sloList.welcomePrompt.learnMoreLink', { defaultMessage: 'Read the docs', })} diff --git a/x-pack/plugins/observability_solution/slo/public/plugin.mock.tsx b/x-pack/plugins/observability_solution/slo/public/plugin.mock.tsx new file mode 100644 index 0000000000000..602f4ee21436a --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/plugin.mock.tsx @@ -0,0 +1,72 @@ +/* + * 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 { mockCasesContract } from '@kbn/cases-plugin/public/mocks'; +import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; +import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; +import { sharePluginMock } from '@kbn/share-plugin/public/mocks'; +import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks'; +import { lensPluginMock } from '@kbn/lens-plugin/public/mocks'; + +const triggersActionsUiStartMock = { + createStart() { + return { + ruleTypeRegistry: { + has: jest.fn(), + register: jest.fn(), + get: jest.fn(), + list: jest.fn(), + }, + actionTypeRegistry: { + has: jest.fn((x) => true), + register: jest.fn(), + get: jest.fn(), + list: jest.fn(), + }, + }; + }, +}; + +const dataViewEditor = { + createStart() { + return { + userPermissions: { + editDataView: jest.fn(), + }, + }; + }, +}; + +const dataViews = { + createStart() { + return { + getIds: jest.fn().mockImplementation(() => []), + get: jest.fn(), + create: jest.fn().mockImplementation(() => ({ + fields: { + getByName: jest.fn(), + }, + })), + }; + }, +}; + +export const sloPublicPluginsStartMock = { + createStart() { + return { + cases: mockCasesContract(), + charts: chartPluginMock.createStartContract(), + data: dataPluginMock.createStartContract(), + dataViewEditor: dataViewEditor.createStart(), + dataViews: dataViews.createStart(), + lens: lensPluginMock.createStartContract(), + share: sharePluginMock.createStartContract(), + triggersActionsUi: triggersActionsUiStartMock.createStart(), + unifiedSearch: unifiedSearchPluginMock.createStartContract(), + }; + }, +}; diff --git a/x-pack/plugins/observability_solution/slo/public/plugin.ts b/x-pack/plugins/observability_solution/slo/public/plugin.ts new file mode 100644 index 0000000000000..45bd9abb95ef1 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/plugin.ts @@ -0,0 +1,153 @@ +/* + * 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 { + App, + AppMountParameters, + AppUpdater, + CoreSetup, + CoreStart, + DEFAULT_APP_CATEGORIES, + Plugin, + PluginInitializerContext, +} from '@kbn/core/public'; +import { BehaviorSubject, firstValueFrom } from 'rxjs'; +import { SloPublicPluginsSetup, SloPublicPluginsStart } from './types'; +import { PLUGIN_NAME, sloAppId } from '../common'; +import type { SloPublicSetup, SloPublicStart } from './types'; +import { SloDetailsLocatorDefinition } from './locators/slo_details'; +import { SloEditLocatorDefinition } from './locators/slo_edit'; +import { SloListLocatorDefinition } from './locators/slo_list'; +import { SLOS_BASE_PATH } from '../common/locators/paths'; +import { getCreateSLOFlyoutLazy } from './pages/slo_edit/shared_flyout/get_create_slo_flyout'; +import { registerBurnRateRuleType } from './rules/register_burn_rate_rule_type'; + +export class SloPlugin + implements Plugin +{ + private readonly appUpdater$ = new BehaviorSubject(() => ({})); + + constructor(private readonly initContext: PluginInitializerContext) {} + + public setup( + coreSetup: CoreSetup, + pluginsSetup: SloPublicPluginsSetup + ) { + const kibanaVersion = this.initContext.env.packageInfo.version; + + const sloDetailsLocator = pluginsSetup.share.url.locators.create( + new SloDetailsLocatorDefinition() + ); + const sloEditLocator = pluginsSetup.share.url.locators.create(new SloEditLocatorDefinition()); + const sloListLocator = pluginsSetup.share.url.locators.create(new SloListLocatorDefinition()); + + const mount = async (params: AppMountParameters) => { + const { renderApp } = await import('./application'); + const [coreStart, pluginsStart] = await coreSetup.getStartServices(); + const { ruleTypeRegistry, actionTypeRegistry } = pluginsStart.triggersActionsUi; + const { observabilityRuleTypeRegistry } = pluginsStart.observability; + + return renderApp({ + appMountParameters: params, + core: coreStart, + isDev: this.initContext.env.mode.dev, + observabilityRuleTypeRegistry, + kibanaVersion, + usageCollection: pluginsSetup.usageCollection, + ObservabilityPageTemplate: pluginsStart.observabilityShared.navigation.PageTemplate, + plugins: { ...pluginsStart, ruleTypeRegistry, actionTypeRegistry }, + isServerless: !!pluginsStart.serverless, + }); + }; + const appUpdater$ = this.appUpdater$; + const app: App = { + id: sloAppId, + title: PLUGIN_NAME, + order: 8002, + updater$: appUpdater$, + euiIconType: 'logoObservability', + appRoute: SLOS_BASE_PATH, + category: DEFAULT_APP_CATEGORIES.observability, + mount, + keywords: ['observability', 'monitor', 'slos'], + }; + // Register an application into the side navigation menu + coreSetup.application.register(app); + + registerBurnRateRuleType(pluginsSetup.observability.observabilityRuleTypeRegistry); + + const assertPlatinumLicense = async () => { + const licensing = await pluginsSetup.licensing; + const license = await firstValueFrom(licensing.license$); + + const hasPlatinumLicense = license.hasAtLeast('platinum'); + if (hasPlatinumLicense) { + const registerSloOverviewEmbeddableFactory = async () => { + const { SloOverviewEmbeddableFactoryDefinition } = await import( + './embeddable/slo/overview/slo_embeddable_factory' + ); + const factory = new SloOverviewEmbeddableFactoryDefinition(coreSetup.getStartServices); + pluginsSetup.embeddable.registerEmbeddableFactory(factory.type, factory); + }; + registerSloOverviewEmbeddableFactory(); + const registerSloAlertsEmbeddableFactory = async () => { + const { SloAlertsEmbeddableFactoryDefinition } = await import( + './embeddable/slo/alerts/slo_alerts_embeddable_factory' + ); + const factory = new SloAlertsEmbeddableFactoryDefinition( + coreSetup.getStartServices, + kibanaVersion + ); + pluginsSetup.embeddable.registerEmbeddableFactory(factory.type, factory); + }; + registerSloAlertsEmbeddableFactory(); + + const registerSloErrorBudgetEmbeddableFactory = async () => { + const { SloErrorBudgetEmbeddableFactoryDefinition } = await import( + './embeddable/slo/error_budget/slo_error_budget_embeddable_factory' + ); + const factory = new SloErrorBudgetEmbeddableFactoryDefinition(coreSetup.getStartServices); + pluginsSetup.embeddable.registerEmbeddableFactory(factory.type, factory); + }; + registerSloErrorBudgetEmbeddableFactory(); + + const registerAsyncSloAlertsUiActions = async () => { + if (pluginsSetup.uiActions) { + const { registerSloAlertsUiActions } = await import('./ui_actions'); + registerSloAlertsUiActions(pluginsSetup.uiActions, coreSetup); + } + }; + registerAsyncSloAlertsUiActions(); + } + }; + assertPlatinumLicense(); + + return { + sloDetailsLocator, + sloEditLocator, + sloListLocator, + }; + } + + public start(coreStart: CoreStart, pluginsStart: SloPublicPluginsStart) { + const kibanaVersion = this.initContext.env.packageInfo.version; + const { ruleTypeRegistry, actionTypeRegistry } = pluginsStart.triggersActionsUi; + + return { + getCreateSLOFlyout: getCreateSLOFlyoutLazy({ + core: coreStart, + isDev: this.initContext.env.mode.dev, + kibanaVersion, + observabilityRuleTypeRegistry: pluginsStart.observability.observabilityRuleTypeRegistry, + ObservabilityPageTemplate: pluginsStart.observabilityShared.navigation.PageTemplate, + plugins: { ...pluginsStart, ruleTypeRegistry, actionTypeRegistry }, + isServerless: !!pluginsStart.serverless, + }), + }; + } + + public stop() {} +} diff --git a/x-pack/plugins/observability_solution/slo/public/routes/routes.tsx b/x-pack/plugins/observability_solution/slo/public/routes/routes.tsx new file mode 100644 index 0000000000000..7ba21c8befa0f --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/routes/routes.tsx @@ -0,0 +1,66 @@ +/* + * 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 React from 'react'; +import { SlosPage } from '../pages/slos/slos'; +import { SlosWelcomePage } from '../pages/slos_welcome/slos_welcome'; +import { SloDetailsPage } from '../pages/slo_details/slo_details'; +import { SloEditPage } from '../pages/slo_edit/slo_edit'; +import { + SLOS_OUTDATED_DEFINITIONS_PATH, + SLOS_PATH, + SLOS_WELCOME_PATH, + SLO_CREATE_PATH, + SLO_DETAIL_PATH, + SLO_EDIT_PATH, +} from '../../common/locators/paths'; +import { SlosOutdatedDefinitions } from '../pages/slo_outdated_definitions'; + +export const routes = { + [SLOS_PATH]: { + handler: () => { + return ; + }, + params: {}, + exact: true, + }, + [SLO_CREATE_PATH]: { + handler: () => { + return ; + }, + params: {}, + exact: true, + }, + [SLOS_WELCOME_PATH]: { + handler: () => { + return ; + }, + params: {}, + exact: true, + }, + [SLOS_OUTDATED_DEFINITIONS_PATH]: { + handler: () => { + return ; + }, + params: {}, + exact: true, + }, + [SLO_EDIT_PATH]: { + handler: () => { + return ; + }, + params: {}, + exact: true, + }, + [SLO_DETAIL_PATH]: { + handler: () => { + return ; + }, + params: {}, + exact: true, + }, +}; diff --git a/x-pack/plugins/observability_solution/slo/public/rules/observability_rule_type_registry_mock.ts b/x-pack/plugins/observability_solution/slo/public/rules/observability_rule_type_registry_mock.ts new file mode 100644 index 0000000000000..7400ccd3b524a --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/rules/observability_rule_type_registry_mock.ts @@ -0,0 +1,18 @@ +/* + * 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 { ObservabilityRuleTypeRegistry } from '@kbn/observability-plugin/public'; + +const createRuleTypeRegistryMock = () => ({ + getFormatter: () => () => 'a reason', + registerFormatter: () => {}, + list: () => ['ruleType1', 'ruleType2'], +}); + +export const createObservabilityRuleTypeRegistryMock = () => + createRuleTypeRegistryMock() as ObservabilityRuleTypeRegistry & + ReturnType; diff --git a/x-pack/plugins/observability_solution/slo/public/rules/register_burn_rate_rule_type.ts b/x-pack/plugins/observability_solution/slo/public/rules/register_burn_rate_rule_type.ts new file mode 100644 index 0000000000000..20df312441f14 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/rules/register_burn_rate_rule_type.ts @@ -0,0 +1,79 @@ +/* + * 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 { lazy } from 'react'; +import { i18n } from '@kbn/i18n'; +import { ALERT_REASON } from '@kbn/rule-data-utils'; +import { ObservabilityRuleTypeRegistry } from '@kbn/observability-plugin/public/rules/create_observability_rule_type_registry'; +import { SLO_BURN_RATE_RULE_TYPE_ID } from '@kbn/rule-data-utils'; +import { SLO_ID_FIELD, SLO_INSTANCE_ID_FIELD } from '../../common/field_names/slo'; +import { validateBurnRateRule } from '../components/burn_rate_rule_editor/validation'; + +const sloBurnRateDefaultActionMessage = i18n.translate( + 'xpack.slo.rules.burnRate.defaultActionMessage', + { + defaultMessage: `\\{\\{context.reason\\}\\} + +\\{\\{rule.name\\}\\} is active with the following conditions: + +- SLO: \\{\\{context.sloName\\}\\}' +- The burn rate over the last \\{\\{context.longWindow.duration\\}\\} is \\{\\{context.longWindow.burnRate\\}\\} +- The burn rate over the last \\{\\{context.shortWindow.duration\\}\\} is \\{\\{context.shortWindow.burnRate\\}\\} +- Threshold: \\{\\{context.burnRateThreshold\\}\\} + +[View alert details](\\{\\{context.alertDetailsUrl\\}\\}) +`, + } +); +const sloBurnRateDefaultRecoveryMessage = i18n.translate( + 'xpack.slo.rules.burnRate.defaultRecoveryMessage', + { + defaultMessage: `\\{\\{context.reason\\}\\} + +\\{\\{rule.name\\}\\} has recovered. + +- SLO: \\{\\{context.sloName\\}\\}' +- The burn rate over the last \\{\\{context.longWindow.duration\\}\\} is \\{\\{context.longWindow.burnRate\\}\\} +- The burn rate over the last \\{\\{context.shortWindow.duration\\}\\} is \\{\\{context.shortWindow.burnRate\\}\\} +- Threshold: \\{\\{context.burnRateThreshold\\}\\} + +[View alert details](\\{\\{context.alertDetailsUrl\\}\\}) +`, + } +); + +export const registerBurnRateRuleType = async ( + observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry +) => { + observabilityRuleTypeRegistry.register({ + id: SLO_BURN_RATE_RULE_TYPE_ID, + description: i18n.translate('xpack.slo.rules.burnRate.description', { + defaultMessage: 'Alert when your SLO burn rate is too high over a defined period of time.', + }), + format: ({ fields }) => { + return { + reason: fields[ALERT_REASON] ?? '-', + link: `/app/slos/${fields[SLO_ID_FIELD]}?instanceId=${ + fields[SLO_INSTANCE_ID_FIELD] ?? '*' + }`, + }; + }, + iconClass: 'bell', + documentationUrl(docLinks) { + return `${docLinks.links.observability.sloBurnRateRule}`; + }, + ruleParamsExpression: lazy(() => import('../components/burn_rate_rule_editor')), + validate: validateBurnRateRule, + requiresAppContext: false, + defaultActionMessage: sloBurnRateDefaultActionMessage, + defaultRecoveryMessage: sloBurnRateDefaultRecoveryMessage, + alertDetailsAppSection: lazy( + () => import('../components/slo/burn_rate/alert_details/alert_details_app_section') + ), + priority: 100, + }); +}; diff --git a/x-pack/plugins/observability_solution/slo/public/types.ts b/x-pack/plugins/observability_solution/slo/public/types.ts new file mode 100644 index 0000000000000..8677862b3afd9 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/types.ts @@ -0,0 +1,106 @@ +/* + * 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 { ToastsStart } from '@kbn/core/public'; +import { + ObservabilityPublicSetup, + ObservabilityPublicStart, +} from '@kbn/observability-plugin/public'; +import type { + ObservabilitySharedPluginSetup, + ObservabilitySharedPluginStart, +} from '@kbn/observability-shared-plugin/public'; +import type { ChartsPluginStart } from '@kbn/charts-plugin/public'; +import type { EmbeddableStart } from '@kbn/embeddable-plugin/public'; +import type { EmbeddableSetup } from '@kbn/embeddable-plugin/public'; +import type { + TriggersAndActionsUIPublicPluginSetup, + TriggersAndActionsUIPublicPluginStart, +} from '@kbn/triggers-actions-ui-plugin/public'; +import type { NavigationPublicPluginStart } from '@kbn/navigation-plugin/public'; +import type { LicensingPluginSetup } from '@kbn/licensing-plugin/public'; +import { SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public'; +import { LicensingPluginStart } from '@kbn/licensing-plugin/public'; +import type { UiActionsStart, UiActionsSetup } from '@kbn/ui-actions-plugin/public'; +import type { PresentationUtilPluginStart } from '@kbn/presentation-util-plugin/public'; +import { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public'; +import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; +import type { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; +import { + ActionTypeRegistryContract, + RuleTypeRegistryContract, +} from '@kbn/triggers-actions-ui-plugin/public'; +import type { CloudStart } from '@kbn/cloud-plugin/public'; +import type { + UsageCollectionSetup, + UsageCollectionStart, +} from '@kbn/usage-collection-plugin/public'; +import { + ObservabilityAIAssistantPublicSetup, + ObservabilityAIAssistantPublicStart, +} from '@kbn/observability-ai-assistant-plugin/public'; +import { SecurityPluginStart } from '@kbn/security-plugin/public'; +import { SpacesPluginStart } from '@kbn/spaces-plugin/public'; +import type { LensPublicStart } from '@kbn/lens-plugin/public'; +import { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public'; +import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; +import type { IUiSettingsClient } from '@kbn/core/public'; +import { CasesPublicStart } from '@kbn/cases-plugin/public'; +import type { DiscoverStart } from '@kbn/discover-plugin/public'; +import { DataViewFieldEditorStart } from '@kbn/data-view-field-editor-plugin/public'; + +import { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; +import { SloPlugin } from './plugin'; + +export interface SloPublicPluginsSetup { + data: DataPublicPluginSetup; + observability: ObservabilityPublicSetup; + observabilityShared: ObservabilitySharedPluginSetup; + triggersActionsUi: TriggersAndActionsUIPublicPluginSetup; + licensing: LicensingPluginSetup; + share: SharePluginSetup; + embeddable: EmbeddableSetup; + uiActions: UiActionsSetup; + serverless?: ServerlessPluginSetup; + presentationUtil?: PresentationUtilPluginStart; + observabilityAIAssistant: ObservabilityAIAssistantPublicSetup; + usageCollection: UsageCollectionSetup; +} + +export interface SloPublicPluginsStart { + actionTypeRegistry: ActionTypeRegistryContract; + cases: CasesPublicStart; + cloud?: CloudStart; + dataViewEditor: DataViewEditorStart; + fieldFormats: FieldFormatsStart; + observability: ObservabilityPublicStart; + observabilityShared: ObservabilitySharedPluginStart; + triggersActionsUi: TriggersAndActionsUIPublicPluginStart; + navigation: NavigationPublicPluginStart; + security: SecurityPluginStart; + spaces?: SpacesPluginStart; + share: SharePluginStart; + licensing: LicensingPluginStart; + embeddable: EmbeddableStart; + uiActions: UiActionsStart; + presentationUtil: PresentationUtilPluginStart; + serverless?: ServerlessPluginStart; + data: DataPublicPluginStart; + dataViews: DataViewsPublicPluginStart; + ruleTypeRegistry: RuleTypeRegistryContract; + observabilityAIAssistant: ObservabilityAIAssistantPublicStart; + lens: LensPublicStart; + charts: ChartsPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; + uiSettings: IUiSettingsClient; + usageCollection: UsageCollectionStart; + discover: DiscoverStart; + dataViewFieldEditor: DataViewFieldEditorStart; + toastNotifications: ToastsStart; +} + +export type SloPublicSetup = ReturnType; +export type SloPublicStart = ReturnType; diff --git a/x-pack/plugins/observability_solution/slo/public/typings/index.ts b/x-pack/plugins/observability_solution/slo/public/typings/index.ts new file mode 100644 index 0000000000000..78f557bdcbc7d --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/typings/index.ts @@ -0,0 +1,8 @@ +/* + * 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. + */ + +export * from './slo'; diff --git a/x-pack/plugins/observability_solution/observability/public/typings/slo/index.ts b/x-pack/plugins/observability_solution/slo/public/typings/slo/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/typings/slo/index.ts rename to x-pack/plugins/observability_solution/slo/public/typings/slo/index.ts diff --git a/x-pack/plugins/observability_solution/observability/public/ui_actions/edit_slo_alerts_panel.tsx b/x-pack/plugins/observability_solution/slo/public/ui_actions/edit_slo_alerts_panel.tsx similarity index 87% rename from x-pack/plugins/observability_solution/observability/public/ui_actions/edit_slo_alerts_panel.tsx rename to x-pack/plugins/observability_solution/slo/public/ui_actions/edit_slo_alerts_panel.tsx index b920c47caa352..9c9137c3b0214 100644 --- a/x-pack/plugins/observability_solution/observability/public/ui_actions/edit_slo_alerts_panel.tsx +++ b/x-pack/plugins/observability_solution/slo/public/ui_actions/edit_slo_alerts_panel.tsx @@ -11,7 +11,7 @@ import { ViewMode } from '@kbn/embeddable-plugin/common'; import type { CoreSetup } from '@kbn/core/public'; import { IEmbeddable, EmbeddableOutput } from '@kbn/embeddable-plugin/public'; import { SLO_ALERTS_EMBEDDABLE } from '../embeddable/slo/constants'; -import { ObservabilityPublicPluginsStart, ObservabilityPublicStart } from '..'; +import { SloPublicPluginsStart, SloPublicStart } from '..'; import { SloAlertsEmbeddableInput } from '../embeddable/slo/alerts/types'; export const EDIT_SLO_ALERTS_ACTION = 'editSloAlertsPanelAction'; @@ -19,10 +19,7 @@ export interface EditSloAlertsPanelContext { embeddable: IEmbeddable; } export function createEditSloAlertsPanelAction( - getStartServices: CoreSetup< - ObservabilityPublicPluginsStart, - ObservabilityPublicStart - >['getStartServices'] + getStartServices: CoreSetup['getStartServices'] ): UiActionsActionDefinition { return { id: EDIT_SLO_ALERTS_ACTION, @@ -31,7 +28,7 @@ export function createEditSloAlertsPanelAction( return 'pencil'; }, getDisplayName: () => - i18n.translate('xpack.observability.actions.editSloAlertsEmbeddableTitle', { + i18n.translate('xpack.slo.actions.editSloAlertsEmbeddableTitle', { defaultMessage: 'Edit configuration', }), async execute({ embeddable }) { diff --git a/x-pack/plugins/observability_solution/observability/public/ui_actions/index.ts b/x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts similarity index 85% rename from x-pack/plugins/observability_solution/observability/public/ui_actions/index.ts rename to x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts index 59929b54f597f..48ba2d5086cc5 100644 --- a/x-pack/plugins/observability_solution/observability/public/ui_actions/index.ts +++ b/x-pack/plugins/observability_solution/slo/public/ui_actions/index.ts @@ -9,11 +9,11 @@ import type { UiActionsSetup } from '@kbn/ui-actions-plugin/public'; import { CONTEXT_MENU_TRIGGER } from '@kbn/embeddable-plugin/public'; import type { CoreSetup } from '@kbn/core/public'; import { createEditSloAlertsPanelAction } from './edit_slo_alerts_panel'; -import { ObservabilityPublicPluginsStart, ObservabilityPublicStart } from '..'; +import { SloPublicPluginsStart, SloPublicStart } from '..'; export function registerSloAlertsUiActions( uiActions: UiActionsSetup, - core: CoreSetup + core: CoreSetup ) { // Initialize actions const editSloAlertsPanelAction = createEditSloAlertsPanelAction(core.getStartServices); diff --git a/x-pack/plugins/observability_solution/slo/public/utils/kibana_react.mock.ts b/x-pack/plugins/observability_solution/slo/public/utils/kibana_react.mock.ts new file mode 100644 index 0000000000000..9090a1e72bfaa --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/utils/kibana_react.mock.ts @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* + * 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 { casesPluginMock } from '@kbn/cases-plugin/public/mocks'; +import { coreMock, notificationServiceMock, overlayServiceMock } from '@kbn/core/public/mocks'; +import { sloPublicPluginsStartMock } from '../plugin.mock'; + +export const kibanaStartMock = { + startContract() { + return { + notifications: notificationServiceMock.createStartContract(), + overlays: overlayServiceMock.createStartContract(), + services: { + ...coreMock.createStart(), + ...sloPublicPluginsStartMock.createStart(), + storage: coreMock.createStorage(), + cases: { ...casesPluginMock.createStartContract() }, + }, + }; + }, +}; diff --git a/x-pack/plugins/observability_solution/slo/public/utils/kibana_react.ts b/x-pack/plugins/observability_solution/slo/public/utils/kibana_react.ts new file mode 100644 index 0000000000000..20ec03497b0af --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/utils/kibana_react.ts @@ -0,0 +1,22 @@ +/* + * 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 { CoreStart } from '@kbn/core/public'; +import { useKibana } from '@kbn/kibana-react-plugin/public'; +import { Storage } from '@kbn/kibana-utils-plugin/public'; +import { SloPublicPluginsStart } from '../types'; + +export type StartServices = CoreStart & + SloPublicPluginsStart & + AdditionalServices & { + storage: Storage; + kibanaVersion: string; + }; +const useTypedKibana = () => + useKibana>(); + +export { useTypedKibana as useKibana }; diff --git a/x-pack/plugins/observability_solution/observability/public/utils/slo/chart_data_formatter.ts b/x-pack/plugins/observability_solution/slo/public/utils/slo/chart_data_formatter.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/utils/slo/chart_data_formatter.ts rename to x-pack/plugins/observability_solution/slo/public/utils/slo/chart_data_formatter.ts diff --git a/x-pack/plugins/observability_solution/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts b/x-pack/plugins/observability_solution/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts rename to x-pack/plugins/observability_solution/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts diff --git a/x-pack/plugins/observability_solution/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts b/x-pack/plugins/observability_solution/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts rename to x-pack/plugins/observability_solution/slo/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts diff --git a/x-pack/plugins/observability_solution/observability/public/utils/slo/duration.ts b/x-pack/plugins/observability_solution/slo/public/utils/slo/duration.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/utils/slo/duration.ts rename to x-pack/plugins/observability_solution/slo/public/utils/slo/duration.ts diff --git a/x-pack/plugins/observability_solution/observability/public/utils/slo/get_delay_in_seconds_from_slo.ts b/x-pack/plugins/observability_solution/slo/public/utils/slo/get_delay_in_seconds_from_slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/utils/slo/get_delay_in_seconds_from_slo.ts rename to x-pack/plugins/observability_solution/slo/public/utils/slo/get_delay_in_seconds_from_slo.ts diff --git a/x-pack/plugins/observability_solution/observability/public/utils/slo/get_discover_link.ts b/x-pack/plugins/observability_solution/slo/public/utils/slo/get_discover_link.ts similarity index 93% rename from x-pack/plugins/observability_solution/observability/public/utils/slo/get_discover_link.ts rename to x-pack/plugins/observability_solution/slo/public/utils/slo/get_discover_link.ts index 7023ee1ddd4df..ab09353becb92 100644 --- a/x-pack/plugins/observability_solution/observability/public/utils/slo/get_discover_link.ts +++ b/x-pack/plugins/observability_solution/slo/public/utils/slo/get_discover_link.ts @@ -8,9 +8,9 @@ import { DiscoverStart } from '@kbn/discover-plugin/public'; import { ALL_VALUE, kqlWithFiltersSchema, SLOWithSummaryResponse } from '@kbn/slo-schema'; import { Filter, FilterStateStore, TimeRange } from '@kbn/es-query'; import { i18n } from '@kbn/i18n'; +import { buildEsQuery } from '@kbn/observability-plugin/public'; import { v4 } from 'uuid'; import { isEmpty } from 'lodash'; -import { buildEsQuery } from '../build_es_query'; function createDiscoverLocator( slo: SLOWithSummaryResponse, @@ -50,7 +50,7 @@ function createDiscoverLocator( $state: { store: FilterStateStore.APP_STATE }, meta: { type: 'custom', - alias: i18n.translate('xpack.observability.slo.sloDetails.goodFilterLabel', { + alias: i18n.translate('xpack.slo.sloDetails.goodFilterLabel', { defaultMessage: 'Good events', }), disabled: !showGood, @@ -64,7 +64,7 @@ function createDiscoverLocator( $state: { store: FilterStateStore.APP_STATE }, meta: { type: 'custom', - alias: i18n.translate('xpack.observability.slo.sloDetails.badFilterLabel', { + alias: i18n.translate('xpack.slo.sloDetails.badFilterLabel', { defaultMessage: 'Bad events', }), disabled: !showBad, @@ -78,7 +78,7 @@ function createDiscoverLocator( $state: { store: FilterStateStore.APP_STATE }, meta: { type: 'custom', - alias: i18n.translate('xpack.observability.slo.sloDetails.totalFilterLabel', { + alias: i18n.translate('xpack.slo.sloDetails.totalFilterLabel', { defaultMessage: 'Total events', }), value: JSON.stringify(customTotalFilter), diff --git a/x-pack/plugins/observability_solution/observability/public/utils/slo/groupings.ts b/x-pack/plugins/observability_solution/slo/public/utils/slo/groupings.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/utils/slo/groupings.ts rename to x-pack/plugins/observability_solution/slo/public/utils/slo/groupings.ts diff --git a/x-pack/plugins/observability_solution/observability/public/utils/slo/indicator.ts b/x-pack/plugins/observability_solution/slo/public/utils/slo/indicator.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/public/utils/slo/indicator.ts rename to x-pack/plugins/observability_solution/slo/public/utils/slo/indicator.ts diff --git a/x-pack/plugins/observability_solution/observability/public/utils/slo/labels.ts b/x-pack/plugins/observability_solution/slo/public/utils/slo/labels.ts similarity index 61% rename from x-pack/plugins/observability_solution/observability/public/utils/slo/labels.ts rename to x-pack/plugins/observability_solution/slo/public/utils/slo/labels.ts index f7dd0bd9fd728..5f41cec14a162 100644 --- a/x-pack/plugins/observability_solution/observability/public/utils/slo/labels.ts +++ b/x-pack/plugins/observability_solution/slo/public/utils/slo/labels.ts @@ -10,40 +10,32 @@ import { SLOWithSummaryResponse } from '@kbn/slo-schema'; import { assertNever } from '@kbn/std'; import { toDuration } from './duration'; -export const INDICATOR_CUSTOM_KQL = i18n.translate('xpack.observability.slo.indicators.customKql', { +export const INDICATOR_CUSTOM_KQL = i18n.translate('xpack.slo.indicators.customKql', { defaultMessage: 'Custom KQL', }); -export const INDICATOR_CUSTOM_METRIC = i18n.translate( - 'xpack.observability.slo.indicators.customMetric', - { - defaultMessage: 'Custom Metric', - } -); +export const INDICATOR_CUSTOM_METRIC = i18n.translate('xpack.slo.indicators.customMetric', { + defaultMessage: 'Custom Metric', +}); -export const INDICATOR_TIMESLICE_METRIC = i18n.translate( - 'xpack.observability.slo.indicators.timesliceMetric', - { - defaultMessage: 'Timeslice Metric', - } -); +export const INDICATOR_TIMESLICE_METRIC = i18n.translate('xpack.slo.indicators.timesliceMetric', { + defaultMessage: 'Timeslice Metric', +}); -export const INDICATOR_HISTOGRAM = i18n.translate('xpack.observability.slo.indicators.histogram', { +export const INDICATOR_HISTOGRAM = i18n.translate('xpack.slo.indicators.histogram', { defaultMessage: 'Histogram Metric', }); -export const INDICATOR_APM_LATENCY = i18n.translate( - 'xpack.observability.slo.indicators.apmLatency', - { defaultMessage: 'APM latency' } -); +export const INDICATOR_APM_LATENCY = i18n.translate('xpack.slo.indicators.apmLatency', { + defaultMessage: 'APM latency', +}); -export const INDICATOR_APM_AVAILABILITY = i18n.translate( - 'xpack.observability.slo.indicators.apmAvailability', - { defaultMessage: 'APM availability' } -); +export const INDICATOR_APM_AVAILABILITY = i18n.translate('xpack.slo.indicators.apmAvailability', { + defaultMessage: 'APM availability', +}); export const INDICATOR_SYNTHETICS_AVAILABILITY = i18n.translate( - 'xpack.observability.slo.indicators.syntheticsAvailability', + 'xpack.slo.indicators.syntheticsAvailability', { defaultMessage: 'Synthetics availability' } ); @@ -78,53 +70,50 @@ export function toIndicatorTypeLabel( } export const BUDGETING_METHOD_OCCURRENCES = i18n.translate( - 'xpack.observability.slo.budgetingMethod.occurrences', + 'xpack.slo.budgetingMethod.occurrences', { defaultMessage: 'Occurrences', } ); -export const BUDGETING_METHOD_TIMESLICES = i18n.translate( - 'xpack.observability.slo.budgetingMethod.timeslices', - { - defaultMessage: 'Timeslices', - } -); +export const BUDGETING_METHOD_TIMESLICES = i18n.translate('xpack.slo.budgetingMethod.timeslices', { + defaultMessage: 'Timeslices', +}); export function toDurationLabel(durationStr: string): string { const duration = toDuration(durationStr); switch (duration.unit) { case 'm': - return i18n.translate('xpack.observability.slo.duration.minute', { + return i18n.translate('xpack.slo.duration.minute', { defaultMessage: '{duration, plural, one {1 minute} other {# minutes}}', values: { duration: duration.value, }, }); case 'h': - return i18n.translate('xpack.observability.slo.duration.hour', { + return i18n.translate('xpack.slo.duration.hour', { defaultMessage: '{duration, plural, one {1 hour} other {# hours}}', values: { duration: duration.value, }, }); case 'd': - return i18n.translate('xpack.observability.slo.duration.day', { + return i18n.translate('xpack.slo.duration.day', { defaultMessage: '{duration, plural, one {1 day} other {# days}}', values: { duration: duration.value, }, }); case 'w': - return i18n.translate('xpack.observability.slo.duration.week', { + return i18n.translate('xpack.slo.duration.week', { defaultMessage: '{duration, plural, one {1 week} other {# weeks}}', values: { duration: duration.value, }, }); case 'M': - return i18n.translate('xpack.observability.slo.duration.month', { + return i18n.translate('xpack.slo.duration.month', { defaultMessage: '{duration, plural, one {1 month} other {# months}}', values: { duration: duration.value, @@ -138,23 +127,23 @@ export function toDurationAdverbLabel(durationStr: string): string { switch (duration.unit) { case 'm': - return i18n.translate('xpack.observability.slo.duration.minutely', { + return i18n.translate('xpack.slo.duration.minutely', { defaultMessage: 'Minutely', }); case 'h': - return i18n.translate('xpack.observability.slo.duration.hourly', { + return i18n.translate('xpack.slo.duration.hourly', { defaultMessage: 'Hourly', }); case 'd': - return i18n.translate('xpack.observability.slo.duration.daily', { + return i18n.translate('xpack.slo.duration.daily', { defaultMessage: 'Daily', }); case 'w': - return i18n.translate('xpack.observability.slo.duration.weekly', { + return i18n.translate('xpack.slo.duration.weekly', { defaultMessage: 'Weekly', }); case 'M': - return i18n.translate('xpack.observability.slo.duration.monthly', { + return i18n.translate('xpack.slo.duration.monthly', { defaultMessage: 'Monthly', }); } diff --git a/x-pack/plugins/observability_solution/slo/public/utils/test_helper.tsx b/x-pack/plugins/observability_solution/slo/public/utils/test_helper.tsx new file mode 100644 index 0000000000000..5744a802f6aff --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/public/utils/test_helper.tsx @@ -0,0 +1,74 @@ +/* + * 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 React from 'react'; +import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; +import { render as testLibRender } from '@testing-library/react'; +import { AppMountParameters } from '@kbn/core/public'; +import { coreMock } from '@kbn/core/public/mocks'; +import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; +import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; +import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; +import translations from '@kbn/translations-plugin/translations/ja-JP.json'; +import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; +import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; + +import { createObservabilityRuleTypeRegistryMock } from '@kbn/observability-plugin/public'; +import { PluginContext } from '../context/plugin_context'; + +const appMountParameters = { setHeaderActionMenu: () => {} } as unknown as AppMountParameters; +const observabilityRuleTypeRegistry = createObservabilityRuleTypeRegistryMock(); + +export const core = coreMock.createStart(); +export const data = dataPluginMock.createStartContract(); + +const queryClient = new QueryClient({ + defaultOptions: { + queries: { + retry: false, + }, + }, + logger: { + // eslint-disable-next-line no-console + log: console.log, + // eslint-disable-next-line no-console + warn: console.warn, + error: () => {}, + }, +}); + +export const render = (component: React.ReactNode) => { + return testLibRender( + // @ts-ignore + +

Embeddable exploratory view
, + }, + }} + > + + + {component} + + + + + ); +}; diff --git a/x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_mappings_template.ts b/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_mappings_template.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_mappings_template.ts rename to x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_mappings_template.ts index 175def562c63f..16b1ba9bd71c5 100644 --- a/x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_mappings_template.ts +++ b/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_mappings_template.ts @@ -5,7 +5,7 @@ * 2.0. */ import type { ClusterPutComponentTemplateRequest } from '@elastic/elasticsearch/lib/api/types'; -import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants'; +import { SLO_RESOURCES_VERSION } from '../../../common/constants'; export const getSLOMappingsTemplate = (name: string): ClusterPutComponentTemplateRequest => ({ name, diff --git a/x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_settings_template.ts b/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_settings_template.ts similarity index 89% rename from x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_settings_template.ts rename to x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_settings_template.ts index 37abff5bdc46d..5e8845a050688 100644 --- a/x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_settings_template.ts +++ b/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_settings_template.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants'; +import { SLO_RESOURCES_VERSION } from '../../../common/constants'; export const getSLOSettingsTemplate = (name: string) => ({ name, diff --git a/x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_summary_mappings_template.ts b/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_summary_mappings_template.ts similarity index 98% rename from x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_summary_mappings_template.ts rename to x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_summary_mappings_template.ts index 5b3ba4b0965a3..63dddabf24940 100644 --- a/x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_summary_mappings_template.ts +++ b/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_summary_mappings_template.ts @@ -5,7 +5,7 @@ * 2.0. */ import type { ClusterPutComponentTemplateRequest } from '@elastic/elasticsearch/lib/api/types'; -import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants'; +import { SLO_RESOURCES_VERSION } from '../../../common/constants'; export const getSLOSummaryMappingsTemplate = ( name: string diff --git a/x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_summary_settings_template.ts b/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_summary_settings_template.ts similarity index 89% rename from x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_summary_settings_template.ts rename to x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_summary_settings_template.ts index 9995e2239d07f..f9b18c7f62555 100644 --- a/x-pack/plugins/observability_solution/observability/server/assets/component_templates/slo_summary_settings_template.ts +++ b/x-pack/plugins/observability_solution/slo/server/assets/component_templates/slo_summary_settings_template.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants'; +import { SLO_RESOURCES_VERSION } from '../../../common/constants'; export const getSLOSummarySettingsTemplate = (name: string) => ({ name, diff --git a/x-pack/plugins/observability_solution/observability/server/assets/index_templates/slo_index_templates.ts b/x-pack/plugins/observability_solution/slo/server/assets/index_templates/slo_index_templates.ts similarity index 89% rename from x-pack/plugins/observability_solution/observability/server/assets/index_templates/slo_index_templates.ts rename to x-pack/plugins/observability_solution/slo/server/assets/index_templates/slo_index_templates.ts index ae6f179476b22..6524d6e7d49cf 100644 --- a/x-pack/plugins/observability_solution/observability/server/assets/index_templates/slo_index_templates.ts +++ b/x-pack/plugins/observability_solution/slo/server/assets/index_templates/slo_index_templates.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants'; +import { SLO_RESOURCES_VERSION } from '../../../common/constants'; export const getSLOIndexTemplate = (name: string, indexPattern: string, composedOf: string[]) => ({ name, diff --git a/x-pack/plugins/observability_solution/observability/server/assets/index_templates/slo_summary_index_templates.ts b/x-pack/plugins/observability_solution/slo/server/assets/index_templates/slo_summary_index_templates.ts similarity index 89% rename from x-pack/plugins/observability_solution/observability/server/assets/index_templates/slo_summary_index_templates.ts rename to x-pack/plugins/observability_solution/slo/server/assets/index_templates/slo_summary_index_templates.ts index 2e613c4273bab..3986273ca99ce 100644 --- a/x-pack/plugins/observability_solution/observability/server/assets/index_templates/slo_summary_index_templates.ts +++ b/x-pack/plugins/observability_solution/slo/server/assets/index_templates/slo_summary_index_templates.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants'; +import { SLO_RESOURCES_VERSION } from '../../../common/constants'; export const getSLOSummaryIndexTemplate = ( name: string, diff --git a/x-pack/plugins/observability_solution/observability/server/assets/ingest_templates/slo_pipeline_template.ts b/x-pack/plugins/observability_solution/slo/server/assets/ingest_templates/slo_pipeline_template.ts similarity index 92% rename from x-pack/plugins/observability_solution/observability/server/assets/ingest_templates/slo_pipeline_template.ts rename to x-pack/plugins/observability_solution/slo/server/assets/ingest_templates/slo_pipeline_template.ts index 6a3a6684ab191..bceb324dd21fd 100644 --- a/x-pack/plugins/observability_solution/observability/server/assets/ingest_templates/slo_pipeline_template.ts +++ b/x-pack/plugins/observability_solution/slo/server/assets/ingest_templates/slo_pipeline_template.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants'; +import { SLO_RESOURCES_VERSION } from '../../../common/constants'; export const getSLOPipelineTemplate = (id: string, indexNamePrefix: string) => ({ id, diff --git a/x-pack/plugins/observability_solution/observability/server/assets/ingest_templates/slo_summary_pipeline_template.ts b/x-pack/plugins/observability_solution/slo/server/assets/ingest_templates/slo_summary_pipeline_template.ts similarity index 99% rename from x-pack/plugins/observability_solution/observability/server/assets/ingest_templates/slo_summary_pipeline_template.ts rename to x-pack/plugins/observability_solution/slo/server/assets/ingest_templates/slo_summary_pipeline_template.ts index 627407104a6e4..967a1f4af6e91 100644 --- a/x-pack/plugins/observability_solution/observability/server/assets/ingest_templates/slo_summary_pipeline_template.ts +++ b/x-pack/plugins/observability_solution/slo/server/assets/ingest_templates/slo_summary_pipeline_template.ts @@ -8,7 +8,7 @@ import { timeslicesBudgetingMethodSchema } from '@kbn/slo-schema'; import { IngestPutPipelineRequest } from '@elastic/elasticsearch/lib/api/types'; import { IBasePath } from '@kbn/core-http-server'; -import { getSLOSummaryPipelineId, SLO_RESOURCES_VERSION } from '../../../common/slo/constants'; +import { getSLOSummaryPipelineId, SLO_RESOURCES_VERSION } from '../../../common/constants'; import { SLO } from '../../domain/models'; export const getSLOSummaryPipelineTemplate = ( diff --git a/x-pack/plugins/observability_solution/observability/server/assets/transform_templates/slo_transform_template.ts b/x-pack/plugins/observability_solution/slo/server/assets/transform_templates/slo_transform_template.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/assets/transform_templates/slo_transform_template.ts rename to x-pack/plugins/observability_solution/slo/server/assets/transform_templates/slo_transform_template.ts index 152517d7aa775..17c48bb8414a9 100644 --- a/x-pack/plugins/observability_solution/observability/server/assets/transform_templates/slo_transform_template.ts +++ b/x-pack/plugins/observability_solution/slo/server/assets/transform_templates/slo_transform_template.ts @@ -12,7 +12,7 @@ import { TransformSource, TransformTimeSync, } from '@elastic/elasticsearch/lib/api/types'; -import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants'; +import { SLO_RESOURCES_VERSION } from '../../../common/constants'; export interface TransformSettings { frequency: TransformPutTransformRequest['frequency']; diff --git a/x-pack/plugins/observability_solution/slo/server/common/constants.ts b/x-pack/plugins/observability_solution/slo/server/common/constants.ts new file mode 100644 index 0000000000000..deaf49e3a42f1 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/common/constants.ts @@ -0,0 +1,8 @@ +/* + * 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. + */ + +export const SLO_RULE_REGISTRATION_CONTEXT = 'observability.slo'; diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/common.ts b/x-pack/plugins/observability_solution/slo/server/domain/models/common.ts new file mode 100644 index 0000000000000..e1f747cde8d88 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/models/common.ts @@ -0,0 +1,27 @@ +/* + * 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 * as t from 'io-ts'; + +import { + dateRangeSchema, + historicalSummarySchema, + statusSchema, + summarySchema, + groupingsSchema, + groupSummarySchema, + metaSchema, +} from '@kbn/slo-schema'; + +type Status = t.TypeOf; +type DateRange = t.TypeOf; +type HistoricalSummary = t.TypeOf; +type Summary = t.TypeOf; +type Groupings = t.TypeOf; +type Meta = t.TypeOf; +type GroupSummary = t.TypeOf; + +export type { DateRange, Groupings, HistoricalSummary, Meta, Status, Summary, GroupSummary }; diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/error_budget.ts b/x-pack/plugins/observability_solution/slo/server/domain/models/error_budget.ts new file mode 100644 index 0000000000000..50ca6e469d7dd --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/models/error_budget.ts @@ -0,0 +1,13 @@ +/* + * 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 * as t from 'io-ts'; +import { errorBudgetSchema } from '@kbn/slo-schema'; + +type ErrorBudget = t.TypeOf; + +export type { ErrorBudget }; diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/index.ts b/x-pack/plugins/observability_solution/slo/server/domain/models/index.ts new file mode 100644 index 0000000000000..16336c40928f8 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/models/index.ts @@ -0,0 +1,13 @@ +/* + * 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. + */ + +export * from './common'; +export { Duration, DurationUnit, toDurationUnit, toMomentUnitOfTime } from '@kbn/slo-schema'; +export * from './error_budget'; +export * from './indicators'; +export * from './slo'; +export * from './time_window'; diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/indicators.ts b/x-pack/plugins/observability_solution/slo/server/domain/models/indicators.ts new file mode 100644 index 0000000000000..100c04dfda35b --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/models/indicators.ts @@ -0,0 +1,35 @@ +/* + * 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 * as t from 'io-ts'; +import { + apmTransactionDurationIndicatorSchema, + apmTransactionErrorRateIndicatorSchema, + indicatorDataSchema, + indicatorSchema, + indicatorTypesSchema, + kqlCustomIndicatorSchema, + metricCustomIndicatorSchema, +} from '@kbn/slo-schema'; + +type APMTransactionErrorRateIndicator = t.TypeOf; +type APMTransactionDurationIndicator = t.TypeOf; +type KQLCustomIndicator = t.TypeOf; +type MetricCustomIndicator = t.TypeOf; +type Indicator = t.TypeOf; +type IndicatorTypes = t.TypeOf; +type IndicatorData = t.TypeOf; + +export type { + Indicator, + IndicatorTypes, + APMTransactionErrorRateIndicator, + APMTransactionDurationIndicator, + KQLCustomIndicator, + MetricCustomIndicator, + IndicatorData, +}; diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/slo.ts b/x-pack/plugins/observability_solution/slo/server/domain/models/slo.ts new file mode 100644 index 0000000000000..d17498c3dbfed --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/models/slo.ts @@ -0,0 +1,16 @@ +/* + * 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 * as t from 'io-ts'; +import { sloIdSchema, sloSchema, sloWithSummarySchema } from '@kbn/slo-schema'; + +type SLO = t.TypeOf; +type SLOId = t.TypeOf; +type SLOWithSummary = t.TypeOf; +type StoredSLO = t.OutputOf; + +export type { SLO, SLOWithSummary, SLOId, StoredSLO }; diff --git a/x-pack/plugins/observability_solution/slo/server/domain/models/time_window.ts b/x-pack/plugins/observability_solution/slo/server/domain/models/time_window.ts new file mode 100644 index 0000000000000..aa12aa70a8ae8 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/models/time_window.ts @@ -0,0 +1,46 @@ +/* + * 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 { + calendarAlignedTimeWindowSchema, + rollingTimeWindowSchema, + timeWindowSchema, +} from '@kbn/slo-schema'; +import moment from 'moment'; +import * as t from 'io-ts'; + +type TimeWindow = t.TypeOf; +type RollingTimeWindow = t.TypeOf; +type CalendarAlignedTimeWindow = t.TypeOf; + +export type { RollingTimeWindow, TimeWindow, CalendarAlignedTimeWindow }; + +export function toCalendarAlignedTimeWindowMomentUnit( + timeWindow: CalendarAlignedTimeWindow +): moment.unitOfTime.StartOf { + const unit = timeWindow.duration.unit; + switch (unit) { + case 'w': + return 'isoWeeks'; + case 'M': + return 'months'; + default: + throw new Error(`Invalid calendar aligned time window duration unit: ${unit}`); + } +} + +export function toRollingTimeWindowMomentUnit( + timeWindow: RollingTimeWindow +): moment.unitOfTime.Diff { + const unit = timeWindow.duration.unit; + switch (unit) { + case 'd': + return 'days'; + default: + throw new Error(`Invalid rolling time window duration unit: ${unit}`); + } +} diff --git a/x-pack/plugins/observability_solution/observability/server/domain/services/compute_burn_rate.test.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_burn_rate.test.ts similarity index 92% rename from x-pack/plugins/observability_solution/observability/server/domain/services/compute_burn_rate.test.ts rename to x-pack/plugins/observability_solution/slo/server/domain/services/compute_burn_rate.test.ts index 84fef850e096c..5a3eae37eba8f 100644 --- a/x-pack/plugins/observability_solution/observability/server/domain/services/compute_burn_rate.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_burn_rate.test.ts @@ -7,8 +7,8 @@ import { computeBurnRate } from './compute_burn_rate'; import { toDateRange } from './date_range'; -import { createSLO } from '../../services/slo/fixtures/slo'; -import { ninetyDaysRolling } from '../../services/slo/fixtures/time_window'; +import { createSLO } from '../../services/fixtures/slo'; +import { ninetyDaysRolling } from '../../services/fixtures/time_window'; describe('computeBurnRate', () => { it('computes 0 when total is 0', () => { diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/compute_burn_rate.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_burn_rate.ts new file mode 100644 index 0000000000000..2cd758c4c3a74 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_burn_rate.ts @@ -0,0 +1,24 @@ +/* + * 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 { toHighPrecision } from '../../utils/number'; +import { IndicatorData, SLO } from '../models'; + +/** + * A Burn Rate is computed with the Indicator Data retrieved from a specific lookback period + * It tells how fast we are consumming our error budget during a specific period + */ +export function computeBurnRate(slo: SLO, sliData: IndicatorData): number { + const { good, total } = sliData; + if (total === 0 || good >= total) { + return 0; + } + + const errorBudget = 1 - slo.objective.target; + const errorRate = 1 - good / total; + return toHighPrecision(errorRate / errorBudget); +} diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/compute_sli.test.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_sli.test.ts new file mode 100644 index 0000000000000..79494de1d7cf1 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_sli.test.ts @@ -0,0 +1,26 @@ +/* + * 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 { computeSLI } from './compute_sli'; + +describe('computeSLI', () => { + it('returns -1 when no total events', () => { + expect(computeSLI(100, 0)).toEqual(-1); + }); + + it('returns the sli value', () => { + expect(computeSLI(100, 1000)).toEqual(0.1); + }); + + it('returns when good is greater than total events', () => { + expect(computeSLI(9999, 9)).toEqual(1111); + }); + + it('returns rounds the value to 6 digits', () => { + expect(computeSLI(33, 90)).toEqual(0.366667); + }); +}); diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/compute_sli.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_sli.ts new file mode 100644 index 0000000000000..bafab79104134 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_sli.ts @@ -0,0 +1,18 @@ +/* + * 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 { toHighPrecision } from '../../utils/number'; + +const NO_DATA = -1; + +export function computeSLI(good: number, total: number): number { + if (total === 0) { + return NO_DATA; + } + + return toHighPrecision(good / total); +} diff --git a/x-pack/plugins/observability_solution/observability/server/domain/services/compute_summary_status.test.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_summary_status.test.ts similarity index 91% rename from x-pack/plugins/observability_solution/observability/server/domain/services/compute_summary_status.test.ts rename to x-pack/plugins/observability_solution/slo/server/domain/services/compute_summary_status.test.ts index 12ee6de644b4a..9060f0e95272c 100644 --- a/x-pack/plugins/observability_solution/observability/server/domain/services/compute_summary_status.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_summary_status.test.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { createErrorBudget } from '../../services/slo/fixtures/error_budget'; -import { createSLO } from '../../services/slo/fixtures/slo'; +import { createErrorBudget } from '../../services/fixtures/error_budget'; +import { createSLO } from '../../services/fixtures/slo'; import { computeSummaryStatus } from './compute_summary_status'; describe('ComputeSummaryStatus', () => { diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/compute_summary_status.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_summary_status.ts new file mode 100644 index 0000000000000..3aaaffe180b6a --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/compute_summary_status.ts @@ -0,0 +1,20 @@ +/* + * 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 { ErrorBudget, SLO, Status } from '../models'; + +export function computeSummaryStatus(slo: SLO, sliValue: number, errorBudget: ErrorBudget): Status { + if (sliValue === -1) { + return 'NO_DATA'; + } + + if (sliValue >= slo.objective.target) { + return 'HEALTHY'; + } else { + return errorBudget.remaining > 0 ? 'DEGRADING' : 'VIOLATED'; + } +} diff --git a/x-pack/plugins/observability_solution/observability/server/domain/services/date_range.test.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/date_range.test.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/domain/services/date_range.test.ts rename to x-pack/plugins/observability_solution/slo/server/domain/services/date_range.test.ts index 524aecbfab10f..6fed100b8a06a 100644 --- a/x-pack/plugins/observability_solution/observability/server/domain/services/date_range.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/date_range.test.ts @@ -11,7 +11,7 @@ import { sevenDaysRolling, thirtyDaysRolling, weeklyCalendarAligned, -} from '../../services/slo/fixtures/time_window'; +} from '../../services/fixtures/time_window'; import { toDateRange } from './date_range'; const NOW = new Date('2022-08-11T08:31:00.000Z'); diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/date_range.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/date_range.ts new file mode 100644 index 0000000000000..9c54197aa39e3 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/date_range.ts @@ -0,0 +1,40 @@ +/* + * 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 { calendarAlignedTimeWindowSchema, rollingTimeWindowSchema } from '@kbn/slo-schema'; +import { assertNever } from '@kbn/std'; +import moment from 'moment'; +import { DateRange } from '../models'; +import { + TimeWindow, + toCalendarAlignedTimeWindowMomentUnit, + toRollingTimeWindowMomentUnit, +} from '../models/time_window'; + +export const toDateRange = (timeWindow: TimeWindow, currentDate: Date = new Date()): DateRange => { + if (calendarAlignedTimeWindowSchema.is(timeWindow)) { + const unit = toCalendarAlignedTimeWindowMomentUnit(timeWindow); + const from = moment.utc(currentDate).startOf(unit); + const to = moment.utc(currentDate).endOf(unit); + + return { from: from.toDate(), to: to.toDate() }; + } + + if (rollingTimeWindowSchema.is(timeWindow)) { + const unit = toRollingTimeWindowMomentUnit(timeWindow); + const now = moment.utc(currentDate).startOf('minute'); + const from = now.clone().subtract(timeWindow.duration.value, unit); + const to = now.clone(); + + return { + from: from.toDate(), + to: to.toDate(), + }; + } + + assertNever(timeWindow); +}; diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/error_budget.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/error_budget.ts new file mode 100644 index 0000000000000..74165c5eec560 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/error_budget.ts @@ -0,0 +1,22 @@ +/* + * 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 { toHighPrecision } from '../../utils/number'; +import { ErrorBudget } from '../models'; + +export function toErrorBudget( + initial: number, + consumed: number, + isEstimated: boolean = false +): ErrorBudget { + return { + initial: toHighPrecision(initial), + consumed: toHighPrecision(consumed), + remaining: toHighPrecision(1 - consumed), + isEstimated, + }; +} diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/get_delay_in_seconds_from_slo.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/get_delay_in_seconds_from_slo.ts new file mode 100644 index 0000000000000..e6cef17750394 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/get_delay_in_seconds_from_slo.ts @@ -0,0 +1,18 @@ +/* + * 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 { timeslicesBudgetingMethodSchema } from '@kbn/slo-schema'; +import { SLO } from '../models'; + +export function getDelayInSecondsFromSLO(slo: SLO) { + const fixedInterval = timeslicesBudgetingMethodSchema.is(slo.budgetingMethod) + ? slo.objective.timesliceWindow!.asSeconds() + : 60; + const syncDelay = slo.settings.syncDelay.asSeconds(); + const frequency = slo.settings.frequency.asSeconds(); + return fixedInterval + syncDelay + frequency; +} diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/get_lookback_date_range.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/get_lookback_date_range.ts new file mode 100644 index 0000000000000..63ed12a7244c0 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/get_lookback_date_range.ts @@ -0,0 +1,23 @@ +/* + * 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 moment from 'moment'; +import { Duration, toMomentUnitOfTime } from '../models'; +export function getLookbackDateRange( + startedAt: Date, + duration: Duration, + delayInSeconds = 0 +): { from: Date; to: Date } { + const unit = toMomentUnitOfTime(duration.unit); + const now = moment(startedAt).subtract(delayInSeconds, 'seconds').startOf('minute'); + const from = now.clone().subtract(duration.value, unit).startOf('minute'); + + return { + from: from.toDate(), + to: now.toDate(), + }; +} diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/index.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/index.ts new file mode 100644 index 0000000000000..212647f27b172 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/index.ts @@ -0,0 +1,13 @@ +/* + * 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. + */ + +export * from './compute_burn_rate'; +export * from './error_budget'; +export * from './compute_sli'; +export * from './compute_summary_status'; +export * from './date_range'; +export * from './validate_slo'; diff --git a/x-pack/plugins/observability_solution/observability/server/domain/services/validate_slo.test.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/validate_slo.test.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/domain/services/validate_slo.test.ts rename to x-pack/plugins/observability_solution/slo/server/domain/services/validate_slo.test.ts index 70cc408ceb175..f4f8142e8986a 100644 --- a/x-pack/plugins/observability_solution/observability/server/domain/services/validate_slo.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/validate_slo.test.ts @@ -6,9 +6,9 @@ */ import { validateSLO } from '.'; -import { oneMinute, sixHours } from '../../services/slo/fixtures/duration'; -import { createSLO } from '../../services/slo/fixtures/slo'; -import { sevenDaysRolling } from '../../services/slo/fixtures/time_window'; +import { oneMinute, sixHours } from '../../services/fixtures/duration'; +import { createSLO } from '../../services/fixtures/slo'; +import { sevenDaysRolling } from '../../services/fixtures/time_window'; import { Duration, DurationUnit } from '../models'; describe('validateSLO', () => { diff --git a/x-pack/plugins/observability_solution/slo/server/domain/services/validate_slo.ts b/x-pack/plugins/observability_solution/slo/server/domain/services/validate_slo.ts new file mode 100644 index 0000000000000..eb253f44cdf5a --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/domain/services/validate_slo.ts @@ -0,0 +1,122 @@ +/* + * 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 { + timeslicesBudgetingMethodSchema, + Duration, + DurationUnit, + rollingTimeWindowSchema, + calendarAlignedTimeWindowSchema, +} from '@kbn/slo-schema'; +import { IllegalArgumentError } from '../../errors'; +import { SLO } from '../models'; + +/** + * Asserts the SLO is valid from a business invariants point of view. + * e.g. a 'target' objective requires a number between ]0, 1] + * e.g. a 'timeslices' budgeting method requires an objective's timeslice_target to be defined. + * + * @param slo {SLO} + */ +export function validateSLO(slo: SLO) { + if (!isValidId(slo.id)) { + throw new IllegalArgumentError('Invalid id'); + } + + if (!isValidTargetNumber(slo.objective.target)) { + throw new IllegalArgumentError('Invalid objective.target'); + } + + if ( + rollingTimeWindowSchema.is(slo.timeWindow) && + !isValidRollingTimeWindowDuration(slo.timeWindow.duration) + ) { + throw new IllegalArgumentError('Invalid time_window.duration'); + } + + if ( + calendarAlignedTimeWindowSchema.is(slo.timeWindow) && + !isValidCalendarAlignedTimeWindowDuration(slo.timeWindow.duration) + ) { + throw new IllegalArgumentError('Invalid time_window.duration'); + } + + if (timeslicesBudgetingMethodSchema.is(slo.budgetingMethod)) { + if ( + slo.objective.timesliceTarget === undefined || + !isValidTargetNumber(slo.objective.timesliceTarget) + ) { + throw new IllegalArgumentError('Invalid objective.timeslice_target'); + } + + if ( + slo.objective.timesliceWindow === undefined || + !isValidTimesliceWindowDuration(slo.objective.timesliceWindow, slo.timeWindow.duration) + ) { + throw new IllegalArgumentError('Invalid objective.timeslice_window'); + } + } + + validateSettings(slo); +} + +function validateSettings(slo: SLO) { + if (!isValidFrequencySettings(slo.settings.frequency)) { + throw new IllegalArgumentError('Invalid settings.frequency'); + } + + if (!isValidSyncDelaySettings(slo.settings.syncDelay)) { + throw new IllegalArgumentError('Invalid settings.sync_delay'); + } +} + +function isValidId(id: string): boolean { + const MIN_ID_LENGTH = 8; + const MAX_ID_LENGTH = 36; + return MIN_ID_LENGTH <= id.length && id.length <= MAX_ID_LENGTH; +} + +function isValidTargetNumber(value: number): boolean { + return value > 0 && value < 1; +} + +function isValidRollingTimeWindowDuration(duration: Duration): boolean { + // 7, 30 or 90days accepted + return duration.unit === DurationUnit.Day && [7, 30, 90].includes(duration.value); +} + +function isValidCalendarAlignedTimeWindowDuration(duration: Duration): boolean { + // 1 week or 1 month + return [DurationUnit.Week, DurationUnit.Month].includes(duration.unit) && duration.value === 1; +} + +function isValidTimesliceWindowDuration(timesliceWindow: Duration, timeWindow: Duration): boolean { + return ( + [DurationUnit.Minute, DurationUnit.Hour].includes(timesliceWindow.unit) && + timesliceWindow.isShorterThan(timeWindow) + ); +} + +/** + * validate that 1 minute <= frequency < 1 hour + */ +function isValidFrequencySettings(frequency: Duration): boolean { + return ( + frequency.isLongerOrEqualThan(new Duration(1, DurationUnit.Minute)) && + frequency.isShorterThan(new Duration(1, DurationUnit.Hour)) + ); +} + +/** + * validate that 1 minute <= sync_delay < 6 hour + */ +function isValidSyncDelaySettings(syncDelay: Duration): boolean { + return ( + syncDelay.isLongerOrEqualThan(new Duration(1, DurationUnit.Minute)) && + syncDelay.isShorterThan(new Duration(6, DurationUnit.Hour)) + ); +} diff --git a/x-pack/plugins/observability_solution/slo/server/errors/errors.ts b/x-pack/plugins/observability_solution/slo/server/errors/errors.ts new file mode 100644 index 0000000000000..eaec36e66d08b --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/errors/errors.ts @@ -0,0 +1,26 @@ +/* + * 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. + */ + +/* eslint-disable max-classes-per-file */ + +export class ObservabilityError extends Error { + constructor(message?: string) { + super(message); + this.name = this.constructor.name; + } +} + +export class SLONotFound extends ObservabilityError {} +export class SLOIdConflict extends ObservabilityError {} + +export class InvalidQueryError extends ObservabilityError {} +export class InternalQueryError extends ObservabilityError {} +export class NotSupportedError extends ObservabilityError {} +export class IllegalArgumentError extends ObservabilityError {} +export class InvalidTransformError extends ObservabilityError {} + +export class SecurityException extends ObservabilityError {} diff --git a/x-pack/plugins/observability_solution/slo/server/errors/handler.ts b/x-pack/plugins/observability_solution/slo/server/errors/handler.ts new file mode 100644 index 0000000000000..c10f1d98c083e --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/errors/handler.ts @@ -0,0 +1,24 @@ +/* + * 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 { ObservabilityError, SecurityException, SLOIdConflict, SLONotFound } from './errors'; + +export function getHTTPResponseCode(error: ObservabilityError): number { + if (error instanceof SLONotFound) { + return 404; + } + + if (error instanceof SLOIdConflict) { + return 409; + } + + if (error instanceof SecurityException) { + return 403; + } + + return 400; +} diff --git a/x-pack/plugins/observability_solution/slo/server/errors/index.ts b/x-pack/plugins/observability_solution/slo/server/errors/index.ts new file mode 100644 index 0000000000000..e466d5b8ae4a1 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/errors/index.ts @@ -0,0 +1,9 @@ +/* + * 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. + */ + +export * from './errors'; +export * from './handler'; diff --git a/x-pack/plugins/observability_solution/slo/server/index.ts b/x-pack/plugins/observability_solution/slo/server/index.ts new file mode 100644 index 0000000000000..1707a7c692952 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/index.ts @@ -0,0 +1,29 @@ +/* + * 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 { PluginInitializerContext } from '@kbn/core/server'; +import { schema, TypeOf } from '@kbn/config-schema'; + +// This exports static code and TypeScript types, +// as well as, Kibana Platform `plugin()` initializer. + +export async function plugin(initializerContext: PluginInitializerContext) { + const { SloPlugin } = await import('./plugin'); + return new SloPlugin(initializerContext); +} + +export type { PluginSetup, PluginStart } from './plugin'; + +const configSchema = schema.object({ + sloOrphanSummaryCleanUpTaskEnabled: schema.boolean({ defaultValue: true }), + enabled: schema.boolean({ defaultValue: true }), +}); + +export const config = { + schema: configSchema, +}; +export type SloConfig = TypeOf; diff --git a/x-pack/plugins/observability_solution/observability/server/lib/collectors/fetcher.test.ts b/x-pack/plugins/observability_solution/slo/server/lib/collectors/fetcher.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/lib/collectors/fetcher.test.ts rename to x-pack/plugins/observability_solution/slo/server/lib/collectors/fetcher.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/lib/collectors/fetcher.ts b/x-pack/plugins/observability_solution/slo/server/lib/collectors/fetcher.ts similarity index 99% rename from x-pack/plugins/observability_solution/observability/server/lib/collectors/fetcher.ts rename to x-pack/plugins/observability_solution/slo/server/lib/collectors/fetcher.ts index f8657b71d410c..566a5e88a5cfe 100644 --- a/x-pack/plugins/observability_solution/observability/server/lib/collectors/fetcher.ts +++ b/x-pack/plugins/observability_solution/slo/server/lib/collectors/fetcher.ts @@ -4,7 +4,6 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - import { CollectorFetchContext } from '@kbn/usage-collection-plugin/server'; import { StoredSLO } from '../../domain/models'; import { SO_SLO_TYPE } from '../../saved_objects'; diff --git a/x-pack/plugins/observability_solution/observability/server/lib/collectors/register.ts b/x-pack/plugins/observability_solution/slo/server/lib/collectors/register.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/lib/collectors/register.ts rename to x-pack/plugins/observability_solution/slo/server/lib/collectors/register.ts diff --git a/x-pack/plugins/observability_solution/observability/server/lib/collectors/type.ts b/x-pack/plugins/observability_solution/slo/server/lib/collectors/type.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/lib/collectors/type.ts rename to x-pack/plugins/observability_solution/slo/server/lib/collectors/type.ts diff --git a/x-pack/plugins/observability_solution/slo/server/lib/rules/register_burn_rate_rule.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/register_burn_rate_rule.ts new file mode 100644 index 0000000000000..8ddaffdc05fad --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/lib/rules/register_burn_rate_rule.ts @@ -0,0 +1,54 @@ +/* + * 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 { PluginSetupContract } from '@kbn/alerting-plugin/server'; +import { IBasePath, Logger } from '@kbn/core/server'; +import { + createLifecycleExecutor, + Dataset, + IRuleDataService, +} from '@kbn/rule-registry-plugin/server'; +import { mappingFromFieldMap } from '@kbn/alerting-plugin/common'; +import { legacyExperimentalFieldMap } from '@kbn/alerts-as-data-utils'; +import { CustomThresholdLocators } from '@kbn/observability-plugin/server'; +import { sloFeatureId } from '@kbn/observability-plugin/common'; +import { SLO_RULE_REGISTRATION_CONTEXT } from '../../common/constants'; +import { sloBurnRateRuleType } from './slo_burn_rate'; +import { sloRuleFieldMap } from './slo_burn_rate/field_map'; + +export function registerBurnRateRule( + alertingPlugin: PluginSetupContract, + basePath: IBasePath, + logger: Logger, + ruleDataService: IRuleDataService, + locators: CustomThresholdLocators // TODO move this somewhere else, or use only alertsLocator +) { + // SLO RULE + const ruleDataClientSLO = ruleDataService.initializeIndex({ + feature: sloFeatureId, + registrationContext: SLO_RULE_REGISTRATION_CONTEXT, + dataset: Dataset.alerts, + componentTemplateRefs: [], + componentTemplates: [ + { + name: 'mappings', + mappings: mappingFromFieldMap( + { ...legacyExperimentalFieldMap, ...sloRuleFieldMap }, + 'strict' + ), + }, + ], + }); + + const createLifecycleRuleExecutorSLO = createLifecycleExecutor( + logger.get('rules'), + ruleDataClientSLO + ); + alertingPlugin.registerType( + sloBurnRateRuleType(createLifecycleRuleExecutorSLO, basePath, locators.alertsLocator) + ); +} diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/docs/params_property_slo_burn_rate.yaml b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/docs/params_property_slo_burn_rate.yaml similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/docs/params_property_slo_burn_rate.yaml rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/docs/params_property_slo_burn_rate.yaml diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/executor.test.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/executor.test.ts similarity index 99% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/executor.test.ts rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/executor.test.ts index 6be334dc62f2b..4796a6c976205 100644 --- a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/executor.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/executor.test.ts @@ -26,9 +26,9 @@ import { SanitizedRuleConfig } from '@kbn/alerting-plugin/common'; import { Alert, RuleExecutorServices } from '@kbn/alerting-plugin/server'; import { DEFAULT_FLAPPING_SETTINGS } from '@kbn/alerting-plugin/common/rules_settings'; import { LocatorPublic } from '@kbn/share-plugin/common'; -import type { AlertsLocatorParams } from '../../../../common'; +import { AlertsLocatorParams } from '@kbn/observability-plugin/common'; import { getRuleExecutor } from './executor'; -import { createSLO } from '../../../services/slo/fixtures/slo'; +import { createSLO } from '../../../services/fixtures/slo'; import { SLO, StoredSLO } from '../../../domain/models'; import { SharePluginStart } from '@kbn/share-plugin/server'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/executor.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/executor.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/executor.ts rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/executor.ts index 3454406f5619c..3a8e153c76663 100644 --- a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/executor.ts +++ b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/executor.ts @@ -20,14 +20,14 @@ import { LocatorPublic } from '@kbn/share-plugin/common'; import { upperCase } from 'lodash'; import { addSpaceIdToPath } from '@kbn/spaces-plugin/server'; import { ALL_VALUE } from '@kbn/slo-schema'; -import { AlertsLocatorParams, getAlertUrl } from '../../../../common'; +import { AlertsLocatorParams, getAlertUrl } from '@kbn/observability-plugin/common'; import { SLO_ID_FIELD, SLO_INSTANCE_ID_FIELD, SLO_REVISION_FIELD, } from '../../../../common/field_names/slo'; import { Duration } from '../../../domain/models'; -import { KibanaSavedObjectsSLORepository } from '../../../services/slo'; +import { KibanaSavedObjectsSLORepository } from '../../../services'; import { AlertStates, BurnRateAlertContext, @@ -235,7 +235,7 @@ function buildReason( windowDef: WindowSchema ) { if (instanceId === ALL_VALUE) { - return i18n.translate('xpack.observability.slo.alerting.burnRate.reason', { + return i18n.translate('xpack.slo.alerting.burnRate.reason', { defaultMessage: '{actionGroupName}: The burn rate for the past {longWindowDuration} is {longWindowBurnRate} and for the past {shortWindowDuration} is {shortWindowBurnRate}. Alert when above {burnRateThreshold} for both windows', values: { @@ -248,7 +248,7 @@ function buildReason( }, }); } - return i18n.translate('xpack.observability.slo.alerting.burnRate.reasonForInstanceId', { + return i18n.translate('xpack.slo.alerting.burnRate.reasonForInstanceId', { defaultMessage: '{actionGroupName}: The burn rate for the past {longWindowDuration} is {longWindowBurnRate} and for the past {shortWindowDuration} is {shortWindowBurnRate} for {instanceId}. Alert when above {burnRateThreshold} for both windows', values: { diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/field_map.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/field_map.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/field_map.ts rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/field_map.ts diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/fixtures/rule.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/fixtures/rule.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/fixtures/rule.ts rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/fixtures/rule.ts diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/index.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/index.ts rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/index.ts diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/lib/__snapshots__/build_query.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/__snapshots__/build_query.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/lib/__snapshots__/build_query.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/__snapshots__/build_query.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/lib/build_query.test.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/build_query.test.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/lib/build_query.test.ts rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/build_query.test.ts index a77db347edacd..86f7ab4994dba 100644 --- a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/lib/build_query.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/build_query.test.ts @@ -11,7 +11,7 @@ import { createKQLCustomIndicator, createSLO, createSLOWithTimeslicesBudgetingMethod, -} from '../../../../services/slo/fixtures/slo'; +} from '../../../../services/fixtures/slo'; const STARTED_AT = new Date('2023-01-01T00:00:00.000Z'); diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/lib/build_query.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/build_query.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/lib/build_query.ts rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/build_query.ts diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/lib/evaluate.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/evaluate.ts similarity index 99% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/lib/evaluate.ts rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/evaluate.ts index 45ebba7bb2693..ef13974c6a771 100644 --- a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/lib/evaluate.ts +++ b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/lib/evaluate.ts @@ -9,7 +9,7 @@ import { ElasticsearchClient } from '@kbn/core/server'; import { get } from 'lodash'; import { Duration, SLO, toDurationUnit } from '../../../../domain/models'; import { BurnRateRuleParams } from '../types'; -import { SLO_DESTINATION_INDEX_PATTERN } from '../../../../../common/slo/constants'; +import { SLO_DESTINATION_INDEX_PATTERN } from '../../../../../common/constants'; import { buildQuery, EvaluationAfterKey, diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/register.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/register.ts similarity index 85% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/register.ts rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/register.ts index f70dc3721cb20..8c87d3ee71bbd 100644 --- a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/register.ts +++ b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/register.ts @@ -14,8 +14,10 @@ import { createLifecycleExecutor } from '@kbn/rule-registry-plugin/server'; import { legacyExperimentalFieldMap } from '@kbn/alerts-as-data-utils'; import { IBasePath } from '@kbn/core/server'; import { LocatorPublic } from '@kbn/share-plugin/common'; +import { AlertsLocatorParams, observabilityPaths } from '@kbn/observability-plugin/common'; +import { SLO_BURN_RATE_RULE_TYPE_ID } from '@kbn/rule-data-utils'; +import { sloFeatureId } from '@kbn/observability-plugin/common'; import { SLO_BURN_RATE_AAD_FIELDS } from '../../../../common/field_names/slo'; -import { AlertsLocatorParams, observabilityPaths, sloFeatureId } from '../../../../common'; import { SLO_RULE_REGISTRATION_CONTEXT } from '../../../common/constants'; import { @@ -23,7 +25,6 @@ import { HIGH_PRIORITY_ACTION, LOW_PRIORITY_ACTION, MEDIUM_PRIORITY_ACTION, - SLO_BURN_RATE_RULE_TYPE_ID, } from '../../../../common/constants'; import { getRuleExecutor } from './executor'; @@ -56,7 +57,7 @@ export function sloBurnRateRuleType( }); return { id: SLO_BURN_RATE_RULE_TYPE_ID, - name: i18n.translate('xpack.observability.slo.rules.burnRate.name', { + name: i18n.translate('xpack.slo.rules.burnRate.name', { defaultMessage: 'SLO burn rate', }), fieldsForAAD: SLO_BURN_RATE_AAD_FIELDS, @@ -103,41 +104,38 @@ export function sloBurnRateRuleType( } const thresholdActionVariableDescription = i18n.translate( - 'xpack.observability.slo.alerting.thresholdDescription', + 'xpack.slo.alerting.thresholdDescription', { defaultMessage: 'The burn rate threshold value.', } ); -const windowActionVariableDescription = i18n.translate( - 'xpack.observability.slo.alerting.windowDescription', - { - defaultMessage: 'The window duration with the associated burn rate value.', - } -); +const windowActionVariableDescription = i18n.translate('xpack.slo.alerting.windowDescription', { + defaultMessage: 'The window duration with the associated burn rate value.', +}); export const reasonActionVariableDescription = i18n.translate( - 'xpack.observability.slo.alerting.reasonDescription', + 'xpack.slo.alerting.reasonDescription', { defaultMessage: 'A concise description of the reason for the alert', } ); export const timestampActionVariableDescription = i18n.translate( - 'xpack.observability.slo.alerting.timestampDescription', + 'xpack.slo.alerting.timestampDescription', { defaultMessage: 'A timestamp of when the alert was detected.', } ); export const viewInAppUrlActionVariableDescription = i18n.translate( - 'xpack.observability.slo.alerting.viewInAppUrlDescription', + 'xpack.slo.alerting.viewInAppUrlDescription', { defaultMessage: 'The url to the SLO details page to help with further investigation.', } ); export const alertDetailsUrlActionVariableDescription = i18n.translate( - 'xpack.observability.slo.alerting.alertDetailsUrlDescription', + 'xpack.slo.alerting.alertDetailsUrlDescription', { defaultMessage: 'Link to the alert troubleshooting view for further context and details. This will be an empty string if the server.publicBaseUrl is not configured.', @@ -145,21 +143,21 @@ export const alertDetailsUrlActionVariableDescription = i18n.translate( ); export const sloIdActionVariableDescription = i18n.translate( - 'xpack.observability.slo.alerting.sloIdDescription', + 'xpack.slo.alerting.sloIdDescription', { defaultMessage: 'The SLO unique identifier.', } ); export const sloNameActionVariableDescription = i18n.translate( - 'xpack.observability.slo.alerting.sloNameDescription', + 'xpack.slo.alerting.sloNameDescription', { defaultMessage: 'The SLO name.', } ); export const sloInstanceIdActionVariableDescription = i18n.translate( - 'xpack.observability.slo.alerting.sloInstanceIdDescription', + 'xpack.slo.alerting.sloInstanceIdDescription', { defaultMessage: 'The SLO instance id.', } diff --git a/x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/types.ts b/x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/lib/rules/slo_burn_rate/types.ts rename to x-pack/plugins/observability_solution/slo/server/lib/rules/slo_burn_rate/types.ts diff --git a/x-pack/plugins/observability_solution/slo/server/plugin.ts b/x-pack/plugins/observability_solution/slo/server/plugin.ts new file mode 100644 index 0000000000000..ca197b3eb463c --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/plugin.ts @@ -0,0 +1,176 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { + PluginInitializerContext, + CoreSetup, + CoreStart, + DEFAULT_APP_CATEGORIES, + Plugin, + Logger, + SavedObjectsClient, +} from '@kbn/core/server'; +import { PluginSetupContract, PluginStartContract } from '@kbn/alerting-plugin/server'; +import { PluginSetupContract as FeaturesSetup } from '@kbn/features-plugin/server'; +import { RuleRegistryPluginSetupContract } from '@kbn/rule-registry-plugin/server'; +import { + TaskManagerSetupContract, + TaskManagerStartContract, +} from '@kbn/task-manager-plugin/server'; +import { CloudSetup } from '@kbn/cloud-plugin/server'; +import { SharePluginSetup } from '@kbn/share-plugin/server'; +import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; +import { SpacesPluginSetup, SpacesPluginStart } from '@kbn/spaces-plugin/server'; +import { AlertsLocatorDefinition } from '@kbn/observability-plugin/common'; +import { SLO_BURN_RATE_RULE_TYPE_ID } from '@kbn/rule-data-utils'; +import { sloFeatureId } from '@kbn/observability-plugin/common'; +import { registerSloUsageCollector } from './lib/collectors/register'; +import { SloOrphanSummaryCleanupTask } from './services/tasks/orphan_summary_cleanup_task'; +import { slo, SO_SLO_TYPE } from './saved_objects'; +import { DefaultResourceInstaller, DefaultSLOInstaller } from './services'; +import { registerBurnRateRule } from './lib/rules/register_burn_rate_rule'; +import { SloConfig } from '.'; +import { registerRoutes } from './routes/register_routes'; +import { getSloServerRouteRepository } from './routes/get_slo_server_route_repository'; + +export type SloPluginSetup = ReturnType; + +export interface PluginSetup { + alerting: PluginSetupContract; + ruleRegistry: RuleRegistryPluginSetupContract; + share: SharePluginSetup; + features: FeaturesSetup; + taskManager: TaskManagerSetupContract; + spaces?: SpacesPluginSetup; + cloud?: CloudSetup; + usageCollection?: UsageCollectionSetup; +} + +export interface PluginStart { + alerting: PluginStartContract; + taskManager: TaskManagerStartContract; + spaces?: SpacesPluginStart; +} + +const sloRuleTypes = [SLO_BURN_RATE_RULE_TYPE_ID]; + +export class SloPlugin implements Plugin { + private readonly logger: Logger; + private sloOrphanCleanupTask?: SloOrphanSummaryCleanupTask; + + constructor(private readonly initContext: PluginInitializerContext) { + this.initContext = initContext; + this.logger = initContext.logger.get(); + } + + public setup(core: CoreSetup, plugins: PluginSetup) { + const config = this.initContext.config.get(); + const alertsLocator = plugins.share.url.locators.create(new AlertsLocatorDefinition()); + + const savedObjectTypes = [SO_SLO_TYPE]; + + plugins.features.registerKibanaFeature({ + id: sloFeatureId, + name: i18n.translate('xpack.slo.featureRegistry.linkSloTitle', { + defaultMessage: 'SLOs', + }), + order: 1200, + category: DEFAULT_APP_CATEGORIES.observability, + app: [sloFeatureId, 'kibana'], + catalogue: [sloFeatureId, 'observability'], + alerting: sloRuleTypes, + privileges: { + all: { + app: [sloFeatureId, 'kibana'], + catalogue: [sloFeatureId, 'observability'], + api: ['slo_write', 'slo_read', 'rac'], + savedObject: { + all: savedObjectTypes, + read: [], + }, + alerting: { + rule: { + all: sloRuleTypes, + }, + alert: { + all: sloRuleTypes, + }, + }, + ui: ['read', 'write'], + }, + read: { + app: [sloFeatureId, 'kibana'], + catalogue: [sloFeatureId, 'observability'], + api: ['slo_read', 'rac'], + savedObject: { + all: [], + read: savedObjectTypes, + }, + alerting: { + rule: { + read: sloRuleTypes, + }, + alert: { + read: sloRuleTypes, + }, + }, + ui: ['read'], + }, + }, + }); + + const { ruleDataService } = plugins.ruleRegistry; + + core.savedObjects.registerType(slo); + + registerBurnRateRule(plugins.alerting, core.http.basePath, this.logger, ruleDataService, { + alertsLocator, + }); + + registerSloUsageCollector(plugins.usageCollection); + + core.getStartServices().then(([coreStart, pluginStart]) => { + registerRoutes({ + core, + config, + dependencies: { + pluginsSetup: { + ...plugins, + core, + }, + spaces: pluginStart.spaces, + ruleDataService, + getRulesClientWithRequest: pluginStart.alerting.getRulesClientWithRequest, + }, + logger: this.logger, + repository: getSloServerRouteRepository(config), + }); + + const esInternalClient = coreStart.elasticsearch.client.asInternalUser; + + const sloResourceInstaller = new DefaultResourceInstaller(esInternalClient, this.logger); + const sloInstaller = new DefaultSLOInstaller(sloResourceInstaller, this.logger); + sloInstaller.install(); + }); + + this.sloOrphanCleanupTask = new SloOrphanSummaryCleanupTask( + plugins.taskManager, + this.logger, + config + ); + } + + public start(core: CoreStart, plugins: PluginStart) { + const internalSoClient = new SavedObjectsClient(core.savedObjects.createInternalRepository()); + const internalEsClient = core.elasticsearch.client.asInternalUser; + + this.sloOrphanCleanupTask?.start(plugins.taskManager, internalSoClient, internalEsClient); + } + + public stop() {} +} diff --git a/x-pack/plugins/observability_solution/slo/server/routes/create_slo_server_route.ts b/x-pack/plugins/observability_solution/slo/server/routes/create_slo_server_route.ts new file mode 100644 index 0000000000000..762b5b369f6e6 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/routes/create_slo_server_route.ts @@ -0,0 +1,13 @@ +/* + * 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 { createServerRouteFactory } from '@kbn/server-route-repository'; +import { SloRouteCreateOptions, SloRouteHandlerResources } from './types'; + +export const createSloServerRoute = createServerRouteFactory< + SloRouteHandlerResources, + SloRouteCreateOptions +>(); diff --git a/x-pack/plugins/observability_solution/slo/server/routes/get_slo_server_route_repository.ts b/x-pack/plugins/observability_solution/slo/server/routes/get_slo_server_route_repository.ts new file mode 100644 index 0000000000000..bd062771017fd --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/routes/get_slo_server_route_repository.ts @@ -0,0 +1,18 @@ +/* + * 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 { SloConfig } from '..'; +import { sloRouteRepository } from './slo/route'; + +export function getSloServerRouteRepository(config: SloConfig) { + const repository = { + ...sloRouteRepository, + }; + return repository; +} + +export type SloServerRouteRepository = ReturnType; diff --git a/x-pack/plugins/observability_solution/slo/server/routes/register_routes.ts b/x-pack/plugins/observability_solution/slo/server/routes/register_routes.ts new file mode 100644 index 0000000000000..66f255a2397b7 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/routes/register_routes.ts @@ -0,0 +1,129 @@ +/* + * 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 { errors } from '@elastic/elasticsearch'; +import Boom from '@hapi/boom'; +import { RulesClientApi } from '@kbn/alerting-plugin/server/types'; +import { CoreSetup, KibanaRequest, Logger, RouteRegistrar } from '@kbn/core/server'; +import { RuleDataPluginService } from '@kbn/rule-registry-plugin/server'; +import { + decodeRequestParams, + parseEndpoint, + routeValidationObject, +} from '@kbn/server-route-repository'; +import { SpacesPluginStart } from '@kbn/spaces-plugin/server'; +import axios from 'axios'; +import * as t from 'io-ts'; +import { SloConfig } from '..'; +import { getHTTPResponseCode, ObservabilityError } from '../errors'; +import { SloRequestHandlerContext } from '../types'; +import { AbstractSloServerRouteRepository } from './types'; + +interface RegisterRoutes { + config: SloConfig; + core: CoreSetup; + repository: AbstractSloServerRouteRepository; + logger: Logger; + dependencies: RegisterRoutesDependencies; +} + +export interface RegisterRoutesDependencies { + pluginsSetup: { + core: CoreSetup; + }; + spaces?: SpacesPluginStart; + ruleDataService: RuleDataPluginService; + getRulesClientWithRequest: (request: KibanaRequest) => RulesClientApi; +} + +export function registerRoutes({ config, repository, core, logger, dependencies }: RegisterRoutes) { + const routes = Object.values(repository); + + const router = core.http.createRouter(); + + routes.forEach((route) => { + const { endpoint, options, handler, params } = route; + const { pathname, method } = parseEndpoint(endpoint); + + (router[method] as RouteRegistrar)( + { + path: pathname, + validate: routeValidationObject, + options, + }, + async (context, request, response) => { + try { + const decodedParams = decodeRequestParams( + { + params: request.params, + body: request.body, + query: request.query, + }, + params ?? t.strict({}) + ); + + const data = await handler({ + config, + context, + request, + logger, + params: decodedParams, + dependencies, + }); + + if (data === undefined) { + return response.noContent(); + } + + return response.ok({ body: data }); + } catch (error) { + if (error instanceof ObservabilityError) { + logger.error(error.message); + return response.customError({ + statusCode: getHTTPResponseCode(error), + body: { + message: error.message, + }, + }); + } + + if (axios.isAxiosError(error)) { + logger.error(error); + return response.customError({ + statusCode: error.response?.status || 500, + body: { + message: error.message, + }, + }); + } + + if (Boom.isBoom(error)) { + logger.error(error.output.payload.message); + return response.customError({ + statusCode: error.output.statusCode, + body: { message: error.output.payload.message }, + }); + } + + logger.error(error); + const opts = { + statusCode: 500, + body: { + message: error.message, + }, + }; + + if (error instanceof errors.RequestAbortedError) { + opts.statusCode = 499; + opts.body.message = 'Client closed request'; + } + + return response.customError(opts); + } + } + ); + }); +} diff --git a/x-pack/plugins/observability_solution/observability/server/routes/slo/route.ts b/x-pack/plugins/observability_solution/slo/server/routes/slo/route.ts similarity index 89% rename from x-pack/plugins/observability_solution/observability/server/routes/slo/route.ts rename to x-pack/plugins/observability_solution/slo/server/routes/slo/route.ts index 8e0432ab05ba1..01026b67068b1 100644 --- a/x-pack/plugins/observability_solution/observability/server/routes/slo/route.ts +++ b/x-pack/plugins/observability_solution/slo/server/routes/slo/route.ts @@ -36,18 +36,18 @@ import { KibanaSavedObjectsSLORepository, UpdateSLO, FindSLOGroups, -} from '../../services/slo'; -import { FetchHistoricalSummary } from '../../services/slo/fetch_historical_summary'; -import { FindSLODefinitions } from '../../services/slo/find_slo_definitions'; -import { getBurnRates } from '../../services/slo/get_burn_rates'; -import { getGlobalDiagnosis } from '../../services/slo/get_diagnosis'; -import { GetPreviewData } from '../../services/slo/get_preview_data'; -import { GetSLOInstances } from '../../services/slo/get_slo_instances'; -import { DefaultHistoricalSummaryClient } from '../../services/slo/historical_summary_client'; -import { ManageSLO } from '../../services/slo/manage_slo'; -import { ResetSLO } from '../../services/slo/reset_slo'; -import { DefaultSummarySearchClient } from '../../services/slo/summary_search_client'; -import { DefaultSummaryTransformGenerator } from '../../services/slo/summary_transform_generator/summary_transform_generator'; +} from '../../services'; +import { FetchHistoricalSummary } from '../../services/fetch_historical_summary'; +import { FindSLODefinitions } from '../../services/find_slo_definitions'; +import { getBurnRates } from '../../services/get_burn_rates'; +import { getGlobalDiagnosis } from '../../services/get_diagnosis'; +import { GetPreviewData } from '../../services/get_preview_data'; +import { GetSLOInstances } from '../../services/get_slo_instances'; +import { DefaultHistoricalSummaryClient } from '../../services/historical_summary_client'; +import { ManageSLO } from '../../services/manage_slo'; +import { ResetSLO } from '../../services/reset_slo'; +import { DefaultSummarySearchClient } from '../../services/summary_search_client'; +import { DefaultSummaryTransformGenerator } from '../../services/summary_transform_generator/summary_transform_generator'; import { ApmTransactionDurationTransformGenerator, ApmTransactionErrorRateTransformGenerator, @@ -57,9 +57,9 @@ import { MetricCustomTransformGenerator, TimesliceMetricTransformGenerator, TransformGenerator, -} from '../../services/slo/transform_generators'; -import type { ObservabilityRequestHandlerContext } from '../../types'; -import { createObservabilityServerRoute } from '../create_observability_server_route'; +} from '../../services/transform_generators'; +import type { SloRequestHandlerContext } from '../../types'; +import { createSloServerRoute } from '../create_slo_server_route'; const transformGenerators: Record = { 'sli.apm.transactionDuration': new ApmTransactionDurationTransformGenerator(), @@ -71,7 +71,7 @@ const transformGenerators: Record = { 'sli.metric.timeslice': new TimesliceMetricTransformGenerator(), }; -const assertPlatinumLicense = async (context: ObservabilityRequestHandlerContext) => { +const assertPlatinumLicense = async (context: SloRequestHandlerContext) => { const licensing = await context.licensing; const hasCorrectLicense = licensing.license.hasAtLeast('platinum'); @@ -80,7 +80,7 @@ const assertPlatinumLicense = async (context: ObservabilityRequestHandlerContext } }; -const createSLORoute = createObservabilityServerRoute({ +const createSLORoute = createSloServerRoute({ endpoint: 'POST /api/observability/slos 2023-10-31', options: { tags: ['access:slo_write'], @@ -125,7 +125,7 @@ const createSLORoute = createObservabilityServerRoute({ }, }); -const inspectSLORoute = createObservabilityServerRoute({ +const inspectSLORoute = createSloServerRoute({ endpoint: 'POST /internal/api/observability/slos/_inspect 2023-10-31', options: { tags: ['access:slo_write'], @@ -167,7 +167,7 @@ const inspectSLORoute = createObservabilityServerRoute({ }, }); -const updateSLORoute = createObservabilityServerRoute({ +const updateSLORoute = createSloServerRoute({ endpoint: 'PUT /api/observability/slos/{id} 2023-10-31', options: { tags: ['access:slo_write'], @@ -213,7 +213,7 @@ const updateSLORoute = createObservabilityServerRoute({ }, }); -const deleteSLORoute = createObservabilityServerRoute({ +const deleteSLORoute = createSloServerRoute({ endpoint: 'DELETE /api/observability/slos/{id} 2023-10-31', options: { tags: ['access:slo_write'], @@ -256,7 +256,7 @@ const deleteSLORoute = createObservabilityServerRoute({ }, }); -const getSLORoute = createObservabilityServerRoute({ +const getSLORoute = createSloServerRoute({ endpoint: 'GET /api/observability/slos/{id} 2023-10-31', options: { tags: ['access:slo_read'], @@ -278,7 +278,7 @@ const getSLORoute = createObservabilityServerRoute({ }, }); -const enableSLORoute = createObservabilityServerRoute({ +const enableSLORoute = createSloServerRoute({ endpoint: 'POST /api/observability/slos/{id}/enable 2023-10-31', options: { tags: ['access:slo_write'], @@ -315,7 +315,7 @@ const enableSLORoute = createObservabilityServerRoute({ }, }); -const disableSLORoute = createObservabilityServerRoute({ +const disableSLORoute = createSloServerRoute({ endpoint: 'POST /api/observability/slos/{id}/disable 2023-10-31', options: { tags: ['access:slo_write'], @@ -352,7 +352,7 @@ const disableSLORoute = createObservabilityServerRoute({ }, }); -const resetSLORoute = createObservabilityServerRoute({ +const resetSLORoute = createSloServerRoute({ endpoint: 'POST /api/observability/slos/{id}/_reset 2023-10-31', options: { tags: ['access:slo_write'], @@ -397,7 +397,7 @@ const resetSLORoute = createObservabilityServerRoute({ }, }); -const findSLORoute = createObservabilityServerRoute({ +const findSLORoute = createSloServerRoute({ endpoint: 'GET /api/observability/slos 2023-10-31', options: { tags: ['access:slo_read'], @@ -421,7 +421,7 @@ const findSLORoute = createObservabilityServerRoute({ }, }); -const findSLOGroupsRoute = createObservabilityServerRoute({ +const findSLOGroupsRoute = createSloServerRoute({ endpoint: 'GET /internal/api/observability/slos/_groups', options: { tags: ['access:slo_read'], @@ -440,7 +440,7 @@ const findSLOGroupsRoute = createObservabilityServerRoute({ }, }); -const deleteSloInstancesRoute = createObservabilityServerRoute({ +const deleteSloInstancesRoute = createSloServerRoute({ endpoint: 'POST /api/observability/slos/_delete_instances 2023-10-31', options: { tags: ['access:slo_write'], @@ -456,7 +456,7 @@ const deleteSloInstancesRoute = createObservabilityServerRoute({ }, }); -const findSloDefinitionsRoute = createObservabilityServerRoute({ +const findSloDefinitionsRoute = createSloServerRoute({ endpoint: 'GET /api/observability/slos/_definitions 2023-10-31', options: { tags: ['access:slo_read'], @@ -475,7 +475,7 @@ const findSloDefinitionsRoute = createObservabilityServerRoute({ }, }); -const fetchHistoricalSummary = createObservabilityServerRoute({ +const fetchHistoricalSummary = createSloServerRoute({ endpoint: 'POST /internal/observability/slos/_historical_summary', options: { tags: ['access:slo_read'], @@ -497,7 +497,7 @@ const fetchHistoricalSummary = createObservabilityServerRoute({ }, }); -const getSLOInstancesRoute = createObservabilityServerRoute({ +const getSLOInstancesRoute = createSloServerRoute({ endpoint: 'GET /internal/observability/slos/{id}/_instances', options: { tags: ['access:slo_read'], @@ -519,7 +519,7 @@ const getSLOInstancesRoute = createObservabilityServerRoute({ }, }); -const getDiagnosisRoute = createObservabilityServerRoute({ +const getDiagnosisRoute = createSloServerRoute({ endpoint: 'GET /internal/observability/slos/_diagnosis', options: { tags: [], @@ -542,7 +542,7 @@ const getDiagnosisRoute = createObservabilityServerRoute({ }, }); -const getSloBurnRates = createObservabilityServerRoute({ +const getSloBurnRates = createSloServerRoute({ endpoint: 'POST /internal/observability/slos/{id}/_burn_rates', options: { tags: ['access:slo_read'], @@ -568,7 +568,7 @@ const getSloBurnRates = createObservabilityServerRoute({ }, }); -const getPreviewData = createObservabilityServerRoute({ +const getPreviewData = createSloServerRoute({ endpoint: 'POST /internal/observability/slos/_preview', options: { tags: ['access:slo_read'], diff --git a/x-pack/plugins/observability_solution/slo/server/routes/types.ts b/x-pack/plugins/observability_solution/slo/server/routes/types.ts new file mode 100644 index 0000000000000..a16ffbcc10fa7 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/routes/types.ts @@ -0,0 +1,35 @@ +/* + * 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 { EndpointOf, ReturnOf, ServerRouteRepository } from '@kbn/server-route-repository'; +import { KibanaRequest, Logger } from '@kbn/core/server'; + +import { SloServerRouteRepository } from './get_slo_server_route_repository'; +import { SloRequestHandlerContext } from '../types'; +import { RegisterRoutesDependencies } from './register_routes'; +import { SloConfig } from '..'; + +export type { SloServerRouteRepository }; + +export interface SloRouteHandlerResources { + context: SloRequestHandlerContext; + dependencies: RegisterRoutesDependencies; + logger: Logger; + request: KibanaRequest; + config: SloConfig; +} + +export interface SloRouteCreateOptions { + options: { + tags: string[]; + access?: 'public' | 'internal'; + }; +} + +export type AbstractSloServerRouteRepository = ServerRouteRepository; + +export type ObservabilityAPIReturnType> = + ReturnOf; diff --git a/x-pack/plugins/observability_solution/observability/server/saved_objects/index.ts b/x-pack/plugins/observability_solution/slo/server/saved_objects/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/saved_objects/index.ts rename to x-pack/plugins/observability_solution/slo/server/saved_objects/index.ts diff --git a/x-pack/plugins/observability_solution/observability/server/saved_objects/slo.ts b/x-pack/plugins/observability_solution/slo/server/saved_objects/slo.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/saved_objects/slo.ts rename to x-pack/plugins/observability_solution/slo/server/saved_objects/slo.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/create_slo.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/create_slo.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/create_slo.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/__snapshots__/create_slo.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/delete_slo.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/delete_slo.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/delete_slo.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/__snapshots__/delete_slo.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/get_slo_instances.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/get_slo_instances.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/get_slo_instances.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/__snapshots__/get_slo_instances.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/historical_summary_client.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/historical_summary_client.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/historical_summary_client.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/__snapshots__/historical_summary_client.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/manage_slo.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/manage_slo.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/manage_slo.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/__snapshots__/manage_slo.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/reset_slo.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/reset_slo.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/reset_slo.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/__snapshots__/reset_slo.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/summary_client.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/summary_client.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/summary_client.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/__snapshots__/summary_client.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/summary_search_client.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/summary_search_client.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/summary_search_client.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/__snapshots__/summary_search_client.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/update_slo.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/__snapshots__/update_slo.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/__snapshots__/update_slo.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/__snapshots__/update_slo.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/__snapshots__/get_custom_metric_indicator_aggregation.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_custom_metric_indicator_aggregation.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/__snapshots__/get_custom_metric_indicator_aggregation.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_custom_metric_indicator_aggregation.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/__snapshots__/get_histogram_indicator_aggregation.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_histogram_indicator_aggregation.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/__snapshots__/get_histogram_indicator_aggregation.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_histogram_indicator_aggregation.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/__snapshots__/get_timeslice_metric_indicator_aggregation.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_timeslice_metric_indicator_aggregation.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/__snapshots__/get_timeslice_metric_indicator_aggregation.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/aggregations/__snapshots__/get_timeslice_metric_indicator_aggregation.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_custom_metric_indicator_aggregation.test.ts b/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_custom_metric_indicator_aggregation.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_custom_metric_indicator_aggregation.ts b/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_custom_metric_indicator_aggregation.ts rename to x-pack/plugins/observability_solution/slo/server/services/aggregations/get_custom_metric_indicator_aggregation.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_histogram_indicator_aggregation.test.ts b/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_histogram_indicator_aggregation.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_histogram_indicator_aggregation.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/aggregations/get_histogram_indicator_aggregation.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_histogram_indicator_aggregation.ts b/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_histogram_indicator_aggregation.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_histogram_indicator_aggregation.ts rename to x-pack/plugins/observability_solution/slo/server/services/aggregations/get_histogram_indicator_aggregation.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_timeslice_metric_indicator_aggregation.test.ts b/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_timeslice_metric_indicator_aggregation.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_timeslice_metric_indicator_aggregation.ts b/x-pack/plugins/observability_solution/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/get_timeslice_metric_indicator_aggregation.ts rename to x-pack/plugins/observability_solution/slo/server/services/aggregations/get_timeslice_metric_indicator_aggregation.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/index.ts b/x-pack/plugins/observability_solution/slo/server/services/aggregations/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/aggregations/index.ts rename to x-pack/plugins/observability_solution/slo/server/services/aggregations/index.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/create_slo.test.ts b/x-pack/plugins/observability_solution/slo/server/services/create_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/create_slo.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/create_slo.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/create_slo.ts b/x-pack/plugins/observability_solution/slo/server/services/create_slo.ts similarity index 93% rename from x-pack/plugins/observability_solution/observability/server/services/slo/create_slo.ts rename to x-pack/plugins/observability_solution/slo/server/services/create_slo.ts index f46b868b46073..af081baf5cd2d 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/create_slo.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/create_slo.ts @@ -15,11 +15,11 @@ import { getSLOTransformId, SLO_MODEL_VERSION, SLO_SUMMARY_TEMP_INDEX_NAME, -} from '../../../common/slo/constants'; -import { getSLOSummaryPipelineTemplate } from '../../assets/ingest_templates/slo_summary_pipeline_template'; -import { Duration, DurationUnit, SLO } from '../../domain/models'; -import { validateSLO } from '../../domain/services'; -import { retryTransientEsErrors } from '../../utils/retry'; +} from '../../common/constants'; +import { getSLOSummaryPipelineTemplate } from '../assets/ingest_templates/slo_summary_pipeline_template'; +import { Duration, DurationUnit, SLO } from '../domain/models'; +import { validateSLO } from '../domain/services'; +import { retryTransientEsErrors } from '../utils/retry'; import { SLORepository } from './slo_repository'; import { createTempSummaryDocument } from './summary_transform_generator/helpers/create_temp_summary'; import { TransformManager } from './transform_manager'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/delete_slo.test.ts b/x-pack/plugins/observability_solution/slo/server/services/delete_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/delete_slo.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/delete_slo.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/delete_slo.ts b/x-pack/plugins/observability_solution/slo/server/services/delete_slo.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/server/services/slo/delete_slo.ts rename to x-pack/plugins/observability_solution/slo/server/services/delete_slo.ts index e3d6663860222..fa6652dbb30cf 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/delete_slo.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/delete_slo.ts @@ -13,8 +13,8 @@ import { getSLOTransformId, SLO_DESTINATION_INDEX_PATTERN, SLO_SUMMARY_DESTINATION_INDEX_PATTERN, -} from '../../../common/slo/constants'; -import { retryTransientEsErrors } from '../../utils/retry'; +} from '../../common/constants'; +import { retryTransientEsErrors } from '../utils/retry'; import { SLORepository } from './slo_repository'; import { TransformManager } from './transform_manager'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/delete_slo_instances.test.ts b/x-pack/plugins/observability_solution/slo/server/services/delete_slo_instances.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/delete_slo_instances.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/delete_slo_instances.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/delete_slo_instances.ts b/x-pack/plugins/observability_solution/slo/server/services/delete_slo_instances.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/delete_slo_instances.ts rename to x-pack/plugins/observability_solution/slo/server/services/delete_slo_instances.ts index 97c622f354564..353983d76a90b 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/delete_slo_instances.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/delete_slo_instances.ts @@ -10,8 +10,8 @@ import { ALL_VALUE, DeleteSLOInstancesParams } from '@kbn/slo-schema'; import { SLO_DESTINATION_INDEX_PATTERN, SLO_SUMMARY_DESTINATION_INDEX_PATTERN, -} from '../../../common/slo/constants'; -import { IllegalArgumentError } from '../../errors'; +} from '../../common/constants'; +import { IllegalArgumentError } from '../errors'; interface SloInstanceTuple { sloId: string; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/fetch_historical_summary.ts b/x-pack/plugins/observability_solution/slo/server/services/fetch_historical_summary.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/fetch_historical_summary.ts rename to x-pack/plugins/observability_solution/slo/server/services/fetch_historical_summary.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/find_slo.test.ts b/x-pack/plugins/observability_solution/slo/server/services/find_slo.test.ts similarity index 98% rename from x-pack/plugins/observability_solution/observability/server/services/slo/find_slo.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/find_slo.test.ts index 66a9f489bdfc6..775ca6b404070 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/find_slo.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/find_slo.test.ts @@ -6,8 +6,8 @@ */ import { ALL_VALUE, Paginated } from '@kbn/slo-schema'; -import { SLO_MODEL_VERSION } from '../../../common/slo/constants'; -import { SLO } from '../../domain/models'; +import { SLO_MODEL_VERSION } from '../../common/constants'; +import { SLO } from '../domain/models'; import { FindSLO } from './find_slo'; import { createSLO } from './fixtures/slo'; import { createSLORepositoryMock, createSummarySearchClientMock } from './mocks'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/find_slo.ts b/x-pack/plugins/observability_solution/slo/server/services/find_slo.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/find_slo.ts rename to x-pack/plugins/observability_solution/slo/server/services/find_slo.ts index 84d17c5ebc840..ea9e59c1e2908 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/find_slo.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/find_slo.ts @@ -6,8 +6,8 @@ */ import { FindSLOParams, FindSLOResponse, findSLOResponseSchema, Pagination } from '@kbn/slo-schema'; -import { SLO, SLOWithSummary } from '../../domain/models'; -import { IllegalArgumentError } from '../../errors'; +import { SLO, SLOWithSummary } from '../domain/models'; +import { IllegalArgumentError } from '../errors'; import { SLORepository } from './slo_repository'; import { SLOSummary, Sort, SummarySearchClient } from './summary_search_client'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/find_slo_definitions.ts b/x-pack/plugins/observability_solution/slo/server/services/find_slo_definitions.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/server/services/slo/find_slo_definitions.ts rename to x-pack/plugins/observability_solution/slo/server/services/find_slo_definitions.ts index 38076d67202d5..221a4d0ca65be 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/find_slo_definitions.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/find_slo_definitions.ts @@ -11,7 +11,7 @@ import { findSloDefinitionsResponseSchema, Pagination, } from '@kbn/slo-schema'; -import { IllegalArgumentError } from '../../errors'; +import { IllegalArgumentError } from '../errors'; import { SLORepository } from './slo_repository'; const MAX_PER_PAGE = 1000; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/find_slo_groups.ts b/x-pack/plugins/observability_solution/slo/server/services/find_slo_groups.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/server/services/slo/find_slo_groups.ts rename to x-pack/plugins/observability_solution/slo/server/services/find_slo_groups.ts index 5c0cfbe178367..a603de597ae65 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/find_slo_groups.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/find_slo_groups.ts @@ -8,13 +8,13 @@ import { FindSLOGroupsParams, FindSLOGroupsResponse, Pagination } from '@kbn/slo import { ElasticsearchClient } from '@kbn/core/server'; import { findSLOGroupsResponseSchema } from '@kbn/slo-schema'; import { Logger } from '@kbn/core/server'; -import { typedSearch } from '../../utils/queries'; -import { IllegalArgumentError } from '../../errors'; +import { typedSearch } from '../utils/queries'; +import { IllegalArgumentError } from '../errors'; import { SLO_SUMMARY_DESTINATION_INDEX_PATTERN, DEFAULT_SLO_GROUPS_PAGE_SIZE, -} from '../../../common/slo/constants'; -import { Status } from '../../domain/models'; +} from '../../common/constants'; +import { Status } from '../domain/models'; import { getElasticsearchQueryOrThrow } from './transform_generators'; const DEFAULT_PAGE = 1; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/date.ts b/x-pack/plugins/observability_solution/slo/server/services/fixtures/date.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/date.ts rename to x-pack/plugins/observability_solution/slo/server/services/fixtures/date.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/duration.ts b/x-pack/plugins/observability_solution/slo/server/services/fixtures/duration.ts similarity index 94% rename from x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/duration.ts rename to x-pack/plugins/observability_solution/slo/server/services/fixtures/duration.ts index 26690b6680f18..c4bba6eae797b 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/duration.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/fixtures/duration.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Duration, DurationUnit } from '../../../domain/models'; +import { Duration, DurationUnit } from '../../domain/models'; export function thirtyDays(): Duration { return new Duration(30, DurationUnit.Day); diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/error_budget.ts b/x-pack/plugins/observability_solution/slo/server/services/fixtures/error_budget.ts similarity index 89% rename from x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/error_budget.ts rename to x-pack/plugins/observability_solution/slo/server/services/fixtures/error_budget.ts index 5b7f82af16ef9..dc5dcb0a07812 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/error_budget.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/fixtures/error_budget.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ErrorBudget } from '../../../domain/models'; +import { ErrorBudget } from '../../domain/models'; export function createErrorBudget(params: Partial = {}): ErrorBudget { return { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/slo.ts b/x-pack/plugins/observability_solution/slo/server/services/fixtures/slo.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/slo.ts rename to x-pack/plugins/observability_solution/slo/server/services/fixtures/slo.ts index cf4e7ae8fba34..455f016866b8c 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/slo.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/fixtures/slo.ts @@ -16,7 +16,7 @@ import { } from '@kbn/slo-schema'; import { cloneDeep } from 'lodash'; import { v4 as uuidv4 } from 'uuid'; -import { SLO_MODEL_VERSION, SYNTHETICS_INDEX_PATTERN } from '../../../../common/slo/constants'; +import { SLO_MODEL_VERSION, SYNTHETICS_INDEX_PATTERN } from '../../../common/constants'; import { APMTransactionDurationIndicator, APMTransactionErrorRateIndicator, @@ -27,8 +27,8 @@ import { MetricCustomIndicator, SLO, StoredSLO, -} from '../../../domain/models'; -import { SO_SLO_TYPE } from '../../../saved_objects'; +} from '../../domain/models'; +import { SO_SLO_TYPE } from '../../saved_objects'; import { twoMinute } from './duration'; import { sevenDaysRolling, weeklyCalendarAligned } from './time_window'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/summary_search_document.ts b/x-pack/plugins/observability_solution/slo/server/services/fixtures/summary_search_document.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/summary_search_document.ts rename to x-pack/plugins/observability_solution/slo/server/services/fixtures/summary_search_document.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/time_window.ts b/x-pack/plugins/observability_solution/slo/server/services/fixtures/time_window.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/time_window.ts rename to x-pack/plugins/observability_solution/slo/server/services/fixtures/time_window.ts index c8d1601a22e2b..83dd4117f6264 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/fixtures/time_window.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/fixtures/time_window.ts @@ -9,7 +9,7 @@ import { CalendarAlignedTimeWindow, RollingTimeWindow, TimeWindow, -} from '../../../domain/models/time_window'; +} from '../../domain/models/time_window'; import { ninetyDays, oneMonth, oneWeek, sevenDays, thirtyDays } from './duration'; export function sevenDaysRolling(): RollingTimeWindow { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/get_burn_rates.ts b/x-pack/plugins/observability_solution/slo/server/services/get_burn_rates.ts similarity index 92% rename from x-pack/plugins/observability_solution/observability/server/services/slo/get_burn_rates.ts rename to x-pack/plugins/observability_solution/slo/server/services/get_burn_rates.ts index ee540bdd7cb23..9ce58767a868e 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/get_burn_rates.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/get_burn_rates.ts @@ -8,8 +8,8 @@ import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; import { Logger } from '@kbn/core/server'; -import { Duration } from '../../domain/models'; -import { computeBurnRate, computeSLI } from '../../domain/services'; +import { Duration } from '../domain/models'; +import { computeBurnRate, computeSLI } from '../domain/services'; import { DefaultSLIClient } from './sli_client'; import { KibanaSavedObjectsSLORepository } from './slo_repository'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/get_diagnosis.ts b/x-pack/plugins/observability_solution/slo/server/services/get_diagnosis.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/get_diagnosis.ts rename to x-pack/plugins/observability_solution/slo/server/services/get_diagnosis.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/get_preview_data.ts b/x-pack/plugins/observability_solution/slo/server/services/get_preview_data.ts similarity index 98% rename from x-pack/plugins/observability_solution/observability/server/services/slo/get_preview_data.ts rename to x-pack/plugins/observability_solution/slo/server/services/get_preview_data.ts index 6686601ee66e0..6059be2cdf1c5 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/get_preview_data.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/get_preview_data.ts @@ -22,16 +22,17 @@ import moment from 'moment'; import { ElasticsearchClient } from '@kbn/core/server'; import { estypes } from '@elastic/elasticsearch'; import { getElasticsearchQueryOrThrow } from './transform_generators'; + import { buildParamValues } from './transform_generators/synthetics_availability'; -import { typedSearch } from '../../utils/queries'; -import { APMTransactionDurationIndicator } from '../../domain/models'; -import { computeSLI } from '../../domain/services'; +import { typedSearch } from '../utils/queries'; +import { APMTransactionDurationIndicator } from '../domain/models'; +import { computeSLI } from '../domain/services'; import { GetCustomMetricIndicatorAggregation, GetHistogramIndicatorAggregation, GetTimesliceMetricIndicatorAggregation, } from './aggregations'; -import { SYNTHETICS_INDEX_PATTERN } from '../../../common/slo/constants'; +import { SYNTHETICS_INDEX_PATTERN } from '../../common/constants'; interface Options { range: { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/get_slo.test.ts b/x-pack/plugins/observability_solution/slo/server/services/get_slo.test.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/services/slo/get_slo.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/get_slo.test.ts index 2143c5f8d8e50..1dec5b4e414aa 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/get_slo.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/get_slo.test.ts @@ -6,7 +6,7 @@ */ import { ALL_VALUE } from '@kbn/slo-schema'; -import { SLO_MODEL_VERSION } from '../../../common/slo/constants'; +import { SLO_MODEL_VERSION } from '../../common/constants'; import { createAPMTransactionErrorRateIndicator, createSLO } from './fixtures/slo'; import { GetSLO } from './get_slo'; import { createSummaryClientMock, createSLORepositoryMock } from './mocks'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/get_slo.ts b/x-pack/plugins/observability_solution/slo/server/services/get_slo.ts similarity index 94% rename from x-pack/plugins/observability_solution/observability/server/services/slo/get_slo.ts rename to x-pack/plugins/observability_solution/slo/server/services/get_slo.ts index c9754356e2ab7..bcc6045203ff7 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/get_slo.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/get_slo.ts @@ -5,7 +5,7 @@ * 2.0. */ import { ALL_VALUE, GetSLOParams, GetSLOResponse, getSLOResponseSchema } from '@kbn/slo-schema'; -import { Groupings, Meta, SLO, Summary } from '../../domain/models'; +import { Groupings, Meta, SLO, Summary } from '../domain/models'; import { SLORepository } from './slo_repository'; import { SummaryClient } from './summary_client'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/get_slo_instances.test.ts b/x-pack/plugins/observability_solution/slo/server/services/get_slo_instances.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/get_slo_instances.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/get_slo_instances.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/get_slo_instances.ts b/x-pack/plugins/observability_solution/slo/server/services/get_slo_instances.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/get_slo_instances.ts rename to x-pack/plugins/observability_solution/slo/server/services/get_slo_instances.ts index 1571a41a61f61..c95c2275547ae 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/get_slo_instances.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/get_slo_instances.ts @@ -7,7 +7,7 @@ import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; import { ALL_VALUE, GetSLOInstancesResponse } from '@kbn/slo-schema'; -import { SLO_DESTINATION_INDEX_PATTERN } from '../../../common/slo/constants'; +import { SLO_DESTINATION_INDEX_PATTERN } from '../../common/constants'; import { SLORepository } from './slo_repository'; export class GetSLOInstances { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/historical_summary_client.test.ts b/x-pack/plugins/observability_solution/slo/server/services/historical_summary_client.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/historical_summary_client.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/historical_summary_client.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/historical_summary_client.ts b/x-pack/plugins/observability_solution/slo/server/services/historical_summary_client.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/services/slo/historical_summary_client.ts rename to x-pack/plugins/observability_solution/slo/server/services/historical_summary_client.ts index 32b852b2124bd..36d28b245a602 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/historical_summary_client.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/historical_summary_client.ts @@ -20,14 +20,9 @@ import { import { assertNever } from '@kbn/std'; import * as t from 'io-ts'; import moment from 'moment'; -import { SLO_DESTINATION_INDEX_PATTERN } from '../../../common/slo/constants'; -import { DateRange, HistoricalSummary, SLO, SLOId } from '../../domain/models'; -import { - computeSLI, - computeSummaryStatus, - toDateRange, - toErrorBudget, -} from '../../domain/services'; +import { SLO_DESTINATION_INDEX_PATTERN } from '../../common/constants'; +import { DateRange, HistoricalSummary, SLO, SLOId } from '../domain/models'; +import { computeSLI, computeSummaryStatus, toDateRange, toErrorBudget } from '../domain/services'; interface DailyAggBucket { key_as_string: string; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/index.ts b/x-pack/plugins/observability_solution/slo/server/services/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/index.ts rename to x-pack/plugins/observability_solution/slo/server/services/index.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/manage_slo.test.ts b/x-pack/plugins/observability_solution/slo/server/services/manage_slo.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/manage_slo.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/manage_slo.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/manage_slo.ts b/x-pack/plugins/observability_solution/slo/server/services/manage_slo.ts similarity index 98% rename from x-pack/plugins/observability_solution/observability/server/services/slo/manage_slo.ts rename to x-pack/plugins/observability_solution/slo/server/services/manage_slo.ts index 9d9fd6eb1705c..84e8e3798598b 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/manage_slo.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/manage_slo.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { getSLOSummaryTransformId, getSLOTransformId } from '../../../common/slo/constants'; +import { getSLOSummaryTransformId, getSLOTransformId } from '../../common/constants'; import { SLORepository } from './slo_repository'; import { TransformManager } from './transform_manager'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/mocks/index.ts b/x-pack/plugins/observability_solution/slo/server/services/mocks/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/mocks/index.ts rename to x-pack/plugins/observability_solution/slo/server/services/mocks/index.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/reset_slo.test.ts b/x-pack/plugins/observability_solution/slo/server/services/reset_slo.test.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/services/slo/reset_slo.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/reset_slo.test.ts index 775520192742a..6f9a8dda4a128 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/reset_slo.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/reset_slo.test.ts @@ -13,7 +13,7 @@ import { } from '@kbn/core/server/mocks'; import { MockedLogger } from '@kbn/logging-mocks'; -import { SLO_MODEL_VERSION } from '../../../common/slo/constants'; +import { SLO_MODEL_VERSION } from '../../common/constants'; import { createSLO } from './fixtures/slo'; import { createSLORepositoryMock, diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/reset_slo.ts b/x-pack/plugins/observability_solution/slo/server/services/reset_slo.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/reset_slo.ts rename to x-pack/plugins/observability_solution/slo/server/services/reset_slo.ts index 9fabd255b70da..ad866fc81c422 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/reset_slo.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/reset_slo.ts @@ -15,9 +15,9 @@ import { SLO_MODEL_VERSION, SLO_SUMMARY_DESTINATION_INDEX_PATTERN, SLO_SUMMARY_TEMP_INDEX_NAME, -} from '../../../common/slo/constants'; -import { getSLOSummaryPipelineTemplate } from '../../assets/ingest_templates/slo_summary_pipeline_template'; -import { retryTransientEsErrors } from '../../utils/retry'; +} from '../../common/constants'; +import { getSLOSummaryPipelineTemplate } from '../assets/ingest_templates/slo_summary_pipeline_template'; +import { retryTransientEsErrors } from '../utils/retry'; import { SLORepository } from './slo_repository'; import { createTempSummaryDocument } from './summary_transform_generator/helpers/create_temp_summary'; import { TransformManager } from './transform_manager'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/resource_installer.test.ts b/x-pack/plugins/observability_solution/slo/server/services/resource_installer.test.ts similarity index 99% rename from x-pack/plugins/observability_solution/observability/server/services/slo/resource_installer.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/resource_installer.test.ts index b84e7e95146e8..55f5db79680ba 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/resource_installer.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/resource_installer.test.ts @@ -17,7 +17,7 @@ import { SLO_SUMMARY_COMPONENT_TEMPLATE_SETTINGS_NAME, SLO_SUMMARY_INDEX_TEMPLATE_NAME, SLO_RESOURCES_VERSION, -} from '../../../common/slo/constants'; +} from '../../common/constants'; import { DefaultResourceInstaller } from './resource_installer'; describe('resourceInstaller', () => { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/resource_installer.ts b/x-pack/plugins/observability_solution/slo/server/services/resource_installer.ts similarity index 89% rename from x-pack/plugins/observability_solution/observability/server/services/slo/resource_installer.ts rename to x-pack/plugins/observability_solution/slo/server/services/resource_installer.ts index 0eeaae913b8c4..c7ae180100dce 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/resource_installer.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/resource_installer.ts @@ -13,10 +13,10 @@ import type { Metadata, } from '@elastic/elasticsearch/lib/api/types'; import type { ElasticsearchClient, Logger } from '@kbn/core/server'; -import { getSLOMappingsTemplate } from '../../assets/component_templates/slo_mappings_template'; -import { getSLOSettingsTemplate } from '../../assets/component_templates/slo_settings_template'; -import { getSLOSummaryMappingsTemplate } from '../../assets/component_templates/slo_summary_mappings_template'; -import { getSLOSummarySettingsTemplate } from '../../assets/component_templates/slo_summary_settings_template'; +import { getSLOMappingsTemplate } from '../assets/component_templates/slo_mappings_template'; +import { getSLOSettingsTemplate } from '../assets/component_templates/slo_settings_template'; +import { getSLOSummaryMappingsTemplate } from '../assets/component_templates/slo_summary_mappings_template'; +import { getSLOSummarySettingsTemplate } from '../assets/component_templates/slo_summary_settings_template'; import { SLO_COMPONENT_TEMPLATE_MAPPINGS_NAME, SLO_COMPONENT_TEMPLATE_SETTINGS_NAME, @@ -31,11 +31,11 @@ import { SLO_SUMMARY_INDEX_TEMPLATE_NAME, SLO_SUMMARY_INDEX_TEMPLATE_PATTERN, SLO_SUMMARY_TEMP_INDEX_NAME, -} from '../../../common/slo/constants'; -import { getSLOIndexTemplate } from '../../assets/index_templates/slo_index_templates'; -import { getSLOSummaryIndexTemplate } from '../../assets/index_templates/slo_summary_index_templates'; -import { getSLOPipelineTemplate } from '../../assets/ingest_templates/slo_pipeline_template'; -import { retryTransientEsErrors } from '../../utils/retry'; +} from '../../common/constants'; +import { getSLOIndexTemplate } from '../assets/index_templates/slo_index_templates'; +import { getSLOSummaryIndexTemplate } from '../assets/index_templates/slo_summary_index_templates'; +import { getSLOPipelineTemplate } from '../assets/ingest_templates/slo_pipeline_template'; +import { retryTransientEsErrors } from '../utils/retry'; export interface ResourceInstaller { ensureCommonResourcesInstalled(): Promise; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/sli_client.test.ts b/x-pack/plugins/observability_solution/slo/server/services/sli_client.test.ts similarity index 99% rename from x-pack/plugins/observability_solution/observability/server/services/slo/sli_client.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/sli_client.test.ts index 1160448854c95..45e2683a00a35 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/sli_client.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/sli_client.test.ts @@ -9,7 +9,7 @@ import { ElasticsearchClientMock, elasticsearchServiceMock } from '@kbn/core/ser import moment from 'moment'; import { ALL_VALUE } from '@kbn/slo-schema'; -import { Duration, DurationUnit } from '../../domain/models'; +import { Duration, DurationUnit } from '../domain/models'; import { createSLO } from './fixtures/slo'; import { DefaultSLIClient } from './sli_client'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/sli_client.ts b/x-pack/plugins/observability_solution/slo/server/services/sli_client.ts similarity index 94% rename from x-pack/plugins/observability_solution/observability/server/services/slo/sli_client.ts rename to x-pack/plugins/observability_solution/slo/server/services/sli_client.ts index 1eab9181e8b0f..ed645e8da7384 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/sli_client.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/sli_client.ts @@ -20,11 +20,11 @@ import { timeslicesBudgetingMethodSchema, } from '@kbn/slo-schema'; import { assertNever } from '@kbn/std'; -import { SLO_DESTINATION_INDEX_PATTERN } from '../../../common/slo/constants'; -import { DateRange, Duration, IndicatorData, SLO } from '../../domain/models'; -import { InternalQueryError } from '../../errors'; -import { getDelayInSecondsFromSLO } from '../../domain/services/get_delay_in_seconds_from_slo'; -import { getLookbackDateRange } from '../../domain/services/get_lookback_date_range'; +import { SLO_DESTINATION_INDEX_PATTERN } from '../../common/constants'; +import { DateRange, Duration, IndicatorData, SLO } from '../domain/models'; +import { InternalQueryError } from '../errors'; +import { getDelayInSecondsFromSLO } from '../domain/services/get_delay_in_seconds_from_slo'; +import { getLookbackDateRange } from '../domain/services/get_lookback_date_range'; export interface SLIClient { fetchSLIDataFrom( diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/slo_installer.test.ts b/x-pack/plugins/observability_solution/slo/server/services/slo_installer.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/slo_installer.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/slo_installer.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/slo_installer.ts b/x-pack/plugins/observability_solution/slo/server/services/slo_installer.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/slo_installer.ts rename to x-pack/plugins/observability_solution/slo/server/services/slo_installer.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/slo_repository.test.ts b/x-pack/plugins/observability_solution/slo/server/services/slo_repository.test.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/services/slo/slo_repository.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/slo_repository.test.ts index 7259f00aec05c..08366a36ccf61 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/slo_repository.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/slo_repository.test.ts @@ -9,10 +9,10 @@ import { SavedObjectsClientContract, SavedObjectsFindResponse } from '@kbn/core/ import { loggingSystemMock, savedObjectsClientMock } from '@kbn/core/server/mocks'; import { MockedLogger } from '@kbn/logging-mocks'; import { sloSchema } from '@kbn/slo-schema'; -import { SLO_MODEL_VERSION } from '../../../common/slo/constants'; -import { SLO, StoredSLO } from '../../domain/models'; -import { SLOIdConflict, SLONotFound } from '../../errors'; -import { SO_SLO_TYPE } from '../../saved_objects'; +import { SLO_MODEL_VERSION } from '../../common/constants'; +import { SLO, StoredSLO } from '../domain/models'; +import { SLOIdConflict, SLONotFound } from '../errors'; +import { SO_SLO_TYPE } from '../saved_objects'; import { aStoredSLO, createAPMTransactionDurationIndicator, createSLO } from './fixtures/slo'; import { KibanaSavedObjectsSLORepository } from './slo_repository'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/slo_repository.ts b/x-pack/plugins/observability_solution/slo/server/services/slo_repository.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/slo_repository.ts rename to x-pack/plugins/observability_solution/slo/server/services/slo_repository.ts index bfbd7be738450..05d690242f0cf 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/slo_repository.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/slo_repository.ts @@ -9,10 +9,10 @@ import { SavedObjectsClientContract } from '@kbn/core-saved-objects-api-server'; import { Logger } from '@kbn/core/server'; import { ALL_VALUE, Paginated, Pagination, sloSchema } from '@kbn/slo-schema'; import { isLeft } from 'fp-ts/lib/Either'; -import { SLO_MODEL_VERSION } from '../../../common/slo/constants'; -import { SLO, StoredSLO } from '../../domain/models'; -import { SLOIdConflict, SLONotFound } from '../../errors'; -import { SO_SLO_TYPE } from '../../saved_objects'; +import { SLO_MODEL_VERSION } from '../../common/constants'; +import { SLO, StoredSLO } from '../domain/models'; +import { SLOIdConflict, SLONotFound } from '../errors'; +import { SO_SLO_TYPE } from '../saved_objects'; export interface SLORepository { save(slo: SLO, options?: { throwOnConflict: boolean }): Promise; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_client.test.ts b/x-pack/plugins/observability_solution/slo/server/services/summary_client.test.ts similarity index 98% rename from x-pack/plugins/observability_solution/observability/server/services/slo/summary_client.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/summary_client.test.ts index f6850e73575ee..15388b221cc74 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_client.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/summary_client.test.ts @@ -7,8 +7,8 @@ import { ElasticsearchClientMock, elasticsearchServiceMock } from '@kbn/core/server/mocks'; import moment from 'moment'; -import { SLO_DESTINATION_INDEX_PATTERN } from '../../../common/slo/constants'; -import { Duration, DurationUnit } from '../../domain/models'; +import { SLO_DESTINATION_INDEX_PATTERN } from '../../common/constants'; +import { Duration, DurationUnit } from '../domain/models'; import { createSLO } from './fixtures/slo'; import { sevenDaysRolling, weeklyCalendarAligned } from './fixtures/time_window'; import { DefaultSummaryClient } from './summary_client'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_client.ts b/x-pack/plugins/observability_solution/slo/server/services/summary_client.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/summary_client.ts rename to x-pack/plugins/observability_solution/slo/server/services/summary_client.ts index 7fdf0e63c9ee5..74f78929a45c8 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_client.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/summary_client.ts @@ -15,10 +15,10 @@ import { toMomentUnitOfTime, } from '@kbn/slo-schema'; import moment from 'moment'; -import { SLO_DESTINATION_INDEX_PATTERN } from '../../../common/slo/constants'; -import { DateRange, SLO, Summary, Groupings, Meta } from '../../domain/models'; -import { computeSLI, computeSummaryStatus, toErrorBudget } from '../../domain/services'; -import { toDateRange } from '../../domain/services/date_range'; +import { SLO_DESTINATION_INDEX_PATTERN } from '../../common/constants'; +import { DateRange, SLO, Summary, Groupings, Meta } from '../domain/models'; +import { computeSLI, computeSummaryStatus, toErrorBudget } from '../domain/services'; +import { toDateRange } from '../domain/services/date_range'; import { getFlattenedGroupings } from './utils'; export interface SummaryClient { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_search_client.test.ts b/x-pack/plugins/observability_solution/slo/server/services/summary_search_client.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/summary_search_client.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/summary_search_client.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_search_client.ts b/x-pack/plugins/observability_solution/slo/server/services/summary_search_client.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/server/services/slo/summary_search_client.ts rename to x-pack/plugins/observability_solution/slo/server/services/summary_search_client.ts index 454d40c2f0cbc..cea18773777ae 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_search_client.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/summary_search_client.ts @@ -10,9 +10,9 @@ import { ALL_VALUE, Paginated, Pagination } from '@kbn/slo-schema'; import { assertNever } from '@kbn/std'; import { partition } from 'lodash'; import { SearchTotalHits } from '@elastic/elasticsearch/lib/api/types'; -import { SLO_SUMMARY_DESTINATION_INDEX_PATTERN } from '../../../common/slo/constants'; -import { SLOId, Status, Summary, Groupings } from '../../domain/models'; -import { toHighPrecision } from '../../utils/number'; +import { SLO_SUMMARY_DESTINATION_INDEX_PATTERN } from '../../common/constants'; +import { SLOId, Status, Summary, Groupings } from '../domain/models'; +import { toHighPrecision } from '../utils/number'; import { getFlattenedGroupings } from './utils'; import { getElasticsearchQueryOrThrow } from './transform_generators'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/common.ts b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/common.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/common.ts rename to x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/common.ts index f21909dec6c07..1f2abc88b7cc2 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/common.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/common.ts @@ -6,7 +6,7 @@ */ import { ALL_VALUE } from '@kbn/slo-schema'; -import { SLO } from '../../../../domain/models/slo'; +import { SLO } from '../../../domain/models/slo'; export const getGroupBy = (slo: SLO) => { const groups = [slo.groupBy].flat().filter((group) => !!group); diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/occurrences.ts b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/occurrences.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/occurrences.ts rename to x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/occurrences.ts index 3cae531cfeb98..0c2b29f6fa7ef 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/occurrences.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/occurrences.ts @@ -6,14 +6,14 @@ */ import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/types'; -import { SLO } from '../../../../domain/models'; +import { SLO } from '../../../domain/models'; import { getSLOSummaryPipelineId, getSLOSummaryTransformId, SLO_DESTINATION_INDEX_PATTERN, SLO_RESOURCES_VERSION, SLO_SUMMARY_DESTINATION_INDEX_NAME, -} from '../../../../../common/slo/constants'; +} from '../../../../common/constants'; import { getGroupBy } from './common'; export function generateSummaryTransformForOccurrences(slo: SLO): TransformPutTransformRequest { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/timeslices_calendar_aligned.ts b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_calendar_aligned.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/timeslices_calendar_aligned.ts rename to x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_calendar_aligned.ts index 7fc5d98a94603..4fa19ea448828 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/timeslices_calendar_aligned.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_calendar_aligned.ts @@ -6,14 +6,14 @@ */ import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/types'; -import { DurationUnit, SLO } from '../../../../domain/models'; +import { DurationUnit, SLO } from '../../../domain/models'; import { getSLOSummaryPipelineId, getSLOSummaryTransformId, SLO_DESTINATION_INDEX_PATTERN, SLO_RESOURCES_VERSION, SLO_SUMMARY_DESTINATION_INDEX_NAME, -} from '../../../../../common/slo/constants'; +} from '../../../../common/constants'; import { getGroupBy } from './common'; export function generateSummaryTransformForTimeslicesAndCalendarAligned( diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/timeslices_rolling.ts b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_rolling.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/timeslices_rolling.ts rename to x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_rolling.ts index 113df2c4ce72f..3b3abb474476b 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/generators/timeslices_rolling.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/generators/timeslices_rolling.ts @@ -6,14 +6,14 @@ */ import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/types'; -import { SLO } from '../../../../domain/models'; +import { SLO } from '../../../domain/models'; import { getSLOSummaryPipelineId, getSLOSummaryTransformId, SLO_DESTINATION_INDEX_PATTERN, SLO_RESOURCES_VERSION, SLO_SUMMARY_DESTINATION_INDEX_NAME, -} from '../../../../../common/slo/constants'; +} from '../../../../common/constants'; import { getGroupBy } from './common'; export function generateSummaryTransformForTimeslicesAndRolling( diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/helpers/create_temp_summary.ts b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/helpers/create_temp_summary.ts similarity index 97% rename from x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/helpers/create_temp_summary.ts rename to x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/helpers/create_temp_summary.ts index 8e1939647bac8..635577166466f 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/helpers/create_temp_summary.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/helpers/create_temp_summary.ts @@ -6,7 +6,7 @@ */ import { ALL_VALUE } from '@kbn/slo-schema'; -import { SLO } from '../../../../domain/models'; +import { SLO } from '../../../domain/models'; export function createTempSummaryDocument(slo: SLO, spaceId: string) { const apmParams = 'environment' in slo.indicator.params ? slo.indicator.params : null; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/summary_transform_generator.ts b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/summary_transform_generator.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/summary_transform_generator.ts rename to x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/summary_transform_generator.ts index 7710515f6538a..7eb63e59718c5 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/summary_transform_generator/summary_transform_generator.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/summary_transform_generator/summary_transform_generator.ts @@ -6,7 +6,7 @@ */ import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/types'; -import { SLO } from '../../../domain/models'; +import { SLO } from '../../domain/models'; import { generateSummaryTransformForOccurrences } from './generators/occurrences'; import { generateSummaryTransformForTimeslicesAndRolling } from './generators/timeslices_rolling'; import { generateSummaryTransformForTimeslicesAndCalendarAligned } from './generators/timeslices_calendar_aligned'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/summay_transform_manager.ts b/x-pack/plugins/observability_solution/slo/server/services/summay_transform_manager.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/summay_transform_manager.ts rename to x-pack/plugins/observability_solution/slo/server/services/summay_transform_manager.ts index 57349105e020a..c9590e5cc90ca 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/summay_transform_manager.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/summay_transform_manager.ts @@ -8,9 +8,9 @@ import { ElasticsearchClient, Logger } from '@kbn/core/server'; import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/types'; -import { SLO } from '../../domain/models'; -import { SecurityException } from '../../errors'; -import { retryTransientEsErrors } from '../../utils/retry'; +import { SLO } from '../domain/models'; +import { SecurityException } from '../errors'; +import { retryTransientEsErrors } from '../utils/retry'; import { SummaryTransformGenerator } from './summary_transform_generator/summary_transform_generator'; import { TransformManager } from './transform_manager'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/tasks/orphan_summary_cleanup_task.test.ts b/x-pack/plugins/observability_solution/slo/server/services/tasks/orphan_summary_cleanup_task.test.ts similarity index 99% rename from x-pack/plugins/observability_solution/observability/server/services/slo/tasks/orphan_summary_cleanup_task.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/tasks/orphan_summary_cleanup_task.test.ts index 2821560e6cabc..b947e0985c580 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/tasks/orphan_summary_cleanup_task.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/tasks/orphan_summary_cleanup_task.test.ts @@ -12,7 +12,7 @@ import { loggerMock } from '@kbn/logging-mocks'; import { elasticsearchClientMock } from '@kbn/core-elasticsearch-client-server-mocks'; import { times } from 'lodash'; import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; -import { SLO_SUMMARY_DESTINATION_INDEX_PATTERN } from '../../../../common/slo/constants'; +import { SLO_SUMMARY_DESTINATION_INDEX_PATTERN } from '../../../common/constants'; const taskManagerSetup = taskManagerMock.createSetup(); const taskManagerStart = taskManagerMock.createStart(); diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/tasks/orphan_summary_cleanup_task.ts b/x-pack/plugins/observability_solution/slo/server/services/tasks/orphan_summary_cleanup_task.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/server/services/slo/tasks/orphan_summary_cleanup_task.ts rename to x-pack/plugins/observability_solution/slo/server/services/tasks/orphan_summary_cleanup_task.ts index c863dadfe859c..d41ec6e142080 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/tasks/orphan_summary_cleanup_task.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/tasks/orphan_summary_cleanup_task.ts @@ -13,10 +13,10 @@ import { } from '@kbn/task-manager-plugin/server'; import { AggregationsCompositeAggregateKey } from '@elastic/elasticsearch/lib/api/types'; import { ALL_SPACES_ID } from '@kbn/spaces-plugin/common/constants'; -import { StoredSLO } from '../../../domain/models'; -import { SO_SLO_TYPE } from '../../../saved_objects'; -import { ObservabilityConfig } from '../../..'; -import { SLO_SUMMARY_DESTINATION_INDEX_PATTERN } from '../../../../common/slo/constants'; +import { StoredSLO } from '../../domain/models'; +import { SO_SLO_TYPE } from '../../saved_objects'; +import { SloConfig } from '../..'; +import { SLO_SUMMARY_DESTINATION_INDEX_PATTERN } from '../../../common/constants'; export const TASK_TYPE = 'SLO:ORPHAN_SUMMARIES-CLEANUP-TASK'; @@ -49,9 +49,9 @@ export class SloOrphanSummaryCleanupTask { private taskManager?: TaskManagerStartContract; private soClient?: SavedObjectsClientContract; private esClient?: ElasticsearchClient; - private config: ObservabilityConfig; + private config: SloConfig; - constructor(taskManager: TaskManagerSetupContract, logger: Logger, config: ObservabilityConfig) { + constructor(taskManager: TaskManagerSetupContract, logger: Logger, config: SloConfig) { this.logger = logger; this.config = config; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/histogram.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/histogram.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/histogram.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/histogram.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/kql_custom.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/kql_custom.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/kql_custom.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/kql_custom.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/metric_custom.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/metric_custom.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/metric_custom.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/metric_custom.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/timeslice_metric.test.ts.snap b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/timeslice_metric.test.ts.snap similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/__snapshots__/timeslice_metric.test.ts.snap rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/__snapshots__/timeslice_metric.test.ts.snap diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/apm_transaction_duration.test.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_duration.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/apm_transaction_duration.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_duration.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/apm_transaction_duration.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_duration.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/apm_transaction_duration.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_duration.ts index 9559936dff321..2b723e43763b7 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/apm_transaction_duration.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_duration.ts @@ -18,10 +18,10 @@ import { getSLOTransformId, SLO_DESTINATION_INDEX_NAME, SLO_INGEST_PIPELINE_NAME, -} from '../../../../common/slo/constants'; -import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; -import { APMTransactionDurationIndicator, SLO } from '../../../domain/models'; -import { InvalidTransformError } from '../../../errors'; +} from '../../../common/constants'; +import { getSLOTransformTemplate } from '../../assets/transform_templates/slo_transform_template'; +import { APMTransactionDurationIndicator, SLO } from '../../domain/models'; +import { InvalidTransformError } from '../../errors'; import { parseIndex } from './common'; export class ApmTransactionDurationTransformGenerator extends TransformGenerator { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/apm_transaction_error_rate.test.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_error_rate.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/apm_transaction_error_rate.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_error_rate.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/apm_transaction_error_rate.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_error_rate.ts similarity index 94% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/apm_transaction_error_rate.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_error_rate.ts index 8fcdd45b26570..c80a962a58146 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/apm_transaction_error_rate.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/apm_transaction_error_rate.ts @@ -17,10 +17,10 @@ import { getSLOTransformId, SLO_DESTINATION_INDEX_NAME, SLO_INGEST_PIPELINE_NAME, -} from '../../../../common/slo/constants'; -import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; -import { APMTransactionErrorRateIndicator, SLO } from '../../../domain/models'; -import { InvalidTransformError } from '../../../errors'; +} from '../../../common/constants'; +import { getSLOTransformTemplate } from '../../assets/transform_templates/slo_transform_template'; +import { APMTransactionErrorRateIndicator, SLO } from '../../domain/models'; +import { InvalidTransformError } from '../../errors'; import { parseIndex } from './common'; export class ApmTransactionErrorRateTransformGenerator extends TransformGenerator { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/common.test.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/common.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/common.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/common.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/common.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/common.ts similarity index 94% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/common.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/common.ts index 8af0952a5e5b7..e173aa24ce818 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/common.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/common.ts @@ -7,7 +7,7 @@ import { buildEsQuery, fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query'; import { QuerySchema, kqlQuerySchema } from '@kbn/slo-schema'; -import { InvalidTransformError } from '../../../errors'; +import { InvalidTransformError } from '../../errors'; export function getElasticsearchQueryOrThrow(kuery: QuerySchema = '') { try { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/histogram.test.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/histogram.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/histogram.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/histogram.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/histogram.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/histogram.ts similarity index 92% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/histogram.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/histogram.ts index d493ea3c8b544..6c151bd9626ff 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/histogram.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/histogram.ts @@ -12,15 +12,15 @@ import { timeslicesBudgetingMethodSchema, } from '@kbn/slo-schema'; -import { InvalidTransformError } from '../../../errors'; -import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; +import { InvalidTransformError } from '../../errors'; +import { getSLOTransformTemplate } from '../../assets/transform_templates/slo_transform_template'; import { getElasticsearchQueryOrThrow, parseIndex, TransformGenerator } from '.'; import { SLO_DESTINATION_INDEX_NAME, SLO_INGEST_PIPELINE_NAME, getSLOTransformId, -} from '../../../../common/slo/constants'; -import { SLO } from '../../../domain/models'; +} from '../../../common/constants'; +import { SLO } from '../../domain/models'; import { GetHistogramIndicatorAggregation } from '../aggregations'; export class HistogramTransformGenerator extends TransformGenerator { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/index.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/index.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/index.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/index.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/kql_custom.test.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/kql_custom.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/kql_custom.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/kql_custom.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/kql_custom.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/kql_custom.ts similarity index 91% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/kql_custom.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/kql_custom.ts index 3fecd8b1cdd6d..5f5c0a3abcbec 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/kql_custom.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/kql_custom.ts @@ -8,15 +8,15 @@ import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/types'; import { kqlCustomIndicatorSchema, timeslicesBudgetingMethodSchema } from '@kbn/slo-schema'; -import { InvalidTransformError } from '../../../errors'; -import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; +import { InvalidTransformError } from '../../errors'; +import { getSLOTransformTemplate } from '../../assets/transform_templates/slo_transform_template'; import { getElasticsearchQueryOrThrow, parseIndex, TransformGenerator } from '.'; import { SLO_DESTINATION_INDEX_NAME, SLO_INGEST_PIPELINE_NAME, getSLOTransformId, -} from '../../../../common/slo/constants'; -import { KQLCustomIndicator, SLO } from '../../../domain/models'; +} from '../../../common/constants'; +import { KQLCustomIndicator, SLO } from '../../domain/models'; export class KQLCustomTransformGenerator extends TransformGenerator { public getTransformParams(slo: SLO): TransformPutTransformRequest { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/metric_custom.test.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/metric_custom.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/metric_custom.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/metric_custom.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/metric_custom.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/metric_custom.ts similarity index 92% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/metric_custom.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/metric_custom.ts index 6e2bd80350cb9..660673944fe60 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/metric_custom.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/metric_custom.ts @@ -8,15 +8,15 @@ import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/types'; import { metricCustomIndicatorSchema, timeslicesBudgetingMethodSchema } from '@kbn/slo-schema'; -import { InvalidTransformError } from '../../../errors'; -import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; +import { InvalidTransformError } from '../../errors'; +import { getSLOTransformTemplate } from '../../assets/transform_templates/slo_transform_template'; import { getElasticsearchQueryOrThrow, parseIndex, TransformGenerator } from '.'; import { SLO_DESTINATION_INDEX_NAME, SLO_INGEST_PIPELINE_NAME, getSLOTransformId, -} from '../../../../common/slo/constants'; -import { MetricCustomIndicator, SLO } from '../../../domain/models'; +} from '../../../common/constants'; +import { MetricCustomIndicator, SLO } from '../../domain/models'; import { GetCustomMetricIndicatorAggregation } from '../aggregations'; export const INVALID_EQUATION_REGEX = /[^A-Z|+|\-|\s|\d+|\.|\(|\)|\/|\*|>|<|=|\?|\:|&|\!|\|]+/g; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/synthetics_availability.test.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/synthetics_availability.test.ts similarity index 98% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/synthetics_availability.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/synthetics_availability.test.ts index 8db7f950865d5..8f973ca62ee11 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/synthetics_availability.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/synthetics_availability.test.ts @@ -6,10 +6,10 @@ */ import { ALL_VALUE } from '@kbn/slo-schema'; -import { SLO } from '../../../domain/models'; +import { SLO } from '../../domain/models'; import { createSLO, createSyntheticsAvailabilityIndicator } from '../fixtures/slo'; import { SyntheticsAvailabilityTransformGenerator } from './synthetics_availability'; -import { SYNTHETICS_INDEX_PATTERN } from '../../../../common/slo/constants'; +import { SYNTHETICS_INDEX_PATTERN } from '../../../common/constants'; const generator = new SyntheticsAvailabilityTransformGenerator(); diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/synthetics_availability.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/synthetics_availability.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/synthetics_availability.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/synthetics_availability.ts index 78dd7f8e1a873..97fd089a97111 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/synthetics_availability.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/synthetics_availability.ts @@ -11,6 +11,7 @@ import { ALL_VALUE, syntheticsAvailabilityIndicatorSchema, occurrencesBudgetingMethodSchema, + SyntheticsAvailabilityIndicator, } from '@kbn/slo-schema'; import { getElasticsearchQueryOrThrow, TransformGenerator } from '.'; import { @@ -18,10 +19,10 @@ import { SLO_DESTINATION_INDEX_NAME, SLO_INGEST_PIPELINE_NAME, SYNTHETICS_INDEX_PATTERN, -} from '../../../../common/slo/constants'; -import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; -import { SyntheticsAvailabilityIndicator, SLO } from '../../../domain/models'; -import { InvalidTransformError } from '../../../errors'; +} from '../../../common/constants'; +import { getSLOTransformTemplate } from '../../assets/transform_templates/slo_transform_template'; +import { InvalidTransformError } from '../../errors'; +import { SLO } from '../../domain/models'; export class SyntheticsAvailabilityTransformGenerator extends TransformGenerator { public getTransformParams(slo: SLO, spaceId: string): TransformPutTransformRequest { if (!syntheticsAvailabilityIndicatorSchema.is(slo.indicator)) { diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/timeslice_metric.test.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/timeslice_metric.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/timeslice_metric.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/timeslice_metric.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/timeslice_metric.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/timeslice_metric.ts similarity index 93% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/timeslice_metric.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/timeslice_metric.ts index 8e59a03d04d9f..649ffe609559d 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/timeslice_metric.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/timeslice_metric.ts @@ -13,15 +13,15 @@ import { timeslicesBudgetingMethodSchema, } from '@kbn/slo-schema'; -import { InvalidTransformError } from '../../../errors'; -import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; +import { InvalidTransformError } from '../../errors'; +import { getSLOTransformTemplate } from '../../assets/transform_templates/slo_transform_template'; import { getElasticsearchQueryOrThrow, parseIndex, TransformGenerator } from '.'; import { SLO_DESTINATION_INDEX_NAME, SLO_INGEST_PIPELINE_NAME, getSLOTransformId, -} from '../../../../common/slo/constants'; -import { SLO } from '../../../domain/models'; +} from '../../../common/constants'; +import { SLO } from '../../domain/models'; import { GetTimesliceMetricIndicatorAggregation } from '../aggregations'; const INVALID_EQUATION_REGEX = /[^A-Z|+|\-|\s|\d+|\.|\(|\)|\/|\*|>|<|=|\?|\:|&|\!|\|]+/g; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/transform_generator.test.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/transform_generator.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/transform_generator.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/transform_generator.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/transform_generator.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/transform_generator.ts similarity index 96% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/transform_generator.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/transform_generator.ts index c630136a3b42e..afc88433bca11 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/transform_generator.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/transform_generator.ts @@ -10,8 +10,8 @@ import { TransformPutTransformRequest, } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { ALL_VALUE, timeslicesBudgetingMethodSchema } from '@kbn/slo-schema'; -import { TransformSettings } from '../../../assets/transform_templates/slo_transform_template'; -import { SLO } from '../../../domain/models'; +import { TransformSettings } from '../../assets/transform_templates/slo_transform_template'; +import { SLO } from '../../domain/models'; export abstract class TransformGenerator { public abstract getTransformParams(slo: SLO, spaceId: string): TransformPutTransformRequest; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/types.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_generators/types.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_generators/types.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_generators/types.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_manager.test.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_manager.test.ts similarity index 99% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_manager.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_manager.test.ts index 230292ad6e083..75ce8fcffc8e1 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_manager.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_manager.test.ts @@ -20,7 +20,7 @@ import { ApmTransactionErrorRateTransformGenerator, TransformGenerator, } from './transform_generators'; -import { SLO, IndicatorTypes } from '../../domain/models'; +import { SLO, IndicatorTypes } from '../domain/models'; import { createAPMTransactionDurationIndicator, createAPMTransactionErrorRateIndicator, diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_manager.ts b/x-pack/plugins/observability_solution/slo/server/services/transform_manager.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/transform_manager.ts rename to x-pack/plugins/observability_solution/slo/server/services/transform_manager.ts index e920a84735d51..b53b87837b533 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/transform_manager.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/transform_manager.ts @@ -8,9 +8,9 @@ import { ElasticsearchClient, Logger } from '@kbn/core/server'; import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { SLO, IndicatorTypes } from '../../domain/models'; -import { SecurityException } from '../../errors'; -import { retryTransientEsErrors } from '../../utils/retry'; +import { SLO, IndicatorTypes } from '../domain/models'; +import { SecurityException } from '../errors'; +import { retryTransientEsErrors } from '../utils/retry'; import { TransformGenerator } from './transform_generators'; type TransformId = string; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/update_slo.test.ts b/x-pack/plugins/observability_solution/slo/server/services/update_slo.test.ts similarity index 99% rename from x-pack/plugins/observability_solution/observability/server/services/slo/update_slo.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/update_slo.test.ts index d93e4549ca3dc..8e7e1d4f0bcfe 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/update_slo.test.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/update_slo.test.ts @@ -20,8 +20,8 @@ import { getSLOTransformId, SLO_DESTINATION_INDEX_PATTERN, SLO_SUMMARY_DESTINATION_INDEX_PATTERN, -} from '../../../common/slo/constants'; -import { SLO } from '../../domain/models'; +} from '../../common/constants'; +import { SLO } from '../domain/models'; import { fiveMinute, oneMinute } from './fixtures/duration'; import { createAPMTransactionErrorRateIndicator, diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/update_slo.ts b/x-pack/plugins/observability_solution/slo/server/services/update_slo.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/update_slo.ts rename to x-pack/plugins/observability_solution/slo/server/services/update_slo.ts index ac00fa9daa21b..1aed6d99028d3 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/update_slo.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/update_slo.ts @@ -15,11 +15,11 @@ import { SLO_DESTINATION_INDEX_PATTERN, SLO_SUMMARY_DESTINATION_INDEX_PATTERN, SLO_SUMMARY_TEMP_INDEX_NAME, -} from '../../../common/slo/constants'; -import { getSLOSummaryPipelineTemplate } from '../../assets/ingest_templates/slo_summary_pipeline_template'; -import { SLO } from '../../domain/models'; -import { validateSLO } from '../../domain/services'; -import { retryTransientEsErrors } from '../../utils/retry'; +} from '../../common/constants'; +import { getSLOSummaryPipelineTemplate } from '../assets/ingest_templates/slo_summary_pipeline_template'; +import { SLO } from '../domain/models'; +import { validateSLO } from '../domain/services'; +import { retryTransientEsErrors } from '../utils/retry'; import { SLORepository } from './slo_repository'; import { createTempSummaryDocument } from './summary_transform_generator/helpers/create_temp_summary'; import { TransformManager } from './transform_manager'; diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/utils/index.test.ts b/x-pack/plugins/observability_solution/slo/server/services/utils/index.test.ts similarity index 100% rename from x-pack/plugins/observability_solution/observability/server/services/slo/utils/index.test.ts rename to x-pack/plugins/observability_solution/slo/server/services/utils/index.test.ts diff --git a/x-pack/plugins/observability_solution/observability/server/services/slo/utils/index.ts b/x-pack/plugins/observability_solution/slo/server/services/utils/index.ts similarity index 95% rename from x-pack/plugins/observability_solution/observability/server/services/slo/utils/index.ts rename to x-pack/plugins/observability_solution/slo/server/services/utils/index.ts index 33ac4ed81964c..a50d2640b3195 100644 --- a/x-pack/plugins/observability_solution/observability/server/services/slo/utils/index.ts +++ b/x-pack/plugins/observability_solution/slo/server/services/utils/index.ts @@ -5,7 +5,7 @@ * 2.0. */ import { get } from 'lodash'; -import { Groupings } from '../../../domain/models'; +import { Groupings } from '../../domain/models'; /** * Takes a list of groupBy fields and the nested groupings object provided from diff --git a/x-pack/plugins/observability_solution/slo/server/types.ts b/x-pack/plugins/observability_solution/slo/server/types.ts new file mode 100644 index 0000000000000..86bf0ac0b94ab --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/types.ts @@ -0,0 +1,19 @@ +/* + * 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 { LicensingApiRequestHandlerContext } from '@kbn/licensing-plugin/server'; +import type { AlertingApiRequestHandlerContext } from '@kbn/alerting-plugin/server'; +import type { CustomRequestHandlerContext, CoreRequestHandlerContext } from '@kbn/core/server'; + +/** + * @internal + */ +export type SloRequestHandlerContext = CustomRequestHandlerContext<{ + licensing: LicensingApiRequestHandlerContext; + alerting: AlertingApiRequestHandlerContext; + core: Promise; +}>; diff --git a/x-pack/plugins/observability_solution/slo/server/utils/number.ts b/x-pack/plugins/observability_solution/slo/server/utils/number.ts new file mode 100644 index 0000000000000..bfec2d6200f19 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/utils/number.ts @@ -0,0 +1,12 @@ +/* + * 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. + */ + +const SIX_DIGITS = 1000000; + +export function toHighPrecision(value: number): number { + return Math.round(value * SIX_DIGITS) / SIX_DIGITS; +} diff --git a/x-pack/plugins/observability_solution/slo/server/utils/queries.test.ts b/x-pack/plugins/observability_solution/slo/server/utils/queries.test.ts new file mode 100644 index 0000000000000..0e34f84050386 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/utils/queries.test.ts @@ -0,0 +1,42 @@ +/* + * 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 { wildcardQuery } from './queries'; // Replace 'your-module' with the actual module path + +describe('wildcardQuery', () => { + it('generates wildcard query with leading wildcard by default', () => { + const result = wildcardQuery('fieldName', 'value'); + expect(result).toEqual([ + { + wildcard: { + fieldName: { + value: '*value*', + case_insensitive: true, + }, + }, + }, + ]); + }); + + it('generates wildcard query without leading wildcard if specified in options', () => { + const result = wildcardQuery('fieldName', 'value', { leadingWildcard: false }); + expect(result).toEqual([ + { + wildcard: { + fieldName: { + value: 'value*', + case_insensitive: true, + }, + }, + }, + ]); + }); + + it('returns an empty array if value is undefined', () => { + const result = wildcardQuery('fieldName', undefined); + expect(result).toEqual([]); + }); +}); diff --git a/x-pack/plugins/observability_solution/slo/server/utils/queries.ts b/x-pack/plugins/observability_solution/slo/server/utils/queries.ts new file mode 100644 index 0000000000000..bdacad577838c --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/utils/queries.ts @@ -0,0 +1,103 @@ +/* + * 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 { reject } from 'lodash'; +import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; +import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query'; +import { ESSearchResponse } from '@kbn/es-types'; +import { ElasticsearchClient } from '@kbn/core-elasticsearch-server'; + +export function isUndefinedOrNull(value: any): value is undefined | null { + return value === undefined || value === null; +} + +interface TermQueryOpts { + queryEmptyString: boolean; +} + +export function termQuery( + field: T, + value: string | boolean | number | undefined | null, + opts: TermQueryOpts = { queryEmptyString: true } +): QueryDslQueryContainer[] { + if (isUndefinedOrNull(value) || (!opts.queryEmptyString && value === '')) { + return []; + } + + return [{ term: { [field]: value } }]; +} + +export function wildcardQuery( + field: T, + value: string | undefined, + opts = { leadingWildcard: true } +): QueryDslQueryContainer[] { + if (isUndefinedOrNull(value)) { + return []; + } + + return [ + { + wildcard: { + [field]: { + value: opts.leadingWildcard ? `*${value}*` : `${value}*`, + case_insensitive: true, + }, + }, + }, + ]; +} + +export function termsQuery( + field: string, + ...values: Array +): QueryDslQueryContainer[] { + const filtered = reject(values, isUndefinedOrNull); + + if (!filtered.length) { + return []; + } + + return [{ terms: { [field]: filtered } }]; +} + +export function rangeQuery( + start?: number, + end?: number, + field = '@timestamp' +): estypes.QueryDslQueryContainer[] { + return [ + { + range: { + [field]: { + gte: start, + lte: end, + format: 'epoch_millis', + }, + }, + }, + ]; +} + +export function kqlQuery(kql?: string): estypes.QueryDslQueryContainer[] { + if (!kql) { + return []; + } + + const ast = fromKueryExpression(kql); + return [toElasticsearchQuery(ast)]; +} + +export async function typedSearch< + DocumentSource extends unknown, + TParams extends estypes.SearchRequest +>( + esClient: ElasticsearchClient, + params: TParams +): Promise> { + return (await esClient.search(params)) as unknown as ESSearchResponse; +} diff --git a/x-pack/plugins/observability_solution/slo/server/utils/retry.test.ts b/x-pack/plugins/observability_solution/slo/server/utils/retry.test.ts new file mode 100644 index 0000000000000..25870fd24aa73 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/utils/retry.test.ts @@ -0,0 +1,87 @@ +/* + * 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. + */ + +jest.mock('timers/promises'); +import { setTimeout } from 'timers/promises'; +import { loggerMock } from '@kbn/logging-mocks'; +import { errors as EsErrors } from '@elastic/elasticsearch'; + +import { retryTransientEsErrors } from './retry'; + +const setTimeoutMock = setTimeout as jest.Mock< + ReturnType, + Parameters +>; + +describe('retryTransientErrors', () => { + beforeEach(() => { + setTimeoutMock.mockClear(); + }); + + it("doesn't retry if operation is successful", async () => { + const esCallMock = jest.fn().mockResolvedValue('success'); + expect(await retryTransientEsErrors(esCallMock)).toEqual('success'); + expect(esCallMock).toHaveBeenCalledTimes(1); + }); + + it('logs an warning message on retry', async () => { + const logger = loggerMock.create(); + const esCallMock = jest + .fn() + .mockRejectedValueOnce(new EsErrors.ConnectionError('foo')) + .mockResolvedValue('success'); + + await retryTransientEsErrors(esCallMock, { logger }); + expect(logger.warn).toHaveBeenCalledTimes(1); + expect(logger.warn.mock.calls[0][0]).toMatch( + `Retrying Elasticsearch operation after [2s] due to error: ConnectionError: foo ConnectionError: foo` + ); + }); + + it('retries with an exponential backoff', async () => { + let attempt = 0; + const esCallMock = jest.fn(async () => { + attempt++; + if (attempt < 5) { + throw new EsErrors.ConnectionError('foo'); + } else { + return 'success'; + } + }); + + expect(await retryTransientEsErrors(esCallMock)).toEqual('success'); + expect(setTimeoutMock.mock.calls).toEqual([[2000], [4000], [8000], [16000]]); + expect(esCallMock).toHaveBeenCalledTimes(5); + }); + + it('retries each supported error type', async () => { + const errors = [ + new EsErrors.NoLivingConnectionsError('no living connection', { + warnings: [], + meta: {} as any, + }), + new EsErrors.ConnectionError('no connection'), + new EsErrors.TimeoutError('timeout'), + new EsErrors.ResponseError({ statusCode: 503, meta: {} as any, warnings: [] }), + new EsErrors.ResponseError({ statusCode: 408, meta: {} as any, warnings: [] }), + new EsErrors.ResponseError({ statusCode: 410, meta: {} as any, warnings: [] }), + ]; + + for (const error of errors) { + const esCallMock = jest.fn().mockRejectedValueOnce(error).mockResolvedValue('success'); + expect(await retryTransientEsErrors(esCallMock)).toEqual('success'); + expect(esCallMock).toHaveBeenCalledTimes(2); + } + }); + + it('does not retry unsupported errors', async () => { + const error = new Error('foo!'); + const esCallMock = jest.fn().mockRejectedValueOnce(error).mockResolvedValue('success'); + await expect(retryTransientEsErrors(esCallMock)).rejects.toThrow(error); + expect(esCallMock).toHaveBeenCalledTimes(1); + }); +}); diff --git a/x-pack/plugins/observability_solution/slo/server/utils/retry.ts b/x-pack/plugins/observability_solution/slo/server/utils/retry.ts new file mode 100644 index 0000000000000..421289d1c0479 --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/server/utils/retry.ts @@ -0,0 +1,53 @@ +/* + * 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 { setTimeout } from 'timers/promises'; +import { errors as EsErrors } from '@elastic/elasticsearch'; +import type { Logger } from '@kbn/logging'; + +const MAX_ATTEMPTS = 5; + +const retryResponseStatuses = [ + 503, // ServiceUnavailable + 408, // RequestTimeout + 410, // Gone +]; + +const isRetryableError = (e: any) => + e instanceof EsErrors.NoLivingConnectionsError || + e instanceof EsErrors.ConnectionError || + e instanceof EsErrors.TimeoutError || + (e instanceof EsErrors.ResponseError && retryResponseStatuses.includes(e?.statusCode!)); + +/** + * Retries any transient network or configuration issues encountered from Elasticsearch with an exponential backoff. + * Should only be used to wrap operations that are idempotent and can be safely executed more than once. + */ +export const retryTransientEsErrors = async ( + esCall: () => Promise, + { logger, attempt = 0 }: { logger?: Logger; attempt?: number } = {} +): Promise => { + try { + return await esCall(); + } catch (e) { + if (attempt < MAX_ATTEMPTS && isRetryableError(e)) { + const retryCount = attempt + 1; + const retryDelaySec = Math.min(Math.pow(2, retryCount), 64); // 2s, 4s, 8s, 16s, 32s, 64s, 64s, 64s ... + + logger?.warn( + `Retrying Elasticsearch operation after [${retryDelaySec}s] due to error: ${e.toString()} ${ + e.stack + }` + ); + + await setTimeout(retryDelaySec * 1000); + return retryTransientEsErrors(esCall, { logger, attempt: retryCount }); + } + + throw e; + } +}; diff --git a/x-pack/plugins/observability_solution/slo/tsconfig.json b/x-pack/plugins/observability_solution/slo/tsconfig.json new file mode 100644 index 0000000000000..baaca962fea5e --- /dev/null +++ b/x-pack/plugins/observability_solution/slo/tsconfig.json @@ -0,0 +1,89 @@ +{ + "extends": "../../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types" + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*", + "../../../typings/**/*" + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + "@kbn/i18n", + "@kbn/i18n-react", + "@kbn/shared-ux-router", + "@kbn/core", + "@kbn/navigation-plugin", + "@kbn/translations-plugin", + "@kbn/rule-data-utils", + "@kbn/triggers-actions-ui-plugin", + "@kbn/observability-plugin", + "@kbn/observability-shared-plugin", + "@kbn/kibana-react-plugin", + "@kbn/react-kibana-context-theme", + "@kbn/shared-ux-link-redirect-app", + "@kbn/kibana-utils-plugin", + "@kbn/slo-schema", + "@kbn/alerting-plugin", + "@kbn/observability-alert-details", + "@kbn/rison", + "@kbn/embeddable-plugin", + "@kbn/lens-plugin", + "@kbn/ui-theme", + "@kbn/es-query", + "@kbn/react-kibana-mount", + "@kbn/cases-plugin", + "@kbn/data-plugin", + "@kbn/core-ui-settings-browser", + "@kbn/security-plugin", + "@kbn/charts-plugin", + "@kbn/ui-actions-plugin", + "@kbn/serverless", + "@kbn/dashboard-plugin", + "@kbn/data-views-plugin", + "@kbn/rule-registry-plugin", + "@kbn/licensing-plugin", + "@kbn/utility-types", + "@kbn/share-plugin", + "@kbn/presentation-util-plugin", + "@kbn/observability-ai-assistant-plugin", + "@kbn/core-http-browser", + "@kbn/core-chrome-browser", + "@kbn/ingest-pipelines-plugin", + "@kbn/unified-search-plugin", + "@kbn/std", + "@kbn/core-lifecycle-browser", + "@kbn/controls-plugin", + "@kbn/cloud-plugin", + "@kbn/spaces-plugin", + "@kbn/data-view-editor-plugin", + "@kbn/shared-ux-page-kibana-template", + "@kbn/config-schema", + "@kbn/usage-collection-plugin", + "@kbn/alerts-as-data-utils", + "@kbn/logging-mocks", + "@kbn/server-route-repository", + "@kbn/features-plugin", + "@kbn/task-manager-plugin", + "@kbn/core-saved-objects-server", + "@kbn/core-elasticsearch-server", + "@kbn/core-saved-objects-api-server", + "@kbn/calculate-auto", + "@kbn/core-elasticsearch-client-server-mocks", + "@kbn/core-saved-objects-api-server-mocks", + "@kbn/es-types", + "@kbn/logging", + "@kbn/unified-data-table", + "@kbn/cell-actions", + "@kbn/discover-utils", + "@kbn/unified-field-list", + "@kbn/data-view-field-editor-plugin", + "@kbn/discover-plugin", + "@kbn/field-formats-plugin", + "@kbn/core-http-server" + ] +} diff --git a/x-pack/plugins/serverless_observability/public/navigation_tree.ts b/x-pack/plugins/serverless_observability/public/navigation_tree.ts index f8742436afeb0..b65cbb3437efa 100644 --- a/x-pack/plugins/serverless_observability/public/navigation_tree.ts +++ b/x-pack/plugins/serverless_observability/public/navigation_tree.ts @@ -77,7 +77,10 @@ export const navigationTree: NavigationTreeDefinition = { ], }, { - link: 'observability-overview:slos', + title: i18n.translate('xpack.serverlessObservability.nav.slo', { + defaultMessage: 'SLOs', + }), + link: 'slo', }, { id: 'aiops', diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 80617c4025a3b..5dbd3e6e5895b 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -28216,39 +28216,6 @@ "xpack.observability.profilingCo2PerKWHUiSettingDescription": "L'intensité carbone mesure la consommation d'énergie de votre centre de données. \n Plus précisément, elle mesure la quantité moyenne de CO2 émise par kilowattheure (kWh) d'énergie consommée dans une région donnée.\n Utilisez l'empreinte carbone {datasheetLink} du cloud pour mettre à jour cette valeur selon votre région. La valeur par défaut correspond à l'est des États-Unis (Virginie septentrionale).", "xpack.observability.rules.deleteConfirmationModal.deleteButtonLabel": "Supprimer {title}", "xpack.observability.rules.deleteConfirmationModal.descriptionText": "Vous ne pouvez pas récupérer {title} après l'avoir supprimé.", - "xpack.observability.slo.alerting.burnRate.reason": "{actionGroupName} : Le taux d'avancement pour le (les) dernier(s) {longWindowDuration} est de {longWindowBurnRate} et pour le (les) dernier(s) {shortWindowDuration} est de {shortWindowBurnRate}. Alerter si supérieur à {burnRateThreshold} pour les deux fenêtres", - "xpack.observability.slo.alerting.burnRate.reasonForInstanceId": "{actionGroupName} : Le taux d'avancement pour le (les) dernier(s) {longWindowDuration} est de {longWindowBurnRate} et pour le (les) dernier(s) {shortWindowDuration} est de {shortWindowBurnRate} pour {instanceId}. Alerter si supérieur à {burnRateThreshold} pour les deux fenêtres", - "xpack.observability.slo.burnRate.breachedStatustSubtitle": "Au rythme actuel, le budget d'erreur sera épuisé en {hour} heures.", - "xpack.observability.slo.burnRate.threshold": "Le seuil est {threshold}x", - "xpack.observability.slo.create.errorNotification": "Un problème est survenu lors de la création de {name}", - "xpack.observability.slo.deleteConfirmationModal.title": "Supprimer {name} ?", - "xpack.observability.slo.duration.day": "{duration, plural, one {1 jour} many {# jours} other {# jours}}", - "xpack.observability.slo.duration.hour": "{duration, plural, one {1 heure} many {# heures} other {# heures}}", - "xpack.observability.slo.duration.minute": "{duration, plural, one {1 minute} many {# minutes} other {# minutes}}", - "xpack.observability.slo.duration.month": "{duration, plural, one {1 mois} many {# mois} other {# mois}}", - "xpack.observability.slo.duration.week": "{duration, plural, one {1 semaine} many {# semaines} other {# prochaines semaines}}", - "xpack.observability.slo.indicatorTypeBadge.exploreInApm": "Afficher les détails de {service}", - "xpack.observability.slo.rules.burnRate.errors.invalidThresholdValue": "Le seuil du taux d'avancement doit être compris entre 1 et {maxBurnRate}.", - "xpack.observability.slo.rules.groupByMessage": "Le SLO que vous avez sélectionné a été créé avec une partition sur \"{groupByField}\". Cette règle surveille et génère une alerte pour chaque instance trouvée dans le champ de partition.", - "xpack.observability.slo.rules.longWindowDuration.tooltip": "Période historique sur laquelle le taux d'avancement est calculé. Une période historique plus courte de {shortWindowDuration} minutes (1/12 de la période historique) sera utilisée pour une récupération plus rapide", - "xpack.observability.slo.slo.activeAlertsBadge.label": "{count, plural, one {# alerte} many {# alertes} other {Alertes #}}", - "xpack.observability.slo.slo.delete.errorNotification": "Impossible de supprimer {name}", - "xpack.observability.slo.slo.delete.successNotification": "{name} supprimé", - "xpack.observability.slo.slo.stats.objective": "Objectif {objective}", - "xpack.observability.slo.slo.timeWindow.calendar": "{elapsed}/{total} jours", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.duration": "{duration}", - "xpack.observability.slo.sloDetails.overview.apmSource.environmentLabel": "environnement : {value}", - "xpack.observability.slo.sloDetails.overview.apmSource.serviceLabel": "service : {value}", - "xpack.observability.slo.sloDetails.overview.apmSource.transactionNameLabel": "nom de transaction : {value}", - "xpack.observability.slo.sloDetails.overview.apmSource.transactionTypeLabel": "type de transaction : {value}", - "xpack.observability.slo.sloDetails.overview.calendarAlignedTimeWindow": "calendrier {duration} aligné", - "xpack.observability.slo.sloDetails.overview.observedValueSubtitle": "{value} (l'objectif est {objective})", - "xpack.observability.slo.sloDetails.overview.rollingTimeWindow": "{duration} en cours", - "xpack.observability.slo.sloDetails.overview.timeslicesBudgetingMethodDetails": "{duration} sections, {target} cible", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.duration": "{duration}", - "xpack.observability.slo.sloEdit.rollingTimeWindow.days": "{number} jours", - "xpack.observability.slo.update.errorNotification": "Un problème est survenu lors de la mise à jour de {name}", - "xpack.observability.slo.update.successNotification": "Mise à jour réussie de {name}", "xpack.observability.syntheticsThrottlingEnabledExperimentDescription": "Activez les paramètres de régulation dans les configurations du moniteur Synthetics. Notez qu’il est possible que la régulation ne soit pas toujours disponible pour vos moniteurs, même si le paramètre est actif. Destiné à un usage interne uniquement. {link}", "xpack.observability.transactionRateLabel": "{value} tpm", "xpack.observability.ux.coreVitals.averageMessage": " et inférieur à {bad}", @@ -28317,11 +28284,6 @@ "xpack.observability.breadcrumbs.alertsLinkText": "Alertes", "xpack.observability.breadcrumbs.overviewLinkText": "Aperçu", "xpack.observability.breadcrumbs.rulesLinkText": "Règles", - "xpack.observability.breadcrumbs.sloCreateLabel": "Créer", - "xpack.observability.breadcrumbs.sloDetailsLinkText": "Détails", - "xpack.observability.breadcrumbs.sloEditLabel": "Modifier", - "xpack.observability.breadcrumbs.sloLabel": "SLO", - "xpack.observability.breadcrumbs.slosLinkText": "SLO", "xpack.observability.cases.caseFeatureNoPermissionsMessage": "Pour afficher les cas, vous devez disposer de privilèges pour la fonctionnalité Cas dans l'espace Kibana. Pour en savoir plus, contactez votre administrateur Kibana.", "xpack.observability.cases.caseFeatureNoPermissionsTitle": "Privilèges de fonctionnalité Kibana requis", "xpack.observability.cases.caseView.goToDocumentationButton": "Afficher la documentation", @@ -28398,7 +28360,6 @@ "xpack.observability.customThreshold.rule.viewInAppUrlActionVariableDescription": "Lien vers la source de l’alerte", "xpack.observability.defaultApmServiceEnvironment": "Environnement de service par défaut", "xpack.observability.defaultApmServiceEnvironmentDescription": "Définissez l’environnement par défaut pour l’application APM. Sinon, les données de tous les environnements sont affichées par défaut.", - "xpack.observability.embeddableSlo.config.confirmButtonLabel": "Confirmer les configurations", "xpack.observability.emptySection.apps.alert.description": "Détectez des conditions complexes dans Observability et déclenchez des actions lorsque ces conditions sont satisfaites.", "xpack.observability.emptySection.apps.alert.link": "Créer une règle", "xpack.observability.emptySection.apps.alert.title": "Aucune alerte n'a été trouvée.", @@ -28437,7 +28398,6 @@ "xpack.observability.featureRegistry.deleteSubFeatureDetails": "Supprimer les cas et les commentaires", "xpack.observability.featureRegistry.deleteSubFeatureName": "Supprimer", "xpack.observability.featureRegistry.linkObservabilityTitle": "Cas", - "xpack.observability.featureRegistry.linkSloTitle": "SLO", "xpack.observability.feedbackMenu.appName": "Observabilité", "xpack.observability.formatters.hoursTimeUnitLabel": "h", "xpack.observability.formatters.hoursTimeUnitLabelExtended": "heures", @@ -28569,246 +28529,6 @@ "xpack.observability.section.errorPanel": "Une erreur est survenue lors de la tentative de récupération des données. Réessayez plus tard", "xpack.observability.serviceGroupMaxServicesUiSettingDescription": "Limiter le nombre de services dans un groupe de services donné", "xpack.observability.serviceGroupMaxServicesUiSettingName": "Nombre maximum de services dans un groupe de services", - "xpack.observability.slo.alerting.alertDetailsUrlDescription": "Lien vers l’affichage de résolution des problèmes d’alerte pour voir plus de contextes et de détails. La chaîne sera vide si server.publicBaseUrl n'est pas configuré.", - "xpack.observability.slo.alerting.burnRate.alertAction": "Critique", - "xpack.observability.slo.alerting.burnRate.highPriorityAction": "Élevé", - "xpack.observability.slo.alerting.burnRate.lowPriorityAction": "Bas", - "xpack.observability.slo.alerting.burnRate.mediumPriorityAction": "Moyenne", - "xpack.observability.slo.alerting.reasonDescription": "Une description concise de la raison du signalement", - "xpack.observability.slo.alerting.sloIdDescription": "Identificateur unique du SLO.", - "xpack.observability.slo.alerting.sloInstanceIdDescription": "ID d'instance du SLO.", - "xpack.observability.slo.alerting.sloNameDescription": "Nom SLO.", - "xpack.observability.slo.alerting.thresholdDescription": "Valeur de seuil du taux d'avancement.", - "xpack.observability.slo.alerting.timestampDescription": "Horodatage du moment où l'alerte a été détectée.", - "xpack.observability.slo.alerting.viewInAppUrlDescription": "L'URL de la page de détails du SLO pour effectuer une enquête plus approfondie.", - "xpack.observability.slo.alerting.windowDescription": "Durée de fenêtre avec la valeur du taux d'avancement associée.", - "xpack.observability.slo.budgetingMethod.occurrences": "Occurrences", - "xpack.observability.slo.budgetingMethod.timeslices": "Intervalles de temps", - "xpack.observability.slo.burnRate.breachedStatustTitle": "Valeur critique dépassée", - "xpack.observability.slo.burnRate.noDataStatusSubtitle": "En attente de plus de données.", - "xpack.observability.slo.burnRate.noDataStatusTitle": "Aucune valeur", - "xpack.observability.slo.burnRate.okStatusSubtitle": "Aucun risque d'épuisement du budget d'erreurs.", - "xpack.observability.slo.burnRate.okStatusTitle": "Valeur acceptable", - "xpack.observability.slo.burnRate.technicalPreviewBadgeDescription": "Cette fonctionnalité est en préversion technique et est susceptible d’être changée, ou elle peut-être supprimée dans les versions futures. La conception et le code sont moins matures que les fonctionnalités officielles en disponibilité générale et sont fournis tels quels sans aucune garantie. Les fonctionnalités de la version d’évaluation technique ne sont pas soumises à l'accord de niveau de service des fonctionnalités officielles en disponibilité générale.", - "xpack.observability.slo.burnRate.technicalPreviewBadgeTitle": "Version d'évaluation technique", - "xpack.observability.slo.burnRate.timeRangeBtnLegend": "Sélectionner la plage temporelle", - "xpack.observability.slo.burnRate.title": "Taux d'avancement", - "xpack.observability.slo.deleteConfirmationModal.cancelButtonLabel": "Annuler", - "xpack.observability.slo.deleteConfirmationModal.deleteButtonLabel": "Supprimer", - "xpack.observability.slo.deleteConfirmationModal.descriptionText": "Vous ne pouvez pas récupérer ce SLO après l'avoir supprimé.", - "xpack.observability.slo.duration.daily": "Quotidien", - "xpack.observability.slo.duration.hourly": "Par heure", - "xpack.observability.slo.duration.minutely": "Par minute", - "xpack.observability.slo.duration.monthly": "Mensuel", - "xpack.observability.slo.duration.weekly": "Hebdomadaire", - "xpack.observability.slo.globalDiagnosis.errorNotification": "Vous ne disposez pas des autorisations nécessaires pour utiliser cette fonctionnalité.", - "xpack.observability.slo.indicators.apmAvailability": "Disponibilité APM", - "xpack.observability.slo.indicators.apmLatency": "Latence APM", - "xpack.observability.slo.indicators.customKql": "KQL personnalisé", - "xpack.observability.slo.indicators.customMetric": "Indicateur personnalisé", - "xpack.observability.slo.indicators.histogram": "Indicateur d'histogramme", - "xpack.observability.slo.item.actions.button": "Actions", - "xpack.observability.slo.item.actions.clone": "Cloner", - "xpack.observability.slo.item.actions.createRule": "Créer une règle d'alerte", - "xpack.observability.slo.item.actions.delete": "Supprimer", - "xpack.observability.slo.item.actions.details": "Détails", - "xpack.observability.slo.item.actions.edit": "Modifier", - "xpack.observability.slo.item.actions.manageRules": "Gérer les règles", - "xpack.observability.slo.list.emptyMessage": "Il n'existe aucun résultat pour vos critères.", - "xpack.observability.slo.list.emptyTitle": "Aucun résultat", - "xpack.observability.slo.list.errorMessage": "Une erreur s'est produite lors du chargement des SLO. Contactez votre administrateur pour obtenir de l'aide.", - "xpack.observability.slo.list.errorNotification": "Un problème est survenu lors de la récupération des SLO", - "xpack.observability.slo.list.errorTitle": "Impossible de charger les SLO", - "xpack.observability.slo.list.search": "Interroger vos SLO...", - "xpack.observability.slo.list.sortBy.errorBudgetConsumed": "Budget d'erreur consommé", - "xpack.observability.slo.list.sortBy.errorBudgetRemaining": "Budget d'erreur restant", - "xpack.observability.slo.list.sortBy.sliValue": "Valeur SLI", - "xpack.observability.slo.list.sortBy.sloStatus": "Statut SLO", - "xpack.observability.slo.rules.actionGroupSelectorLabel": "Groupe d’action", - "xpack.observability.slo.rules.addWindowAriaLabel": "Ajouter une fenêtre", - "xpack.observability.slo.rules.addWIndowLabel": "Ajouter une fenêtre", - "xpack.observability.slo.rules.burnRate.defaultActionMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\} est actif selon les conditions suivantes :\n\n- SLO : \\{\\{context.sloName\\}\\}'\n- Le taux d'avancement lors des derniers/dernières \\{\\{context.longWindow.duration\\}\\} est de \\{\\{context.longWindow.burnRate\\}\\}\n- Le taux d'avancement lors des derniers/dernières \\{\\{context.shortWindow.duration\\}\\} est de \\{\\{context.shortWindow.burnRate\\}\\}\n- Seuil : \\{\\{context.burnRateThreshold\\}\\}\n\n[Voir les détails de l’alerte](\\{\\{context.alertDetailsUrl\\}\\})\n", - "xpack.observability.slo.rules.burnRate.defaultRecoveryMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\} a récupéré.\n\n- SLO : \\{\\{context.sloName\\}\\}'\n- Le taux d'avancement lors des derniers/dernières \\{\\{context.longWindow.duration\\}\\} est de \\{\\{context.longWindow.burnRate\\}\\}\n- Le taux d'avancement lors des derniers/dernières \\{\\{context.shortWindow.duration\\}\\} est de \\{\\{context.shortWindow.burnRate\\}\\}\n- Seuil : \\{\\{context.burnRateThreshold\\}\\}\n\n[Voir les détails de l’alerte](\\{\\{context.alertDetailsUrl\\}\\})\n", - "xpack.observability.slo.rules.burnRate.description": "Alerte lorsque votre taux d'avancement SLO est trop élevé sur une période définie.", - "xpack.observability.slo.rules.burnRate.errors.burnRateThresholdRequired": "Le seuil de taux d'avancement est requis.", - "xpack.observability.slo.rules.burnRate.errors.sloRequired": "Le SLO est requis.", - "xpack.observability.slo.rules.burnRate.errors.windowDurationRequired": "La période historique est requise.", - "xpack.observability.slo.rules.burnRate.name": "Taux d'avancement SLO", - "xpack.observability.slo.rules.burnRate.rowLabel": "Seuil du taux d'avancement", - "xpack.observability.slo.rules.burnRate.tooltip": "Le taux d'avancement correspond à la vitesse à laquelle le service consomme le budget d'erreur au cours de la période historique.", - "xpack.observability.slo.rules.deleteWindowLabel": "Effacer la fenêtre", - "xpack.observability.slo.rules.longWindow.errorText": "La période historique doit être comprise entre 1 et 72 heures.", - "xpack.observability.slo.rules.longWindow.rowLabel": "Historique (heures)", - "xpack.observability.slo.rules.longWindow.valueLabel": "Période historique en heures", - "xpack.observability.slo.rules.sloSelector.ariaLabel": "SLO", - "xpack.observability.slo.rules.sloSelector.placeholder": "Sélectionner un SLO", - "xpack.observability.slo.rules.sloSelector.rowLabel": "SLO", - "xpack.observability.slo.slo.activeAlertsBadge.ariaLabel": "badge alertes actives", - "xpack.observability.slo.slo.item.actions.clone": "Cloner", - "xpack.observability.slo.slo.item.actions.delete": "Supprimer", - "xpack.observability.slo.slo.rulesBadge.popover": "Il n'y a pas encore de règles configurées pour ce SLO. Vous ne recevrez pas d'alertes lorsque le SLO est dépassé.", - "xpack.observability.slo.slo.stats.budgetRemaining": "Budget restant", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.chartTitle": "Budget d'erreur restant", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.remaining": "Restant", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.title": "Utilisation du budget d'erreur", - "xpack.observability.slo.sloDetails.headerControl.actions": "Actions", - "xpack.observability.slo.sloDetails.headerControl.createBurnRateRule": "Créer une règle d'alerte", - "xpack.observability.slo.sloDetails.headerControl.edit": "Modifier", - "xpack.observability.slo.sloDetails.headerControl.manageRules": "Gérer les règles", - "xpack.observability.slo.sloDetails.headerTitle.createdMessage": "Créé le", - "xpack.observability.slo.sloDetails.headerTitle.lastUpdatedMessage": "Dernière mise à jour le", - "xpack.observability.slo.sloDetails.overview.apmSource": "Source APM", - "xpack.observability.slo.sloDetails.overview.budgetingMethodTitle": "Méthode de budgétisation", - "xpack.observability.slo.sloDetails.overview.descriptionTitle": "Description", - "xpack.observability.slo.sloDetails.overview.indicatorTypeTitle": "Type d’indicateur", - "xpack.observability.slo.sloDetails.overview.observedValueTitle": "Valeur observée", - "xpack.observability.slo.sloDetails.overview.tagsTitle": "Balises", - "xpack.observability.slo.sloDetails.overview.timeWindowTitle": "Fenêtre temporelle", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.chartTitle": "Valeur SLI", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.current": "Valeur observée", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.objective": "Objectif", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.title": "SLI historique", - "xpack.observability.slo.sloDetails.tab.alertsLabel": "Alertes", - "xpack.observability.slo.sloDetails.tab.overviewLabel": "Aperçu", - "xpack.observability.slo.sloEdit.apm.filter.tooltip": "Cette requête KQL est utilisée pour filtrer les indicateurs APM sur certains critères pertinents pour ce SLO.", - "xpack.observability.slo.sloEdit.apm.serviceName.tooltip": "Il s'agit du service APM monitoré par ce SLO.", - "xpack.observability.slo.sloEdit.apmAvailability.serviceEnvironment": "Environnement de service", - "xpack.observability.slo.sloEdit.apmAvailability.serviceEnvironment.placeholder": "Sélectionner l'environnement", - "xpack.observability.slo.sloEdit.apmAvailability.serviceName": "Nom de service", - "xpack.observability.slo.sloEdit.apmAvailability.serviceName.placeholder": "Sélectionner le service APM", - "xpack.observability.slo.sloEdit.apmAvailability.transactionName": "Nom de la transaction", - "xpack.observability.slo.sloEdit.apmAvailability.transactionName.placeholder": "Sélectionner le nom de la transaction", - "xpack.observability.slo.sloEdit.apmAvailability.transactionType": "Type de transaction", - "xpack.observability.slo.sloEdit.apmAvailability.transactionType.placeholder": "Sélectionner le type de la transaction", - "xpack.observability.slo.sloEdit.apmLatency.filter": "Filtre de requête", - "xpack.observability.slo.sloEdit.apmLatency.filter.placeholder": "Filtre personnalisé à appliquer à l'index", - "xpack.observability.slo.sloEdit.apmLatency.serviceEnvironment": "Environnement de service", - "xpack.observability.slo.sloEdit.apmLatency.serviceEnvironment.placeholder": "Sélectionner l'environnement", - "xpack.observability.slo.sloEdit.apmLatency.serviceName": "Nom de service", - "xpack.observability.slo.sloEdit.apmLatency.serviceName.placeholder": "Sélectionner le service APM", - "xpack.observability.slo.sloEdit.apmLatency.threshold.placeholder": "Seuil (ms)", - "xpack.observability.slo.sloEdit.apmLatency.threshold.tooltip": "Configurez le seuil en millisecondes définissant les \"bonnes\" requêtes ou les requêtes \"réussies\" pour le SLO.", - "xpack.observability.slo.sloEdit.apmLatency.transactionName": "Nom de la transaction", - "xpack.observability.slo.sloEdit.apmLatency.transactionName.placeholder": "Sélectionner le nom de la transaction", - "xpack.observability.slo.sloEdit.apmLatency.transactionType": "Type de transaction", - "xpack.observability.slo.sloEdit.apmLatency.transactionType.placeholder": "Sélectionner le type de la transaction", - "xpack.observability.slo.sloEdit.budgetingMethod.label": "Méthode de budgétisation", - "xpack.observability.slo.sloEdit.budgetingMethod.tooltip": "Le SLO basé sur les occurrences utilise le rapport entre les bons événements et le nombre total d'événements au cours de la fenêtre temporelle. Le SLO basé sur les intervalles de temps utilise le rapport entre les bons intervalles de temps et le nombre total d'intervalles de temps au cours de la fenêtre temporelle.", - "xpack.observability.slo.sloEdit.calendarTimeWindow.monthly": "Mensuel", - "xpack.observability.slo.sloEdit.calendarTimeWindow.weekly": "Hebdomadaire", - "xpack.observability.slo.sloEdit.cancelButton": "Annuler", - "xpack.observability.slo.sloEdit.createSloButton": "Créer un SLO", - "xpack.observability.slo.sloEdit.customKql.indexSelection.label": "Index", - "xpack.observability.slo.sloEdit.dataPreviewChart.errorMessage": "Les paramètres d'indicateur actuels ne sont pas valides", - "xpack.observability.slo.sloEdit.dataPreviewChart.explanationMessage": "Remplir les champs d'indicateur pour visualiser les indicateurs actuels", - "xpack.observability.slo.sloEdit.dataPreviewChart.panelLabel": "Aperçu du SLI", - "xpack.observability.slo.sloEdit.dataPreviewChart.xTitle": "Dernière heure", - "xpack.observability.slo.sloEdit.dataPreviewChart.yTitle": "SLI", - "xpack.observability.slo.sloEdit.definition.sliType": "Choisir le type de SLI", - "xpack.observability.slo.sloEdit.definition.title": "Définir un SLI", - "xpack.observability.slo.sloEdit.description.sloDescription": "Description", - "xpack.observability.slo.sloEdit.description.sloDescriptionPlaceholder": "Brève description du SLO", - "xpack.observability.slo.sloEdit.description.sloName": "Nom SLO", - "xpack.observability.slo.sloEdit.description.sloNamePlaceholder": "Nom du SLO", - "xpack.observability.slo.sloEdit.description.title": "Décrire le SLO", - "xpack.observability.slo.sloEdit.editSloButton": "Mettre à jour le SLO", - "xpack.observability.slo.sloEdit.fieldSelector.all": "Tous", - "xpack.observability.slo.sloEdit.groupBy.label": "Partition conditionnée", - "xpack.observability.slo.sloEdit.groupBy.placeholder": "Sélectionner un champ facultatif selon lequel effectuer la partition", - "xpack.observability.slo.sloEdit.groupBy.tooltip": "Créer des SLO individuels pour chaque valeur du champ sélectionné.", - "xpack.observability.slo.sloEdit.objectives.title": "Définir des objectifs", - "xpack.observability.slo.sloEdit.sliType.customKql.customFilter": "Filtre personnalisé à appliquer à l'index", - "xpack.observability.slo.sloEdit.sliType.customKql.customFilter.tooltip": "Cette requête KQL peut être utilisée pour filtrer les documents avec certains critères pertinents.", - "xpack.observability.slo.sloEdit.sliType.customKql.goodQuery": "Bonne question", - "xpack.observability.slo.sloEdit.sliType.customKql.goodQuery.tooltip": "Cette requête KQL doit renvoyer un sous-ensemble d'événements considérés comme \"bons\" ou \"réussis\" aux fins du calcul du SLO. La requête doit filtrer les événements en fonction de certains critères pertinents, tels que les codes de statut, les messages d'erreur ou d'autres champs pertinents.", - "xpack.observability.slo.sloEdit.sliType.customKql.goodQueryPlaceholder": "Définir les bons événements", - "xpack.observability.slo.sloEdit.sliType.customKql.queryFilter": "Filtre de requête", - "xpack.observability.slo.sloEdit.sliType.customKql.totalQuery": "Total de la requête", - "xpack.observability.slo.sloEdit.sliType.customKql.totalQuery.tooltip": "Cette requête KQL doit renvoyer tous les événements pertinents pour le calcul du SLO, y compris les bons et les mauvais événements.", - "xpack.observability.slo.sloEdit.sliType.customKql.totalQueryPlaceholder": "Définir le total d'événements", - "xpack.observability.slo.sloEdit.sliType.customMetric.addMetricAriaLabel": "Ajouter un indicateur", - "xpack.observability.slo.sloEdit.sliType.customMetric.addMetricLabel": "Ajouter un indicateur", - "xpack.observability.slo.sloEdit.sliType.customMetric.customFilter": "Filtre personnalisé à appliquer à l'index", - "xpack.observability.slo.sloEdit.sliType.customMetric.customFilter.tooltip": "Cette requête KQL peut être utilisée pour filtrer les documents avec certains critères pertinents.", - "xpack.observability.slo.sloEdit.sliType.customMetric.deleteLabel": "Supprimer un indicateur", - "xpack.observability.slo.sloEdit.sliType.customMetric.equation.invalidCharacters": "Le champ d'équation prend en charge uniquement les caractères suivants : A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =", - "xpack.observability.slo.sloEdit.sliType.customMetric.equationHelpText": "Accepte les équations mathématiques de base, les caractères valides sont : A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =", - "xpack.observability.slo.sloEdit.sliType.customMetric.equationLabel": "Équation", - "xpack.observability.slo.sloEdit.sliType.customMetric.filterLabel": "Filtre", - "xpack.observability.slo.sloEdit.sliType.customMetric.goodTitle": "Bons événements", - "xpack.observability.slo.sloEdit.sliType.customMetric.metricField.placeholder": "Sélectionner un champ d’indicateur", - "xpack.observability.slo.sloEdit.sliType.customMetric.metricLabel": "Indicateur", - "xpack.observability.slo.sloEdit.sliType.customMetric.queryFilter": "Filtre de requête", - "xpack.observability.slo.sloEdit.sliType.customMetric.totalEquation.tooltip": "Ceci est compatible avec des calculs de base (A + B / C) et la logique booléenne (A < B ? A : B).", - "xpack.observability.slo.sloEdit.sliType.customMetric.totalMetric.tooltip": "Les données de ce champ seront agrégées avec l’agréation de \"somme\".", - "xpack.observability.slo.sloEdit.sliType.customMetric.totalTitle": "Total des événements", - "xpack.observability.slo.sloEdit.sliType.histogram.aggregation.placeholder": "Choisir une agrégation", - "xpack.observability.slo.sloEdit.sliType.histogram.aggregationLabel": "Agrégation", - "xpack.observability.slo.sloEdit.sliType.histogram.aggregationTooltip": "L'agrégation \"value count\" (nombre de valeurs) renvoie le nombre total pour le champ d'histogramme. \"Range\" (plage) renvoie le nombre tiré du champ d'histogramme compris dans la plage définie ci-dessous.", - "xpack.observability.slo.sloEdit.sliType.histogram.customFilter": "Filtre personnalisé à appliquer à l'index", - "xpack.observability.slo.sloEdit.sliType.histogram.customFilter.tooltip": "Cette requête KQL peut être utilisée pour filtrer les documents avec certains critères pertinents.", - "xpack.observability.slo.sloEdit.sliType.histogram.fromLabel": "De", - "xpack.observability.slo.sloEdit.sliType.histogram.fromTooltip": "La valeur \"from\" (de) est inclusive.", - "xpack.observability.slo.sloEdit.sliType.histogram.goodTitle": "Bons événements", - "xpack.observability.slo.sloEdit.sliType.histogram.kqlFilterLabel": "Filtre KQL", - "xpack.observability.slo.sloEdit.sliType.histogram.metricField.placeholder": "Sélectionner un champ d'histogramme", - "xpack.observability.slo.sloEdit.sliType.histogram.metricLabel": "Champ", - "xpack.observability.slo.sloEdit.sliType.histogram.query.tooltip": "Cette requête KQL doit renvoyer un sous-ensemble d'événements pour cet indicateur.", - "xpack.observability.slo.sloEdit.sliType.histogram.queryFilter": "Filtre de requête", - "xpack.observability.slo.sloEdit.sliType.histogram.rangeLabel": "Plage", - "xpack.observability.slo.sloEdit.sliType.histogram.sourceTitle": "Source", - "xpack.observability.slo.sloEdit.sliType.histogram.toLabel": "À", - "xpack.observability.slo.sloEdit.sliType.histogram.totalTitle": "Total des événements", - "xpack.observability.slo.sloEdit.sliType.histogram.toTooltip": "La valeur \"to\" (à) n'est PAS inclusive.", - "xpack.observability.slo.sloEdit.sliType.histogram.valueCountLabel": "Compte de valeurs", - "xpack.observability.slo.sloEdit.tags.label": "Balises", - "xpack.observability.slo.sloEdit.tags.placeholder": "Ajouter des balises", - "xpack.observability.slo.sloEdit.targetSlo.label": "Cible/SLO (%)", - "xpack.observability.slo.sloEdit.targetSlo.tooltip": "L'objectif cible en pourcentage pour le SLO.", - "xpack.observability.slo.sloEdit.timeSliceTarget.label": "Cible d'intervalle de temps (%)", - "xpack.observability.slo.sloEdit.timeSliceTarget.tooltip": "La cible d'intervalle de temps individuel utilisée pour déterminer si l'intervalle est bon ou mauvais.", - "xpack.observability.slo.sloEdit.timesliceWindow.label": "Fenêtre d'intervalle de temps (en minutes)", - "xpack.observability.slo.sloEdit.timesliceWindow.tooltip": "La taille de la fenêtre d'intervalle de temps utilisée pour évaluer les données.", - "xpack.observability.slo.sloEdit.timestampField.label": "Champ d'horodatage", - "xpack.observability.slo.sloEdit.timestampField.placeholder": "Sélectionner un champ d'horodatage", - "xpack.observability.slo.sloEdit.timeWindow.calendarAligned": "Alignée sur le calendrier", - "xpack.observability.slo.sloEdit.timeWindow.rolling": "Glissante", - "xpack.observability.slo.sloEdit.timeWindowDuration.label": "Durée", - "xpack.observability.slo.sloEdit.timeWindowDuration.tooltip": "La durée de la fenêtre temporelle utilisée pour calculer le SLO.", - "xpack.observability.slo.sloEdit.timeWindowType.label": "Fenêtre temporelle", - "xpack.observability.slo.sloEdit.timeWindowType.tooltip": "Choisissez entre une fenêtre glissante ou alignée sur le calendrier.", - "xpack.observability.slo.sloList.welcomePrompt.buttonLabel": "Créer un SLO", - "xpack.observability.slo.sloList.welcomePrompt.getStartedMessage": "Pour commencer, créez votre premier SLO.", - "xpack.observability.slo.sloList.welcomePrompt.learnMore": "Envie d'en savoir plus ?", - "xpack.observability.slo.sloList.welcomePrompt.learnMoreLink": "Lisez les documents", - "xpack.observability.slo.sloList.welcomePrompt.messageParagraph1": "Mesurez les indicateurs clés importants pour l'entreprise, tels que les indicateurs et les objectifs de niveau de service (SLI/SLO), afin de respecter les SLA établis.", - "xpack.observability.slo.sloList.welcomePrompt.messageParagraph2": "Communiquez facilement sur la disponibilité et la fiabilité de vos services grâce à des informations en temps réel, et ce, pour la plus grande satisfaction des différents intervenants.", - "xpack.observability.slo.sloList.welcomePrompt.needLicenseMessage": "Vous avez besoin d'un abonnement Elastic Cloud ou d'une licence Platinum pour utiliser les SLO.", - "xpack.observability.slo.sloList.welcomePrompt.signupForCloud": "S'inscrire à Elastic Cloud", - "xpack.observability.slo.sloList.welcomePrompt.signupForLicense": "S'inscrire pour une licence", - "xpack.observability.slo.sloList.welcomePrompt.title": "Surveiller et respecter vos SLO", - "xpack.observability.slo.sloStatusBadge.degrading": "Dégradation", - "xpack.observability.slo.sloStatusBadge.forecasted": "Prévu", - "xpack.observability.slo.sloStatusBadge.healthy": "Intègre", - "xpack.observability.slo.sloStatusBadge.noData": "Aucune donnée", - "xpack.observability.slo.sloStatusBadge.noDataTooltip": "L'agrégation et la mise à disposition des données peut prendre un peu de temps.", - "xpack.observability.slo.sloStatusBadge.violated": "Violation", - "xpack.observability.sloCreatePageTitle": "Créer un nouveau SLO", - "xpack.observability.sloEditPageTitle": "Modifier le SLO", - "xpack.observability.sloEmbeddable.config.cancelButtonLabel": "Annuler", - "xpack.observability.sloEmbeddable.config.errors.sloRequired": "Le SLO est requis.", - "xpack.observability.sloEmbeddable.config.sloSelector.ariaLabel": "SLO", - "xpack.observability.sloEmbeddable.config.sloSelector.headerTitle": "Configuration du SLO", - "xpack.observability.sloEmbeddable.config.sloSelector.placeholder": "Sélectionner un SLO", - "xpack.observability.sloEmbeddable.description": "Obtenir un aperçu de l'intégrité de votre SLO", - "xpack.observability.sloEmbeddable.displayName": "Aperçu du SLO", - "xpack.observability.sloEmbeddable.displayTitle": "Aperçu du SLO", - "xpack.observability.sloEmbeddable.overview.sloNotFoundText": "Le SLO a été supprimé. Vous pouvez supprimer sans risque le widget du tableau de bord.", - "xpack.observability.slos.sloDetails.headerControl.exploreInApm": "Détails du service", - "xpack.observability.slosLinkTitle": "SLO", - "xpack.observability.slosPage.autoRefreshButtonLabel": "Actualisation automatique", - "xpack.observability.slosPage.stopRefreshingButtonLabel": "Arrêter l'actualisation", - "xpack.observability.slosPageTitle": "SLO", "xpack.observability.status.dataAvailable": "Des données sont disponibles.", "xpack.observability.status.dataAvailableTitle": "Données disponibles pour", "xpack.observability.status.learnMoreButton": "En savoir plus", @@ -28872,6 +28592,260 @@ "xpack.observability.ux.dashboard.webCoreVitals.help": "Découvrez", "xpack.observability.ux.dashboard.webCoreVitals.helpAriaLabel": "aide", "xpack.observability.ux.service.help": "Le service RUM comportant le plus de trafic est sélectionné", + "xpack.slo.alerting.burnRate.reason": "{actionGroupName} : Le taux d'avancement pour le (les) dernier(s) {longWindowDuration} est de {longWindowBurnRate} et pour le (les) dernier(s) {shortWindowDuration} est de {shortWindowBurnRate}. Alerter si supérieur à {burnRateThreshold} pour les deux fenêtres", + "xpack.slo.alerting.burnRate.reasonForInstanceId": "{actionGroupName} : Le taux d'avancement pour le (les) dernier(s) {longWindowDuration} est de {longWindowBurnRate} et pour le (les) dernier(s) {shortWindowDuration} est de {shortWindowBurnRate} pour {instanceId}. Alerter si supérieur à {burnRateThreshold} pour les deux fenêtres", + "xpack.slo.burnRate.breachedStatustSubtitle": "Au rythme actuel, le budget d'erreur sera épuisé en {hour} heures.", + "xpack.slo.burnRate.threshold": "Le seuil est {threshold}x", + "xpack.slo.create.errorNotification": "Un problème est survenu lors de la création de {name}", + "xpack.slo.deleteConfirmationModal.title": "Supprimer {name} ?", + "xpack.slo.duration.day": "{duration, plural, one {1 jour} many {# jours} other {# jours}}", + "xpack.slo.duration.hour": "{duration, plural, one {1 heure} many {# heures} other {# heures}}", + "xpack.slo.duration.minute": "{duration, plural, one {1 minute} many {# minutes} other {# minutes}}", + "xpack.slo.duration.month": "{duration, plural, one {1 mois} many {# mois} other {# mois}}", + "xpack.slo.duration.week": "{duration, plural, one {1 semaine} many {# semaines} other {# prochaines semaines}}", + "xpack.slo.indicatorTypeBadge.exploreInApm": "Afficher les détails de {service}", + "xpack.slo.rules.burnRate.errors.invalidThresholdValue": "Le seuil du taux d'avancement doit être compris entre 1 et {maxBurnRate}.", + "xpack.slo.rules.groupByMessage": "Le SLO que vous avez sélectionné a été créé avec une partition sur \"{groupByField}\". Cette règle surveille et génère une alerte pour chaque instance trouvée dans le champ de partition.", + "xpack.slo.rules.longWindowDuration.tooltip": "Période historique sur laquelle le taux d'avancement est calculé. Une période historique plus courte de {shortWindowDuration} minutes (1/12 de la période historique) sera utilisée pour une récupération plus rapide", + "xpack.slo.slo.activeAlertsBadge.label": "{count, plural, one {# alerte} many {# alertes} other {Alertes #}}", + "xpack.slo.slo.delete.errorNotification": "Impossible de supprimer {name}", + "xpack.slo.slo.delete.successNotification": "{name} supprimé", + "xpack.slo.slo.timeWindow.calendar": "{elapsed}/{total} jours", + "xpack.slo.sloDetails.errorBudgetChartPanel.duration": "{duration}", + "xpack.slo.sloDetails.overview.apmSource.environmentLabel": "environnement : {value}", + "xpack.slo.sloDetails.overview.apmSource.serviceLabel": "service : {value}", + "xpack.slo.sloDetails.overview.apmSource.transactionNameLabel": "nom de transaction : {value}", + "xpack.slo.sloDetails.overview.apmSource.transactionTypeLabel": "type de transaction : {value}", + "xpack.slo.sloDetails.overview.calendarAlignedTimeWindow": "calendrier {duration} aligné", + "xpack.slo.sloDetails.overview.observedValueSubtitle": "{value} (l'objectif est {objective})", + "xpack.slo.sloDetails.overview.rollingTimeWindow": "{duration} en cours", + "xpack.slo.sloDetails.overview.timeslicesBudgetingMethodDetails": "{duration} sections, {target} cible", + "xpack.slo.sloDetails.sliHistoryChartPanel.duration": "{duration}", + "xpack.slo.sloEdit.rollingTimeWindow.days": "{number} jours", + "xpack.slo.update.errorNotification": "Un problème est survenu lors de la mise à jour de {name}", + "xpack.slo.update.successNotification": "Mise à jour réussie de {name}", + "xpack.slo.alerting.alertDetailsUrlDescription": "Lien vers l’affichage de résolution des problèmes d’alerte pour voir plus de contextes et de détails. La chaîne sera vide si server.publicBaseUrl n'est pas configuré.", + "xpack.slo.alerting.burnRate.alertAction": "Critique", + "xpack.slo.alerting.burnRate.highPriorityAction": "Élevé", + "xpack.slo.alerting.burnRate.lowPriorityAction": "Bas", + "xpack.slo.alerting.burnRate.mediumPriorityAction": "Moyenne", + "xpack.slo.alerting.reasonDescription": "Une description concise de la raison du signalement", + "xpack.slo.alerting.sloIdDescription": "Identificateur unique du SLO.", + "xpack.slo.alerting.sloInstanceIdDescription": "ID d'instance du SLO.", + "xpack.slo.alerting.sloNameDescription": "Nom SLO.", + "xpack.slo.alerting.thresholdDescription": "Valeur de seuil du taux d'avancement.", + "xpack.slo.alerting.timestampDescription": "Horodatage du moment où l'alerte a été détectée.", + "xpack.slo.alerting.viewInAppUrlDescription": "L'URL de la page de détails du SLO pour effectuer une enquête plus approfondie.", + "xpack.slo.alerting.windowDescription": "Durée de fenêtre avec la valeur du taux d'avancement associée.", + "xpack.slo.budgetingMethod.occurrences": "Occurrences", + "xpack.slo.budgetingMethod.timeslices": "Intervalles de temps", + "xpack.slo.burnRate.breachedStatustTitle": "Valeur critique dépassée", + "xpack.slo.burnRate.noDataStatusSubtitle": "En attente de plus de données.", + "xpack.slo.burnRate.noDataStatusTitle": "Aucune valeur", + "xpack.slo.burnRate.okStatusSubtitle": "Aucun risque d'épuisement du budget d'erreurs.", + "xpack.slo.burnRate.okStatusTitle": "Valeur acceptable", + "xpack.slo.burnRate.technicalPreviewBadgeDescription": "Cette fonctionnalité est en préversion technique et est susceptible d’être changée, ou elle peut-être supprimée dans les versions futures. La conception et le code sont moins matures que les fonctionnalités officielles en disponibilité générale et sont fournis tels quels sans aucune garantie. Les fonctionnalités de la version d’évaluation technique ne sont pas soumises à l'accord de niveau de service des fonctionnalités officielles en disponibilité générale.", + "xpack.slo.burnRate.technicalPreviewBadgeTitle": "Version d'évaluation technique", + "xpack.slo.burnRate.timeRangeBtnLegend": "Sélectionner la plage temporelle", + "xpack.slo.burnRate.title": "Taux d'avancement", + "xpack.slo.deleteConfirmationModal.cancelButtonLabel": "Annuler", + "xpack.slo.deleteConfirmationModal.deleteButtonLabel": "Supprimer", + "xpack.slo.deleteConfirmationModal.descriptionText": "Vous ne pouvez pas récupérer ce SLO après l'avoir supprimé.", + "xpack.slo.duration.daily": "Quotidien", + "xpack.slo.duration.hourly": "Par heure", + "xpack.slo.duration.minutely": "Par minute", + "xpack.slo.duration.monthly": "Mensuel", + "xpack.slo.duration.weekly": "Hebdomadaire", + "xpack.slo.globalDiagnosis.errorNotification": "Vous ne disposez pas des autorisations nécessaires pour utiliser cette fonctionnalité.", + "xpack.slo.indicators.apmAvailability": "Disponibilité APM", + "xpack.slo.indicators.apmLatency": "Latence APM", + "xpack.slo.indicators.customKql": "KQL personnalisé", + "xpack.slo.indicators.customMetric": "Indicateur personnalisé", + "xpack.slo.indicators.histogram": "Indicateur d'histogramme", + "xpack.slo.item.actions.button": "Actions", + "xpack.slo.item.actions.clone": "Cloner", + "xpack.slo.item.actions.createRule": "Créer une règle d'alerte", + "xpack.slo.item.actions.delete": "Supprimer", + "xpack.slo.item.actions.details": "Détails", + "xpack.slo.item.actions.edit": "Modifier", + "xpack.slo.item.actions.manageRules": "Gérer les règles", + "xpack.slo.list.emptyMessage": "Il n'existe aucun résultat pour vos critères.", + "xpack.slo.list.emptyTitle": "Aucun résultat", + "xpack.slo.list.errorMessage": "Une erreur s'est produite lors du chargement des SLO. Contactez votre administrateur pour obtenir de l'aide.", + "xpack.slo.list.errorNotification": "Un problème est survenu lors de la récupération des SLO", + "xpack.slo.list.errorTitle": "Impossible de charger les SLO", + "xpack.slo.list.search": "Interroger vos SLO...", + "xpack.slo.list.sortBy.errorBudgetConsumed": "Budget d'erreur consommé", + "xpack.slo.list.sortBy.errorBudgetRemaining": "Budget d'erreur restant", + "xpack.slo.list.sortBy.sliValue": "Valeur SLI", + "xpack.slo.list.sortBy.sloStatus": "Statut SLO", + "xpack.slo.rules.actionGroupSelectorLabel": "Groupe d’action", + "xpack.slo.rules.addWindowAriaLabel": "Ajouter une fenêtre", + "xpack.slo.rules.burnRate.defaultActionMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\} est actif selon les conditions suivantes :\n\n- SLO : \\{\\{context.sloName\\}\\}'\n- Le taux d'avancement lors des derniers/dernières \\{\\{context.longWindow.duration\\}\\} est de \\{\\{context.longWindow.burnRate\\}\\}\n- Le taux d'avancement lors des derniers/dernières \\{\\{context.shortWindow.duration\\}\\} est de \\{\\{context.shortWindow.burnRate\\}\\}\n- Seuil : \\{\\{context.burnRateThreshold\\}\\}\n\n[Voir les détails de l’alerte](\\{\\{context.alertDetailsUrl\\}\\})\n", + "xpack.slo.rules.burnRate.defaultRecoveryMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\} a récupéré.\n\n- SLO : \\{\\{context.sloName\\}\\}'\n- Le taux d'avancement lors des derniers/dernières \\{\\{context.longWindow.duration\\}\\} est de \\{\\{context.longWindow.burnRate\\}\\}\n- Le taux d'avancement lors des derniers/dernières \\{\\{context.shortWindow.duration\\}\\} est de \\{\\{context.shortWindow.burnRate\\}\\}\n- Seuil : \\{\\{context.burnRateThreshold\\}\\}\n\n[Voir les détails de l’alerte](\\{\\{context.alertDetailsUrl\\}\\})\n", + "xpack.slo.rules.burnRate.description": "Alerte lorsque votre taux d'avancement SLO est trop élevé sur une période définie.", + "xpack.slo.rules.burnRate.errors.burnRateThresholdRequired": "Le seuil de taux d'avancement est requis.", + "xpack.slo.rules.burnRate.errors.sloRequired": "Le SLO est requis.", + "xpack.slo.rules.burnRate.errors.windowDurationRequired": "La période historique est requise.", + "xpack.slo.rules.burnRate.name": "Taux d'avancement SLO", + "xpack.slo.rules.burnRate.rowLabel": "Seuil du taux d'avancement", + "xpack.slo.rules.burnRate.tooltip": "Le taux d'avancement correspond à la vitesse à laquelle le service consomme le budget d'erreur au cours de la période historique.", + "xpack.slo.rules.deleteWindowLabel": "Effacer la fenêtre", + "xpack.slo.rules.longWindow.errorText": "La période historique doit être comprise entre 1 et 72 heures.", + "xpack.slo.rules.longWindow.rowLabel": "Historique (heures)", + "xpack.slo.rules.longWindow.valueLabel": "Période historique en heures", + "xpack.slo.rules.sloSelector.ariaLabel": "SLO", + "xpack.slo.rules.sloSelector.placeholder": "Sélectionner un SLO", + "xpack.slo.rules.sloSelector.rowLabel": "SLO", + "xpack.slo.slo.activeAlertsBadge.ariaLabel": "badge alertes actives", + "xpack.slo.slo.item.actions.clone": "Cloner", + "xpack.slo.slo.item.actions.delete": "Supprimer", + "xpack.slo.slo.rulesBadge.popover": "Il n'y a pas encore de règles configurées pour ce SLO. Vous ne recevrez pas d'alertes lorsque le SLO est dépassé.", + "xpack.slo.sloDetails.errorBudgetChartPanel.chartTitle": "Budget d'erreur restant", + "xpack.slo.sloDetails.errorBudgetChartPanel.remaining": "Restant", + "xpack.slo.sloDetails.errorBudgetChartPanel.title": "Utilisation du budget d'erreur", + "xpack.slo.sloDetails.headerControl.actions": "Actions", + "xpack.slo.sloDetails.headerControl.createBurnRateRule": "Créer une règle d'alerte", + "xpack.slo.sloDetails.headerControl.edit": "Modifier", + "xpack.slo.sloDetails.headerControl.manageRules": "Gérer les règles", + "xpack.slo.sloDetails.headerTitle.createdMessage": "Créé le", + "xpack.slo.sloDetails.headerTitle.lastUpdatedMessage": "Dernière mise à jour le", + "xpack.slo.sloDetails.overview.apmSource": "Source APM", + "xpack.slo.sloDetails.overview.budgetingMethodTitle": "Méthode de budgétisation", + "xpack.slo.sloDetails.overview.descriptionTitle": "Description", + "xpack.slo.sloDetails.overview.indicatorTypeTitle": "Type d’indicateur", + "xpack.slo.sloDetails.overview.observedValueTitle": "Valeur observée", + "xpack.slo.sloDetails.overview.tagsTitle": "Balises", + "xpack.slo.sloDetails.overview.timeWindowTitle": "Fenêtre temporelle", + "xpack.slo.sloDetails.sliHistoryChartPanel.chartTitle": "Valeur SLI", + "xpack.slo.sloDetails.sliHistoryChartPanel.current": "Valeur observée", + "xpack.slo.sloDetails.sliHistoryChartPanel.objective": "Objectif", + "xpack.slo.sloDetails.sliHistoryChartPanel.title": "SLI historique", + "xpack.slo.sloDetails.tab.alertsLabel": "Alertes", + "xpack.slo.sloDetails.tab.overviewLabel": "Aperçu", + "xpack.slo.sloEdit.apm.filter.tooltip": "Cette requête KQL est utilisée pour filtrer les indicateurs APM sur certains critères pertinents pour ce SLO.", + "xpack.slo.sloEdit.apm.serviceName.tooltip": "Il s'agit du service APM monitoré par ce SLO.", + "xpack.slo.sloEdit.apmAvailability.serviceEnvironment": "Environnement de service", + "xpack.slo.sloEdit.apmAvailability.serviceEnvironment.placeholder": "Sélectionner l'environnement", + "xpack.slo.sloEdit.apmAvailability.serviceName": "Nom de service", + "xpack.slo.sloEdit.apmAvailability.serviceName.placeholder": "Sélectionner le service APM", + "xpack.slo.sloEdit.apmAvailability.transactionName": "Nom de la transaction", + "xpack.slo.sloEdit.apmAvailability.transactionName.placeholder": "Sélectionner le nom de la transaction", + "xpack.slo.sloEdit.apmAvailability.transactionType": "Type de transaction", + "xpack.slo.sloEdit.apmAvailability.transactionType.placeholder": "Sélectionner le type de la transaction", + "xpack.slo.sloEdit.apmLatency.filter": "Filtre de requête", + "xpack.slo.sloEdit.apmLatency.filter.placeholder": "Filtre personnalisé à appliquer à l'index", + "xpack.slo.sloEdit.apmLatency.serviceEnvironment": "Environnement de service", + "xpack.slo.sloEdit.apmLatency.serviceEnvironment.placeholder": "Sélectionner l'environnement", + "xpack.slo.sloEdit.apmLatency.serviceName": "Nom de service", + "xpack.slo.sloEdit.apmLatency.serviceName.placeholder": "Sélectionner le service APM", + "xpack.slo.sloEdit.apmLatency.threshold.placeholder": "Seuil (ms)", + "xpack.slo.sloEdit.apmLatency.threshold.tooltip": "Configurez le seuil en millisecondes définissant les \"bonnes\" requêtes ou les requêtes \"réussies\" pour le SLO.", + "xpack.slo.sloEdit.apmLatency.transactionName": "Nom de la transaction", + "xpack.slo.sloEdit.apmLatency.transactionName.placeholder": "Sélectionner le nom de la transaction", + "xpack.slo.sloEdit.apmLatency.transactionType": "Type de transaction", + "xpack.slo.sloEdit.apmLatency.transactionType.placeholder": "Sélectionner le type de la transaction", + "xpack.slo.sloEdit.budgetingMethod.label": "Méthode de budgétisation", + "xpack.slo.sloEdit.budgetingMethod.tooltip": "Le SLO basé sur les occurrences utilise le rapport entre les bons événements et le nombre total d'événements au cours de la fenêtre temporelle. Le SLO basé sur les intervalles de temps utilise le rapport entre les bons intervalles de temps et le nombre total d'intervalles de temps au cours de la fenêtre temporelle.", + "xpack.slo.sloEdit.calendarTimeWindow.monthly": "Mensuel", + "xpack.slo.sloEdit.calendarTimeWindow.weekly": "Hebdomadaire", + "xpack.slo.sloEdit.cancelButton": "Annuler", + "xpack.slo.sloEdit.createSloButton": "Créer un SLO", + "xpack.slo.sloEdit.customKql.indexSelection.label": "Index", + "xpack.slo.sloEdit.dataPreviewChart.errorMessage": "Les paramètres d'indicateur actuels ne sont pas valides", + "xpack.slo.sloEdit.dataPreviewChart.explanationMessage": "Remplir les champs d'indicateur pour visualiser les indicateurs actuels", + "xpack.slo.sloEdit.dataPreviewChart.panelLabel": "Aperçu du SLI", + "xpack.slo.sloEdit.dataPreviewChart.xTitle": "Dernière heure", + "xpack.slo.sloEdit.dataPreviewChart.yTitle": "SLI", + "xpack.slo.sloEdit.definition.sliType": "Choisir le type de SLI", + "xpack.slo.sloEdit.definition.title": "Définir un SLI", + "xpack.slo.sloEdit.description.sloDescription": "Description", + "xpack.slo.sloEdit.description.sloDescriptionPlaceholder": "Brève description du SLO", + "xpack.slo.sloEdit.description.sloName": "Nom SLO", + "xpack.slo.sloEdit.description.sloNamePlaceholder": "Nom du SLO", + "xpack.slo.sloEdit.description.title": "Décrire le SLO", + "xpack.slo.sloEdit.editSloButton": "Mettre à jour le SLO", + "xpack.slo.sloEdit.fieldSelector.all": "Tous", + "xpack.slo.sloEdit.groupBy.label": "Partition conditionnée", + "xpack.slo.sloEdit.groupBy.placeholder": "Sélectionner un champ facultatif selon lequel effectuer la partition", + "xpack.slo.sloEdit.groupBy.tooltip": "Créer des SLO individuels pour chaque valeur du champ sélectionné.", + "xpack.slo.sloEdit.objectives.title": "Définir des objectifs", + "xpack.slo.sloEdit.sliType.customKql.customFilter": "Filtre personnalisé à appliquer à l'index", + "xpack.slo.sloEdit.sliType.customKql.customFilter.tooltip": "Cette requête KQL peut être utilisée pour filtrer les documents avec certains critères pertinents.", + "xpack.slo.sloEdit.sliType.customKql.goodQuery": "Bonne question", + "xpack.slo.sloEdit.sliType.customKql.goodQuery.tooltip": "Cette requête KQL doit renvoyer un sous-ensemble d'événements considérés comme \"bons\" ou \"réussis\" aux fins du calcul du SLO. La requête doit filtrer les événements en fonction de certains critères pertinents, tels que les codes de statut, les messages d'erreur ou d'autres champs pertinents.", + "xpack.slo.sloEdit.sliType.customKql.goodQueryPlaceholder": "Définir les bons événements", + "xpack.slo.sloEdit.sliType.customKql.queryFilter": "Filtre de requête", + "xpack.slo.sloEdit.sliType.customKql.totalQuery": "Total de la requête", + "xpack.slo.sloEdit.sliType.customKql.totalQuery.tooltip": "Cette requête KQL doit renvoyer tous les événements pertinents pour le calcul du SLO, y compris les bons et les mauvais événements.", + "xpack.slo.sloEdit.sliType.customKql.totalQueryPlaceholder": "Définir le total d'événements", + "xpack.slo.sloEdit.sliType.customMetric.addMetricAriaLabel": "Ajouter un indicateur", + "xpack.slo.sloEdit.sliType.customMetric.addMetricLabel": "Ajouter un indicateur", + "xpack.slo.sloEdit.sliType.customMetric.customFilter": "Filtre personnalisé à appliquer à l'index", + "xpack.slo.sloEdit.sliType.customMetric.customFilter.tooltip": "Cette requête KQL peut être utilisée pour filtrer les documents avec certains critères pertinents.", + "xpack.slo.sloEdit.sliType.customMetric.deleteLabel": "Supprimer un indicateur", + "xpack.slo.sloEdit.sliType.customMetric.equation.invalidCharacters": "Le champ d'équation prend en charge uniquement les caractères suivants : A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =", + "xpack.slo.sloEdit.sliType.customMetric.equationHelpText": "Accepte les équations mathématiques de base, les caractères valides sont : A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =", + "xpack.slo.sloEdit.sliType.customMetric.equationLabel": "Équation", + "xpack.slo.sloEdit.sliType.customMetric.filterLabel": "Filtre", + "xpack.slo.sloEdit.sliType.customMetric.goodTitle": "Bons événements", + "xpack.slo.sloEdit.sliType.customMetric.metricField.placeholder": "Sélectionner un champ d’indicateur", + "xpack.slo.sloEdit.sliType.customMetric.metricLabel": "Indicateur", + "xpack.slo.sloEdit.sliType.customMetric.queryFilter": "Filtre de requête", + "xpack.slo.sloEdit.sliType.customMetric.totalEquation.tooltip": "Ceci est compatible avec des calculs de base (A + B / C) et la logique booléenne (A < B ? A : B).", + "xpack.slo.sloEdit.sliType.customMetric.totalMetric.tooltip": "Les données de ce champ seront agrégées avec l’agréation de \"somme\".", + "xpack.slo.sloEdit.sliType.customMetric.totalTitle": "Total des événements", + "xpack.slo.sloEdit.sliType.histogram.aggregation.placeholder": "Choisir une agrégation", + "xpack.slo.sloEdit.sliType.histogram.aggregationLabel": "Agrégation", + "xpack.slo.sloEdit.sliType.histogram.aggregationTooltip": "L'agrégation \"value count\" (nombre de valeurs) renvoie le nombre total pour le champ d'histogramme. \"Range\" (plage) renvoie le nombre tiré du champ d'histogramme compris dans la plage définie ci-dessous.", + "xpack.slo.sloEdit.sliType.histogram.customFilter": "Filtre personnalisé à appliquer à l'index", + "xpack.slo.sloEdit.sliType.histogram.customFilter.tooltip": "Cette requête KQL peut être utilisée pour filtrer les documents avec certains critères pertinents.", + "xpack.slo.sloEdit.sliType.histogram.fromLabel": "De", + "xpack.slo.sloEdit.sliType.histogram.fromTooltip": "La valeur \"from\" (de) est inclusive.", + "xpack.slo.sloEdit.sliType.histogram.goodTitle": "Bons événements", + "xpack.slo.sloEdit.sliType.histogram.kqlFilterLabel": "Filtre KQL", + "xpack.slo.sloEdit.sliType.histogram.metricField.placeholder": "Sélectionner un champ d'histogramme", + "xpack.slo.sloEdit.sliType.histogram.metricLabel": "Champ", + "xpack.slo.sloEdit.sliType.histogram.query.tooltip": "Cette requête KQL doit renvoyer un sous-ensemble d'événements pour cet indicateur.", + "xpack.slo.sloEdit.sliType.histogram.queryFilter": "Filtre de requête", + "xpack.slo.sloEdit.sliType.histogram.rangeLabel": "Plage", + "xpack.slo.sloEdit.sliType.histogram.sourceTitle": "Source", + "xpack.slo.sloEdit.sliType.histogram.toLabel": "À", + "xpack.slo.sloEdit.sliType.histogram.totalTitle": "Total des événements", + "xpack.slo.sloEdit.sliType.histogram.toTooltip": "La valeur \"to\" (à) n'est PAS inclusive.", + "xpack.slo.sloEdit.sliType.histogram.valueCountLabel": "Compte de valeurs", + "xpack.slo.sloEdit.tags.label": "Balises", + "xpack.slo.sloEdit.tags.placeholder": "Ajouter des balises", + "xpack.slo.sloEdit.targetSlo.label": "Cible/SLO (%)", + "xpack.slo.sloEdit.targetSlo.tooltip": "L'objectif cible en pourcentage pour le SLO.", + "xpack.slo.sloEdit.timeSliceTarget.label": "Cible d'intervalle de temps (%)", + "xpack.slo.sloEdit.timeSliceTarget.tooltip": "La cible d'intervalle de temps individuel utilisée pour déterminer si l'intervalle est bon ou mauvais.", + "xpack.slo.sloEdit.timesliceWindow.label": "Fenêtre d'intervalle de temps (en minutes)", + "xpack.slo.sloEdit.timesliceWindow.tooltip": "La taille de la fenêtre d'intervalle de temps utilisée pour évaluer les données.", + "xpack.slo.sloEdit.timestampField.label": "Champ d'horodatage", + "xpack.slo.sloEdit.timestampField.placeholder": "Sélectionner un champ d'horodatage", + "xpack.slo.sloEdit.timeWindow.calendarAligned": "Alignée sur le calendrier", + "xpack.slo.sloEdit.timeWindow.rolling": "Glissante", + "xpack.slo.sloEdit.timeWindowDuration.label": "Durée", + "xpack.slo.sloEdit.timeWindowDuration.tooltip": "La durée de la fenêtre temporelle utilisée pour calculer le SLO.", + "xpack.slo.sloEdit.timeWindowType.label": "Fenêtre temporelle", + "xpack.slo.sloEdit.timeWindowType.tooltip": "Choisissez entre une fenêtre glissante ou alignée sur le calendrier.", + "xpack.slo.sloList.welcomePrompt.buttonLabel": "Créer un SLO", + "xpack.slo.sloList.welcomePrompt.getStartedMessage": "Pour commencer, créez votre premier SLO.", + "xpack.slo.sloList.welcomePrompt.learnMore": "Envie d'en savoir plus ?", + "xpack.slo.sloList.welcomePrompt.learnMoreLink": "Lisez les documents", + "xpack.slo.sloList.welcomePrompt.messageParagraph1": "Mesurez les indicateurs clés importants pour l'entreprise, tels que les indicateurs et les objectifs de niveau de service (SLI/SLO), afin de respecter les SLA établis.", + "xpack.slo.sloList.welcomePrompt.messageParagraph2": "Communiquez facilement sur la disponibilité et la fiabilité de vos services grâce à des informations en temps réel, et ce, pour la plus grande satisfaction des différents intervenants.", + "xpack.slo.sloList.welcomePrompt.needLicenseMessage": "Vous avez besoin d'un abonnement Elastic Cloud ou d'une licence Platinum pour utiliser les SLO.", + "xpack.slo.sloList.welcomePrompt.signupForCloud": "S'inscrire à Elastic Cloud", + "xpack.slo.sloList.welcomePrompt.signupForLicense": "S'inscrire pour une licence", + "xpack.slo.sloList.welcomePrompt.title": "Surveiller et respecter vos SLO", + "xpack.slo.sloStatusBadge.degrading": "Dégradation", + "xpack.slo.sloStatusBadge.forecasted": "Prévu", + "xpack.slo.sloStatusBadge.healthy": "Intègre", + "xpack.slo.sloStatusBadge.noData": "Aucune donnée", + "xpack.slo.sloStatusBadge.noDataTooltip": "L'agrégation et la mise à disposition des données peut prendre un peu de temps.", + "xpack.slo.sloStatusBadge.violated": "Violation", "xpack.observabilityAiAssistant.couldNotFindConversationContent": "Impossible de trouver une conversation avec l'ID {conversationId}. Assurez-vous que la conversation existe et que vous y avez accès.", "xpack.observabilityAiAssistant.executedFunctionFailureEvent": "n'a pas réussi à exécuter la fonction {functionName}", "xpack.observabilityAiAssistant.poweredByModel": "Alimenté par {model}", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index d97f16d80c147..b7f1cf83f7d64 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -28217,39 +28217,6 @@ "xpack.observability.profilingCo2PerKWHUiSettingDescription": "炭素強度は、データセンターの電気がどれだけクリーンであるかを測定します。 \n 具体的には、特定の地域で消費される電力1キロワット時(kWh)あたりに排出されるCO2の平均量を測定します。\n クラウドカーボンフットプリント{datasheetLink}を使用して、地域に応じてこの値を更新します。デフォルトは米国東部(バージニア州北部)です。", "xpack.observability.rules.deleteConfirmationModal.deleteButtonLabel": "{title}削除", "xpack.observability.rules.deleteConfirmationModal.descriptionText": "削除された{title}は復元できません。", - "xpack.observability.slo.alerting.burnRate.reason": "{actionGroupName}:過去{longWindowDuration}のバーンレートは{longWindowBurnRate}で、過去{shortWindowDuration}のバーンレートは{shortWindowBurnRate}です。両期間とも{burnRateThreshold}を超えたらアラート", - "xpack.observability.slo.alerting.burnRate.reasonForInstanceId": "{actionGroupName}:過去{longWindowDuration}のバーンレートは{longWindowBurnRate}、{instanceId}の過去{shortWindowDuration}のバーンレートは{shortWindowBurnRate}です。両期間とも{burnRateThreshold}を超えたらアラート", - "xpack.observability.slo.burnRate.breachedStatustSubtitle": "現在のレートでは、エラー予算は{hour}時間後に使い果たされます。", - "xpack.observability.slo.burnRate.threshold": "しきい値は{threshold}xです", - "xpack.observability.slo.create.errorNotification": "{name}の作成中に問題が発生しました", - "xpack.observability.slo.deleteConfirmationModal.title": "{name}を削除しますか?", - "xpack.observability.slo.duration.day": "{duration, plural, other {#日}}", - "xpack.observability.slo.duration.hour": "{duration, plural, other {#時間}}", - "xpack.observability.slo.duration.minute": "{duration, plural, other {#分}}", - "xpack.observability.slo.duration.month": "{duration, plural, other {#月}}", - "xpack.observability.slo.duration.week": "{duration, plural, other {#週}}", - "xpack.observability.slo.indicatorTypeBadge.exploreInApm": "{service}詳細を表示", - "xpack.observability.slo.rules.burnRate.errors.invalidThresholdValue": "バーンレートしきい値は1以上{maxBurnRate}以下でなければなりません。", - "xpack.observability.slo.rules.groupByMessage": "選択したSLOは\"{groupByField}\"にパーティションが作成されました。このルールは、パーティションフィールドで見つかったすべてのインスタンスを監視し、アラートを生成します。", - "xpack.observability.slo.rules.longWindowDuration.tooltip": "バーンレートが計算されるルックバック期間。ルックバック期間を{shortWindowDuration}分(ルックバック期間の1/12)と短くすることで、より高速な復帰が可能になります", - "xpack.observability.slo.slo.activeAlertsBadge.label": "{count, plural, other {#件のアラート}}", - "xpack.observability.slo.slo.delete.errorNotification": "{name}の削除に失敗しました", - "xpack.observability.slo.slo.delete.successNotification": "{name}が削除されました", - "xpack.observability.slo.slo.stats.objective": "{objective}目標", - "xpack.observability.slo.slo.timeWindow.calendar": "{elapsed}/{total}日", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.duration": "過去{duration}", - "xpack.observability.slo.sloDetails.overview.apmSource.environmentLabel": "環境:{value}", - "xpack.observability.slo.sloDetails.overview.apmSource.serviceLabel": "サービス:{value}", - "xpack.observability.slo.sloDetails.overview.apmSource.transactionNameLabel": "transactionName: {value}", - "xpack.observability.slo.sloDetails.overview.apmSource.transactionTypeLabel": "transactionType: {value}", - "xpack.observability.slo.sloDetails.overview.calendarAlignedTimeWindow": "{duration}カレンダーが調整されました", - "xpack.observability.slo.sloDetails.overview.observedValueSubtitle": "{objective}(目的は{value})", - "xpack.observability.slo.sloDetails.overview.rollingTimeWindow": "{duration}ローリング", - "xpack.observability.slo.sloDetails.overview.timeslicesBudgetingMethodDetails": "{duration}スライス、{target}ターゲット", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.duration": "過去{duration}", - "xpack.observability.slo.sloEdit.rollingTimeWindow.days": "{number}日", - "xpack.observability.slo.update.errorNotification": "{name}の更新中にエラーが発生しました", - "xpack.observability.slo.update.successNotification": "正常に{name}を更新しました", "xpack.observability.syntheticsThrottlingEnabledExperimentDescription": "シンセティック監視構成で調整設定を有効にします。設定が有効でも、モニターで調整を使用できない場合があります。内部使用専用です。{link}", "xpack.observability.transactionRateLabel": "{value} tpm", "xpack.observability.ux.coreVitals.averageMessage": " {bad}未満", @@ -28318,11 +28285,6 @@ "xpack.observability.breadcrumbs.alertsLinkText": "アラート", "xpack.observability.breadcrumbs.overviewLinkText": "概要", "xpack.observability.breadcrumbs.rulesLinkText": "ルール", - "xpack.observability.breadcrumbs.sloCreateLabel": "作成", - "xpack.observability.breadcrumbs.sloDetailsLinkText": "詳細", - "xpack.observability.breadcrumbs.sloEditLabel": "編集", - "xpack.observability.breadcrumbs.sloLabel": "SLO", - "xpack.observability.breadcrumbs.slosLinkText": "SLO", "xpack.observability.cases.caseFeatureNoPermissionsMessage": "ケースを表示するには、Kibana スペースでケース機能の権限が必要です。詳細については、Kibana管理者に連絡してください。", "xpack.observability.cases.caseFeatureNoPermissionsTitle": "Kibana機能権限が必要です", "xpack.observability.cases.caseView.goToDocumentationButton": "ドキュメンテーションを表示", @@ -28399,7 +28361,6 @@ "xpack.observability.customThreshold.rule.viewInAppUrlActionVariableDescription": "アラートソースにリンク", "xpack.observability.defaultApmServiceEnvironment": "デフォルトのサービス環境", "xpack.observability.defaultApmServiceEnvironmentDescription": "APMアプリのデフォルト環境を設定します。空にすると、すべての環境からのデータがデフォルトで表示されます。", - "xpack.observability.embeddableSlo.config.confirmButtonLabel": "構成を確認", "xpack.observability.emptySection.apps.alert.description": "オブザーバビリティで複雑な条件を検出し、それらの条件が満たされたときにアクションをトリガーします。", "xpack.observability.emptySection.apps.alert.link": "ルールを作成", "xpack.observability.emptySection.apps.alert.title": "アラートが見つかりません。", @@ -28438,7 +28399,6 @@ "xpack.observability.featureRegistry.deleteSubFeatureDetails": "ケースとコメントを削除", "xpack.observability.featureRegistry.deleteSubFeatureName": "削除", "xpack.observability.featureRegistry.linkObservabilityTitle": "ケース", - "xpack.observability.featureRegistry.linkSloTitle": "SLO", "xpack.observability.feedbackMenu.appName": "Observability", "xpack.observability.formatters.hoursTimeUnitLabel": "h", "xpack.observability.formatters.hoursTimeUnitLabelExtended": "時間", @@ -28570,246 +28530,6 @@ "xpack.observability.section.errorPanel": "データの取得時にエラーが発生しました。再試行してください", "xpack.observability.serviceGroupMaxServicesUiSettingDescription": "特定のサービスグループのサービス数を制限", "xpack.observability.serviceGroupMaxServicesUiSettingName": "サービスグループの最大サービス", - "xpack.observability.slo.alerting.alertDetailsUrlDescription": "アラートトラブルシューティングビューにリンクして、さらに詳しい状況や詳細を確認できます。server.publicBaseUrlが構成されていない場合は、空の文字列になります。", - "xpack.observability.slo.alerting.burnRate.alertAction": "重大", - "xpack.observability.slo.alerting.burnRate.highPriorityAction": "高", - "xpack.observability.slo.alerting.burnRate.lowPriorityAction": "低", - "xpack.observability.slo.alerting.burnRate.mediumPriorityAction": "中", - "xpack.observability.slo.alerting.reasonDescription": "アラートの理由の簡潔な説明", - "xpack.observability.slo.alerting.sloIdDescription": "SLO一意のID。", - "xpack.observability.slo.alerting.sloInstanceIdDescription": "SLOインスタンスID。", - "xpack.observability.slo.alerting.sloNameDescription": "SLO名。", - "xpack.observability.slo.alerting.thresholdDescription": "バーンレートしきい値。", - "xpack.observability.slo.alerting.timestampDescription": "アラートが検出された時点のタイムスタンプ。", - "xpack.observability.slo.alerting.viewInAppUrlDescription": "詳細な調査を支援するSLO詳細ページへのURL。", - "xpack.observability.slo.alerting.windowDescription": "関連付けられたバーンレート値の期間。", - "xpack.observability.slo.budgetingMethod.occurrences": "オカレンス", - "xpack.observability.slo.budgetingMethod.timeslices": "タイムスライス", - "xpack.observability.slo.burnRate.breachedStatustTitle": "重大値違反", - "xpack.observability.slo.burnRate.noDataStatusSubtitle": "その他のデータを待機中です。", - "xpack.observability.slo.burnRate.noDataStatusTitle": "値なし", - "xpack.observability.slo.burnRate.okStatusSubtitle": "エラー予算が枯渇するリスクはありません。", - "xpack.observability.slo.burnRate.okStatusTitle": "許容値", - "xpack.observability.slo.burnRate.technicalPreviewBadgeDescription": "この機能はテクニカルプレビュー中であり、将来のバージョンで変更または削除される可能性があります。デザインとコードは正式に一般公開された機能より完成度が低く、現状のまま保証なしで提供されています。テクニカルプレビュー機能は、正式に一般公開された機能に適用されるサポートサービスレベル契約の対象外です。", - "xpack.observability.slo.burnRate.technicalPreviewBadgeTitle": "テクニカルプレビュー", - "xpack.observability.slo.burnRate.timeRangeBtnLegend": "時間範囲を選択", - "xpack.observability.slo.burnRate.title": "バーンレート", - "xpack.observability.slo.deleteConfirmationModal.cancelButtonLabel": "キャンセル", - "xpack.observability.slo.deleteConfirmationModal.deleteButtonLabel": "削除", - "xpack.observability.slo.deleteConfirmationModal.descriptionText": "このSLOを削除した後、復元することはできません。", - "xpack.observability.slo.duration.daily": "日ごと", - "xpack.observability.slo.duration.hourly": "1 時間ごと", - "xpack.observability.slo.duration.minutely": "毎分", - "xpack.observability.slo.duration.monthly": "月ごと", - "xpack.observability.slo.duration.weekly": "週ごと", - "xpack.observability.slo.globalDiagnosis.errorNotification": "この機能を使用する権限がありません。", - "xpack.observability.slo.indicators.apmAvailability": "APM可用性", - "xpack.observability.slo.indicators.apmLatency": "APMレイテンシ", - "xpack.observability.slo.indicators.customKql": "カスタムKQL", - "xpack.observability.slo.indicators.customMetric": "カスタムメトリック", - "xpack.observability.slo.indicators.histogram": "ヒストグラムメトリック", - "xpack.observability.slo.item.actions.button": "アクション", - "xpack.observability.slo.item.actions.clone": "クローンを作成", - "xpack.observability.slo.item.actions.createRule": "新しいアラートルールを作成", - "xpack.observability.slo.item.actions.delete": "削除", - "xpack.observability.slo.item.actions.details": "詳細", - "xpack.observability.slo.item.actions.edit": "編集", - "xpack.observability.slo.item.actions.manageRules": "ルールの管理", - "xpack.observability.slo.list.emptyMessage": "条件に合った結果はありません。", - "xpack.observability.slo.list.emptyTitle": "成果がありません", - "xpack.observability.slo.list.errorMessage": "SLOオブジェクトの読み込みエラーが発生しました。ヘルプについては、管理者にお問い合わせください。", - "xpack.observability.slo.list.errorNotification": "SLOの取得中に問題が発生しました", - "xpack.observability.slo.list.errorTitle": "SLOを読み込めません", - "xpack.observability.slo.list.search": "SLOを検索...", - "xpack.observability.slo.list.sortBy.errorBudgetConsumed": "エラー予算が消費されました", - "xpack.observability.slo.list.sortBy.errorBudgetRemaining": "残り予算エラー", - "xpack.observability.slo.list.sortBy.sliValue": "SLI値", - "xpack.observability.slo.list.sortBy.sloStatus": "SLOステータス", - "xpack.observability.slo.rules.actionGroupSelectorLabel": "アクショングループ", - "xpack.observability.slo.rules.addWindowAriaLabel": "時間枠を追加", - "xpack.observability.slo.rules.addWIndowLabel": "時間枠を追加", - "xpack.observability.slo.rules.burnRate.defaultActionMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\}は次の条件でアクティブです。\n\n- SLO: \\{\\{context.sloName\\}\\}'\n- 過去\\{\\{context.longWindow.duration\\}\\}のバーンレートが\\{\\{context.longWindow.burnRate\\}\\}である\n- 過去\\{\\{context.shortWindow.duration\\}\\}のバーンレートが\\{\\{context.shortWindow.burnRate\\}\\}である\n- Threshold: \\{\\{context.burnRateThreshold\\}\\}\n\n[アラート詳細を表示](\\{\\{context.alertDetailsUrl\\}\\})\n", - "xpack.observability.slo.rules.burnRate.defaultRecoveryMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\}が回復しました。\n\n- SLO: \\{\\{context.sloName\\}\\}'\n- 過去\\{\\{context.longWindow.duration\\}\\}のバーンレートが\\{\\{context.longWindow.burnRate\\}\\}である\n- 過去\\{\\{context.shortWindow.duration\\}\\}のバーンレートが\\{\\{context.shortWindow.burnRate\\}\\}である\n- Threshold: \\{\\{context.burnRateThreshold\\}\\}\n\n[アラート詳細を表示](\\{\\{context.alertDetailsUrl\\}\\})\n", - "xpack.observability.slo.rules.burnRate.description": "SLOバーンレートが定義された期間で高すぎるときにアラートを通知します。", - "xpack.observability.slo.rules.burnRate.errors.burnRateThresholdRequired": "バーンレートしきい値は必須です。", - "xpack.observability.slo.rules.burnRate.errors.sloRequired": "SLOが必要です。", - "xpack.observability.slo.rules.burnRate.errors.windowDurationRequired": "ループバック期間は必須です。", - "xpack.observability.slo.rules.burnRate.name": "SLOバーンレート", - "xpack.observability.slo.rules.burnRate.rowLabel": "バーンレートしきい値", - "xpack.observability.slo.rules.burnRate.tooltip": "バーンレートは、サービスがルックバック期間でエラー予算をどの程度速く消費するのかを示します。", - "xpack.observability.slo.rules.deleteWindowLabel": "時間枠を削除", - "xpack.observability.slo.rules.longWindow.errorText": "ループバック期間は1~72時間でなければなりません。", - "xpack.observability.slo.rules.longWindow.rowLabel": "ルックバック(時間)", - "xpack.observability.slo.rules.longWindow.valueLabel": "ルックバック期間(時間)", - "xpack.observability.slo.rules.sloSelector.ariaLabel": "SLO", - "xpack.observability.slo.rules.sloSelector.placeholder": "SLOを選択", - "xpack.observability.slo.rules.sloSelector.rowLabel": "SLO", - "xpack.observability.slo.slo.activeAlertsBadge.ariaLabel": "アクティブアラートバッジ", - "xpack.observability.slo.slo.item.actions.clone": "クローンを作成", - "xpack.observability.slo.slo.item.actions.delete": "削除", - "xpack.observability.slo.slo.rulesBadge.popover": "このSLOではまだルールが構成されていません。SLOに違反したときにアラートを受信しません。", - "xpack.observability.slo.slo.stats.budgetRemaining": "残り予算", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.chartTitle": "残り予算エラー", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.remaining": "残り", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.title": "エラー予算バーンダウン", - "xpack.observability.slo.sloDetails.headerControl.actions": "アクション", - "xpack.observability.slo.sloDetails.headerControl.createBurnRateRule": "新しいアラートルールを作成", - "xpack.observability.slo.sloDetails.headerControl.edit": "編集", - "xpack.observability.slo.sloDetails.headerControl.manageRules": "ルールの管理", - "xpack.observability.slo.sloDetails.headerTitle.createdMessage": "作成日時", - "xpack.observability.slo.sloDetails.headerTitle.lastUpdatedMessage": "最終更新日", - "xpack.observability.slo.sloDetails.overview.apmSource": "APMソース", - "xpack.observability.slo.sloDetails.overview.budgetingMethodTitle": "予算設定方法", - "xpack.observability.slo.sloDetails.overview.descriptionTitle": "説明", - "xpack.observability.slo.sloDetails.overview.indicatorTypeTitle": "インジケータータイプ", - "xpack.observability.slo.sloDetails.overview.observedValueTitle": "観測された値", - "xpack.observability.slo.sloDetails.overview.tagsTitle": "タグ", - "xpack.observability.slo.sloDetails.overview.timeWindowTitle": "時間枠", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.chartTitle": "SLI値", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.current": "観測された値", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.objective": "目的", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.title": "履歴SLI", - "xpack.observability.slo.sloDetails.tab.alertsLabel": "アラート", - "xpack.observability.slo.sloDetails.tab.overviewLabel": "概要", - "xpack.observability.slo.sloEdit.apm.filter.tooltip": "このKQLクエリは、このSLOの一部の関連する情報でAPMメトリックをフィルタリングするために使用されます。", - "xpack.observability.slo.sloEdit.apm.serviceName.tooltip": "これはこのSLOによって監視されるAPMサービスです。", - "xpack.observability.slo.sloEdit.apmAvailability.serviceEnvironment": "サービス環境", - "xpack.observability.slo.sloEdit.apmAvailability.serviceEnvironment.placeholder": "環境を選択", - "xpack.observability.slo.sloEdit.apmAvailability.serviceName": "サービス名", - "xpack.observability.slo.sloEdit.apmAvailability.serviceName.placeholder": "APMサービスを選択", - "xpack.observability.slo.sloEdit.apmAvailability.transactionName": "トランザクション名", - "xpack.observability.slo.sloEdit.apmAvailability.transactionName.placeholder": "トランザクション名を選択", - "xpack.observability.slo.sloEdit.apmAvailability.transactionType": "トランザクションタイプ", - "xpack.observability.slo.sloEdit.apmAvailability.transactionType.placeholder": "トランザクションタイプを選択", - "xpack.observability.slo.sloEdit.apmLatency.filter": "クエリのフィルター", - "xpack.observability.slo.sloEdit.apmLatency.filter.placeholder": "インデックスで適用するカスタムフィルター", - "xpack.observability.slo.sloEdit.apmLatency.serviceEnvironment": "サービス環境", - "xpack.observability.slo.sloEdit.apmLatency.serviceEnvironment.placeholder": "環境を選択", - "xpack.observability.slo.sloEdit.apmLatency.serviceName": "サービス名", - "xpack.observability.slo.sloEdit.apmLatency.serviceName.placeholder": "APMサービスを選択", - "xpack.observability.slo.sloEdit.apmLatency.threshold.placeholder": "しきい値(ミリ秒)", - "xpack.observability.slo.sloEdit.apmLatency.threshold.tooltip": "SLOで「良好」または「成功」リクエストを定義するしきい値(ミリ秒)を構成します。", - "xpack.observability.slo.sloEdit.apmLatency.transactionName": "トランザクション名", - "xpack.observability.slo.sloEdit.apmLatency.transactionName.placeholder": "トランザクション名を選択", - "xpack.observability.slo.sloEdit.apmLatency.transactionType": "トランザクションタイプ", - "xpack.observability.slo.sloEdit.apmLatency.transactionType.placeholder": "トランザクションタイプを選択", - "xpack.observability.slo.sloEdit.budgetingMethod.label": "予算設定方法", - "xpack.observability.slo.sloEdit.budgetingMethod.tooltip": "出現に基づくSLOは、該当期間における、合計イベント数に対する良好なイベント数の比率を使用します。タイムスライスに基づくSLOは、該当期間における、合計タイムスライス数に対する良好なタイムスライス数の比率を使用します。", - "xpack.observability.slo.sloEdit.calendarTimeWindow.monthly": "月ごと", - "xpack.observability.slo.sloEdit.calendarTimeWindow.weekly": "週ごと", - "xpack.observability.slo.sloEdit.cancelButton": "キャンセル", - "xpack.observability.slo.sloEdit.createSloButton": "SLOの作成", - "xpack.observability.slo.sloEdit.customKql.indexSelection.label": "インデックス", - "xpack.observability.slo.sloEdit.dataPreviewChart.errorMessage": "現在のインジケーター設定は無効です", - "xpack.observability.slo.sloEdit.dataPreviewChart.explanationMessage": "インジケーターフィールドに入力すると、現在のメトリックが可視化されます。", - "xpack.observability.slo.sloEdit.dataPreviewChart.panelLabel": "SLIプレビュー", - "xpack.observability.slo.sloEdit.dataPreviewChart.xTitle": "過去 1 時間", - "xpack.observability.slo.sloEdit.dataPreviewChart.yTitle": "SLI", - "xpack.observability.slo.sloEdit.definition.sliType": "SLIタイプを選択", - "xpack.observability.slo.sloEdit.definition.title": "SLIを定義", - "xpack.observability.slo.sloEdit.description.sloDescription": "説明", - "xpack.observability.slo.sloEdit.description.sloDescriptionPlaceholder": "SLOの簡潔な説明", - "xpack.observability.slo.sloEdit.description.sloName": "SLO名", - "xpack.observability.slo.sloEdit.description.sloNamePlaceholder": "SLOの名前", - "xpack.observability.slo.sloEdit.description.title": "SLOの説明", - "xpack.observability.slo.sloEdit.editSloButton": "SLOの更新", - "xpack.observability.slo.sloEdit.fieldSelector.all": "すべて", - "xpack.observability.slo.sloEdit.groupBy.label": "パーティション", - "xpack.observability.slo.sloEdit.groupBy.placeholder": "パーティション分割する任意のフィールドを選択", - "xpack.observability.slo.sloEdit.groupBy.tooltip": "選択したフィールドの値ごとに個別のSLOを作成します。", - "xpack.observability.slo.sloEdit.objectives.title": "目標を設定", - "xpack.observability.slo.sloEdit.sliType.customKql.customFilter": "インデックスで適用するカスタムフィルター", - "xpack.observability.slo.sloEdit.sliType.customKql.customFilter.tooltip": "このKQLクエリを使用して、一部の関連する条件でドキュメントをフィルタリングできます。", - "xpack.observability.slo.sloEdit.sliType.customKql.goodQuery": "良いクエリ", - "xpack.observability.slo.sloEdit.sliType.customKql.goodQuery.tooltip": "このKQLクエリは、SLOを計算する目的で、「良好」または「成功」と見なされるイベントのサブセットを返します。このクエリは、ステータスコード、エラー、メッセージ、または他の関連するフィールドなどの一部の関連する条件に基づいて、イベントをフィルタリングします。", - "xpack.observability.slo.sloEdit.sliType.customKql.goodQueryPlaceholder": "良いイベントを定義", - "xpack.observability.slo.sloEdit.sliType.customKql.queryFilter": "クエリのフィルター", - "xpack.observability.slo.sloEdit.sliType.customKql.totalQuery": "合計クエリ", - "xpack.observability.slo.sloEdit.sliType.customKql.totalQuery.tooltip": "このKQLクエリは、良好なイベントと問題があるイベントの両方を含む、SLO計算に関連するすべてのイベントを返します。", - "xpack.observability.slo.sloEdit.sliType.customKql.totalQueryPlaceholder": "合計イベントを定義", - "xpack.observability.slo.sloEdit.sliType.customMetric.addMetricAriaLabel": "メトリックを追加", - "xpack.observability.slo.sloEdit.sliType.customMetric.addMetricLabel": "メトリックを追加", - "xpack.observability.slo.sloEdit.sliType.customMetric.customFilter": "インデックスで適用するカスタムフィルター", - "xpack.observability.slo.sloEdit.sliType.customMetric.customFilter.tooltip": "このKQLクエリを使用して、一部の関連する条件でドキュメントをフィルタリングできます。", - "xpack.observability.slo.sloEdit.sliType.customMetric.deleteLabel": "メトリックを削除", - "xpack.observability.slo.sloEdit.sliType.customMetric.equation.invalidCharacters": "等式フィールドでは次の文字のみを使用できます:A-Z、+、-、/、*、(、)、?、!、&、:、|、>、<、=", - "xpack.observability.slo.sloEdit.sliType.customMetric.equationHelpText": "基本的な数式をサポートします。有効な文字:A-Z、+、-、/、*、(、)、?、!、&、:、|、>、<、=", - "xpack.observability.slo.sloEdit.sliType.customMetric.equationLabel": "式", - "xpack.observability.slo.sloEdit.sliType.customMetric.filterLabel": "フィルター", - "xpack.observability.slo.sloEdit.sliType.customMetric.goodTitle": "良好なイベント数", - "xpack.observability.slo.sloEdit.sliType.customMetric.metricField.placeholder": "メトリックフィールドを選択", - "xpack.observability.slo.sloEdit.sliType.customMetric.metricLabel": "メトリック", - "xpack.observability.slo.sloEdit.sliType.customMetric.queryFilter": "クエリのフィルター", - "xpack.observability.slo.sloEdit.sliType.customMetric.totalEquation.tooltip": "これは基本的な数学ロジック(A + B / C)とブールロジック(A < B ?A :B)をサポートします。", - "xpack.observability.slo.sloEdit.sliType.customMetric.totalMetric.tooltip": "このフィールドのデータは「sum」集計で集約されます。", - "xpack.observability.slo.sloEdit.sliType.customMetric.totalTitle": "合計イベント数", - "xpack.observability.slo.sloEdit.sliType.histogram.aggregation.placeholder": "集約を選択してください", - "xpack.observability.slo.sloEdit.sliType.histogram.aggregationLabel": "アグリゲーション", - "xpack.observability.slo.sloEdit.sliType.histogram.aggregationTooltip": "\"value count\"集約は、ヒストグラムフィールドの合計カウントを返します。Rangeは、ヒストグラムフィールドから、以下で定義された範囲内のカウントを返します。", - "xpack.observability.slo.sloEdit.sliType.histogram.customFilter": "インデックスで適用するカスタムフィルター", - "xpack.observability.slo.sloEdit.sliType.histogram.customFilter.tooltip": "このKQLクエリを使用して、一部の関連する条件でドキュメントをフィルタリングできます。", - "xpack.observability.slo.sloEdit.sliType.histogram.fromLabel": "開始:", - "xpack.observability.slo.sloEdit.sliType.histogram.fromTooltip": "\"from\"値は含まれます。", - "xpack.observability.slo.sloEdit.sliType.histogram.goodTitle": "良好なイベント数", - "xpack.observability.slo.sloEdit.sliType.histogram.kqlFilterLabel": "KQLフィルター", - "xpack.observability.slo.sloEdit.sliType.histogram.metricField.placeholder": "ヒストグラムフィールドを選択", - "xpack.observability.slo.sloEdit.sliType.histogram.metricLabel": "フィールド", - "xpack.observability.slo.sloEdit.sliType.histogram.query.tooltip": "このKQLクエリは、このインジケーターのイベントのサブセットを返します。", - "xpack.observability.slo.sloEdit.sliType.histogram.queryFilter": "クエリのフィルター", - "xpack.observability.slo.sloEdit.sliType.histogram.rangeLabel": "範囲", - "xpack.observability.slo.sloEdit.sliType.histogram.sourceTitle": "送信元", - "xpack.observability.slo.sloEdit.sliType.histogram.toLabel": "終了:", - "xpack.observability.slo.sloEdit.sliType.histogram.totalTitle": "合計イベント数", - "xpack.observability.slo.sloEdit.sliType.histogram.toTooltip": "\"to\"値は含まれません。", - "xpack.observability.slo.sloEdit.sliType.histogram.valueCountLabel": "値カウント", - "xpack.observability.slo.sloEdit.tags.label": "タグ", - "xpack.observability.slo.sloEdit.tags.placeholder": "タグを追加", - "xpack.observability.slo.sloEdit.targetSlo.label": "目標 / SLO(%)", - "xpack.observability.slo.sloEdit.targetSlo.tooltip": "SLOの目標(%)。", - "xpack.observability.slo.sloEdit.timeSliceTarget.label": "タイムスライス目標(%)", - "xpack.observability.slo.sloEdit.timeSliceTarget.tooltip": "スライスが良好か問題があるかどうかを判断するために使用される、個別のタイムスライス目標。", - "xpack.observability.slo.sloEdit.timesliceWindow.label": "タイムスライス期間(分)", - "xpack.observability.slo.sloEdit.timesliceWindow.tooltip": "データを評価するために使用されるタイムスライス期間サイズ。", - "xpack.observability.slo.sloEdit.timestampField.label": "タイムスタンプフィールド", - "xpack.observability.slo.sloEdit.timestampField.placeholder": "タイムスタンプフィールドを選択", - "xpack.observability.slo.sloEdit.timeWindow.calendarAligned": "カレンダーが調整されました", - "xpack.observability.slo.sloEdit.timeWindow.rolling": "ローリング", - "xpack.observability.slo.sloEdit.timeWindowDuration.label": "期間", - "xpack.observability.slo.sloEdit.timeWindowDuration.tooltip": "SLOを計算するために使用される時間枠期間。", - "xpack.observability.slo.sloEdit.timeWindowType.label": "時間枠", - "xpack.observability.slo.sloEdit.timeWindowType.tooltip": "ローリング時間枠とカレンダー時間枠のどちらかを選択します。", - "xpack.observability.slo.sloList.welcomePrompt.buttonLabel": "SLOの作成", - "xpack.observability.slo.sloList.welcomePrompt.getStartedMessage": "開始するには、まずSLOを作成します。", - "xpack.observability.slo.sloList.welcomePrompt.learnMore": "詳細について", - "xpack.observability.slo.sloList.welcomePrompt.learnMoreLink": "ドキュメントを読む", - "xpack.observability.slo.sloList.welcomePrompt.messageParagraph1": "SLAを遂行するには、SLI(サービスレベル指標)やSLO(サービスレベル目標)など、ビジネス上重要なメトリックを計測する必要があります。", - "xpack.observability.slo.sloList.welcomePrompt.messageParagraph2": "リアルタイムなインサイトを入手して、サービスのアップタイムや信頼性を手軽に利害関係者向けのレポートにまとめましょう。", - "xpack.observability.slo.sloList.welcomePrompt.needLicenseMessage": "SLOを使用するには、Elastic Cloudサブスクリプションまたはプレミアムライセンスが必要です。", - "xpack.observability.slo.sloList.welcomePrompt.signupForCloud": "Elastic Cloudに登録", - "xpack.observability.slo.sloList.welcomePrompt.signupForLicense": "ライセンスを登録", - "xpack.observability.slo.sloList.welcomePrompt.title": "SLOを追跡して遵守", - "xpack.observability.slo.sloStatusBadge.degrading": "劣化", - "xpack.observability.slo.sloStatusBadge.forecasted": "予測", - "xpack.observability.slo.sloStatusBadge.healthy": "正常", - "xpack.observability.slo.sloStatusBadge.noData": "データなし", - "xpack.observability.slo.sloStatusBadge.noDataTooltip": "データが集約され、利用可能になるまでには時間がかかる場合があります。", - "xpack.observability.slo.sloStatusBadge.violated": "違反", - "xpack.observability.sloCreatePageTitle": "新規SLOを作成", - "xpack.observability.sloEditPageTitle": "SLOの編集", - "xpack.observability.sloEmbeddable.config.cancelButtonLabel": "キャンセル", - "xpack.observability.sloEmbeddable.config.errors.sloRequired": "SLOが必要です。", - "xpack.observability.sloEmbeddable.config.sloSelector.ariaLabel": "SLO", - "xpack.observability.sloEmbeddable.config.sloSelector.headerTitle": "SLO構成", - "xpack.observability.sloEmbeddable.config.sloSelector.placeholder": "SLOを選択", - "xpack.observability.sloEmbeddable.description": "SLO正常性の概要を取得", - "xpack.observability.sloEmbeddable.displayName": "SLO概要", - "xpack.observability.sloEmbeddable.displayTitle": "SLO概要", - "xpack.observability.sloEmbeddable.overview.sloNotFoundText": "SLOが削除されました。ウィジェットをダッシュボードから安全に削除できます。", - "xpack.observability.slos.sloDetails.headerControl.exploreInApm": "サービス詳細", - "xpack.observability.slosLinkTitle": "SLO", - "xpack.observability.slosPage.autoRefreshButtonLabel": "自動更新", - "xpack.observability.slosPage.stopRefreshingButtonLabel": "更新中止", - "xpack.observability.slosPageTitle": "SLO", "xpack.observability.status.dataAvailable": "利用可能なデータがありません。", "xpack.observability.status.dataAvailableTitle": "利用可能なデータがありません", "xpack.observability.status.learnMoreButton": "詳細", @@ -28873,6 +28593,260 @@ "xpack.observability.ux.dashboard.webCoreVitals.help": "詳細", "xpack.observability.ux.dashboard.webCoreVitals.helpAriaLabel": "ヘルプ", "xpack.observability.ux.service.help": "最大トラフィックのRUMサービスが選択されています", + "xpack.slo.alerting.burnRate.reason": "{actionGroupName}:過去{longWindowDuration}のバーンレートは{longWindowBurnRate}で、過去{shortWindowDuration}のバーンレートは{shortWindowBurnRate}です。両期間とも{burnRateThreshold}を超えたらアラート", + "xpack.slo.alerting.burnRate.reasonForInstanceId": "{actionGroupName}:過去{longWindowDuration}のバーンレートは{longWindowBurnRate}、{instanceId}の過去{shortWindowDuration}のバーンレートは{shortWindowBurnRate}です。両期間とも{burnRateThreshold}を超えたらアラート", + "xpack.slo.burnRate.breachedStatustSubtitle": "現在のレートでは、エラー予算は{hour}時間後に使い果たされます。", + "xpack.slo.burnRate.threshold": "しきい値は{threshold}xです", + "xpack.slo.create.errorNotification": "{name}の作成中に問題が発生しました", + "xpack.slo.deleteConfirmationModal.title": "{name}を削除しますか?", + "xpack.slo.duration.day": "{duration, plural, other {#日}}", + "xpack.slo.duration.hour": "{duration, plural, other {#時間}}", + "xpack.slo.duration.minute": "{duration, plural, other {#分}}", + "xpack.slo.duration.month": "{duration, plural, other {#月}}", + "xpack.slo.duration.week": "{duration, plural, other {#週}}", + "xpack.slo.indicatorTypeBadge.exploreInApm": "{service}詳細を表示", + "xpack.slo.rules.burnRate.errors.invalidThresholdValue": "バーンレートしきい値は1以上{maxBurnRate}以下でなければなりません。", + "xpack.slo.rules.groupByMessage": "選択したSLOは\"{groupByField}\"にパーティションが作成されました。このルールは、パーティションフィールドで見つかったすべてのインスタンスを監視し、アラートを生成します。", + "xpack.slo.rules.longWindowDuration.tooltip": "バーンレートが計算されるルックバック期間。ルックバック期間を{shortWindowDuration}分(ルックバック期間の1/12)と短くすることで、より高速な復帰が可能になります", + "xpack.slo.slo.activeAlertsBadge.label": "{count, plural, other {#件のアラート}}", + "xpack.slo.slo.delete.errorNotification": "{name}の削除に失敗しました", + "xpack.slo.slo.delete.successNotification": "{name}が削除されました", + "xpack.slo.slo.timeWindow.calendar": "{elapsed}/{total}日", + "xpack.slo.sloDetails.errorBudgetChartPanel.duration": "過去{duration}", + "xpack.slo.sloDetails.overview.apmSource.environmentLabel": "環境:{value}", + "xpack.slo.sloDetails.overview.apmSource.serviceLabel": "サービス:{value}", + "xpack.slo.sloDetails.overview.apmSource.transactionNameLabel": "transactionName: {value}", + "xpack.slo.sloDetails.overview.apmSource.transactionTypeLabel": "transactionType: {value}", + "xpack.slo.sloDetails.overview.calendarAlignedTimeWindow": "{duration}カレンダーが調整されました", + "xpack.slo.sloDetails.overview.observedValueSubtitle": "{objective}(目的は{value})", + "xpack.slo.sloDetails.overview.rollingTimeWindow": "{duration}ローリング", + "xpack.slo.sloDetails.overview.timeslicesBudgetingMethodDetails": "{duration}スライス、{target}ターゲット", + "xpack.slo.sloDetails.sliHistoryChartPanel.duration": "過去{duration}", + "xpack.slo.sloEdit.rollingTimeWindow.days": "{number}日", + "xpack.slo.update.errorNotification": "{name}の更新中にエラーが発生しました", + "xpack.slo.update.successNotification": "正常に{name}を更新しました", + "xpack.slo.alerting.alertDetailsUrlDescription": "アラートトラブルシューティングビューにリンクして、さらに詳しい状況や詳細を確認できます。server.publicBaseUrlが構成されていない場合は、空の文字列になります。", + "xpack.slo.alerting.burnRate.alertAction": "重大", + "xpack.slo.alerting.burnRate.highPriorityAction": "高", + "xpack.slo.alerting.burnRate.lowPriorityAction": "低", + "xpack.slo.alerting.burnRate.mediumPriorityAction": "中", + "xpack.slo.alerting.reasonDescription": "アラートの理由の簡潔な説明", + "xpack.slo.alerting.sloIdDescription": "SLO一意のID。", + "xpack.slo.alerting.sloInstanceIdDescription": "SLOインスタンスID。", + "xpack.slo.alerting.sloNameDescription": "SLO名。", + "xpack.slo.alerting.thresholdDescription": "バーンレートしきい値。", + "xpack.slo.alerting.timestampDescription": "アラートが検出された時点のタイムスタンプ。", + "xpack.slo.alerting.viewInAppUrlDescription": "詳細な調査を支援するSLO詳細ページへのURL。", + "xpack.slo.alerting.windowDescription": "関連付けられたバーンレート値の期間。", + "xpack.slo.budgetingMethod.occurrences": "オカレンス", + "xpack.slo.budgetingMethod.timeslices": "タイムスライス", + "xpack.slo.burnRate.breachedStatustTitle": "重大値違反", + "xpack.slo.burnRate.noDataStatusSubtitle": "その他のデータを待機中です。", + "xpack.slo.burnRate.noDataStatusTitle": "値なし", + "xpack.slo.burnRate.okStatusSubtitle": "エラー予算が枯渇するリスクはありません。", + "xpack.slo.burnRate.okStatusTitle": "許容値", + "xpack.slo.burnRate.technicalPreviewBadgeDescription": "この機能はテクニカルプレビュー中であり、将来のバージョンで変更または削除される可能性があります。デザインとコードは正式に一般公開された機能より完成度が低く、現状のまま保証なしで提供されています。テクニカルプレビュー機能は、正式に一般公開された機能に適用されるサポートサービスレベル契約の対象外です。", + "xpack.slo.burnRate.technicalPreviewBadgeTitle": "テクニカルプレビュー", + "xpack.slo.burnRate.timeRangeBtnLegend": "時間範囲を選択", + "xpack.slo.burnRate.title": "バーンレート", + "xpack.slo.deleteConfirmationModal.cancelButtonLabel": "キャンセル", + "xpack.slo.deleteConfirmationModal.deleteButtonLabel": "削除", + "xpack.slo.deleteConfirmationModal.descriptionText": "このSLOを削除した後、復元することはできません。", + "xpack.slo.duration.daily": "日ごと", + "xpack.slo.duration.hourly": "1 時間ごと", + "xpack.slo.duration.minutely": "毎分", + "xpack.slo.duration.monthly": "月ごと", + "xpack.slo.duration.weekly": "週ごと", + "xpack.slo.globalDiagnosis.errorNotification": "この機能を使用する権限がありません。", + "xpack.slo.indicators.apmAvailability": "APM可用性", + "xpack.slo.indicators.apmLatency": "APMレイテンシ", + "xpack.slo.indicators.customKql": "カスタムKQL", + "xpack.slo.indicators.customMetric": "カスタムメトリック", + "xpack.slo.indicators.histogram": "ヒストグラムメトリック", + "xpack.slo.item.actions.button": "アクション", + "xpack.slo.item.actions.clone": "クローンを作成", + "xpack.slo.item.actions.createRule": "新しいアラートルールを作成", + "xpack.slo.item.actions.delete": "削除", + "xpack.slo.item.actions.details": "詳細", + "xpack.slo.item.actions.edit": "編集", + "xpack.slo.item.actions.manageRules": "ルールの管理", + "xpack.slo.list.emptyMessage": "条件に合った結果はありません。", + "xpack.slo.list.emptyTitle": "成果がありません", + "xpack.slo.list.errorMessage": "SLOオブジェクトの読み込みエラーが発生しました。ヘルプについては、管理者にお問い合わせください。", + "xpack.slo.list.errorNotification": "SLOの取得中に問題が発生しました", + "xpack.slo.list.errorTitle": "SLOを読み込めません", + "xpack.slo.list.search": "SLOを検索...", + "xpack.slo.list.sortBy.errorBudgetConsumed": "エラー予算が消費されました", + "xpack.slo.list.sortBy.errorBudgetRemaining": "残り予算エラー", + "xpack.slo.list.sortBy.sliValue": "SLI値", + "xpack.slo.list.sortBy.sloStatus": "SLOステータス", + "xpack.slo.rules.actionGroupSelectorLabel": "アクショングループ", + "xpack.slo.rules.addWindowAriaLabel": "時間枠を追加", + "xpack.slo.rules.burnRate.defaultActionMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\}は次の条件でアクティブです。\n\n- SLO: \\{\\{context.sloName\\}\\}'\n- 過去\\{\\{context.longWindow.duration\\}\\}のバーンレートが\\{\\{context.longWindow.burnRate\\}\\}である\n- 過去\\{\\{context.shortWindow.duration\\}\\}のバーンレートが\\{\\{context.shortWindow.burnRate\\}\\}である\n- Threshold: \\{\\{context.burnRateThreshold\\}\\}\n\n[アラート詳細を表示](\\{\\{context.alertDetailsUrl\\}\\})\n", + "xpack.slo.rules.burnRate.defaultRecoveryMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\}が回復しました。\n\n- SLO: \\{\\{context.sloName\\}\\}'\n- 過去\\{\\{context.longWindow.duration\\}\\}のバーンレートが\\{\\{context.longWindow.burnRate\\}\\}である\n- 過去\\{\\{context.shortWindow.duration\\}\\}のバーンレートが\\{\\{context.shortWindow.burnRate\\}\\}である\n- Threshold: \\{\\{context.burnRateThreshold\\}\\}\n\n[アラート詳細を表示](\\{\\{context.alertDetailsUrl\\}\\})\n", + "xpack.slo.rules.burnRate.description": "SLOバーンレートが定義された期間で高すぎるときにアラートを通知します。", + "xpack.slo.rules.burnRate.errors.burnRateThresholdRequired": "バーンレートしきい値は必須です。", + "xpack.slo.rules.burnRate.errors.sloRequired": "SLOが必要です。", + "xpack.slo.rules.burnRate.errors.windowDurationRequired": "ループバック期間は必須です。", + "xpack.slo.rules.burnRate.name": "SLOバーンレート", + "xpack.slo.rules.burnRate.rowLabel": "バーンレートしきい値", + "xpack.slo.rules.burnRate.tooltip": "バーンレートは、サービスがルックバック期間でエラー予算をどの程度速く消費するのかを示します。", + "xpack.slo.rules.deleteWindowLabel": "時間枠を削除", + "xpack.slo.rules.longWindow.errorText": "ループバック期間は1~72時間でなければなりません。", + "xpack.slo.rules.longWindow.rowLabel": "ルックバック(時間)", + "xpack.slo.rules.longWindow.valueLabel": "ルックバック期間(時間)", + "xpack.slo.rules.sloSelector.ariaLabel": "SLO", + "xpack.slo.rules.sloSelector.placeholder": "SLOを選択", + "xpack.slo.rules.sloSelector.rowLabel": "SLO", + "xpack.slo.slo.activeAlertsBadge.ariaLabel": "アクティブアラートバッジ", + "xpack.slo.slo.item.actions.clone": "クローンを作成", + "xpack.slo.slo.item.actions.delete": "削除", + "xpack.slo.slo.rulesBadge.popover": "このSLOではまだルールが構成されていません。SLOに違反したときにアラートを受信しません。", + "xpack.slo.sloDetails.errorBudgetChartPanel.chartTitle": "残り予算エラー", + "xpack.slo.sloDetails.errorBudgetChartPanel.remaining": "残り", + "xpack.slo.sloDetails.errorBudgetChartPanel.title": "エラー予算バーンダウン", + "xpack.slo.sloDetails.headerControl.actions": "アクション", + "xpack.slo.sloDetails.headerControl.createBurnRateRule": "新しいアラートルールを作成", + "xpack.slo.sloDetails.headerControl.edit": "編集", + "xpack.slo.sloDetails.headerControl.manageRules": "ルールの管理", + "xpack.slo.sloDetails.headerTitle.createdMessage": "作成日時", + "xpack.slo.sloDetails.headerTitle.lastUpdatedMessage": "最終更新日", + "xpack.slo.sloDetails.overview.apmSource": "APMソース", + "xpack.slo.sloDetails.overview.budgetingMethodTitle": "予算設定方法", + "xpack.slo.sloDetails.overview.descriptionTitle": "説明", + "xpack.slo.sloDetails.overview.indicatorTypeTitle": "インジケータータイプ", + "xpack.slo.sloDetails.overview.observedValueTitle": "観測された値", + "xpack.slo.sloDetails.overview.tagsTitle": "タグ", + "xpack.slo.sloDetails.overview.timeWindowTitle": "時間枠", + "xpack.slo.sloDetails.sliHistoryChartPanel.chartTitle": "SLI値", + "xpack.slo.sloDetails.sliHistoryChartPanel.current": "観測された値", + "xpack.slo.sloDetails.sliHistoryChartPanel.objective": "目的", + "xpack.slo.sloDetails.sliHistoryChartPanel.title": "履歴SLI", + "xpack.slo.sloDetails.tab.alertsLabel": "アラート", + "xpack.slo.sloDetails.tab.overviewLabel": "概要", + "xpack.slo.sloEdit.apm.filter.tooltip": "このKQLクエリは、このSLOの一部の関連する情報でAPMメトリックをフィルタリングするために使用されます。", + "xpack.slo.sloEdit.apm.serviceName.tooltip": "これはこのSLOによって監視されるAPMサービスです。", + "xpack.slo.sloEdit.apmAvailability.serviceEnvironment": "サービス環境", + "xpack.slo.sloEdit.apmAvailability.serviceEnvironment.placeholder": "環境を選択", + "xpack.slo.sloEdit.apmAvailability.serviceName": "サービス名", + "xpack.slo.sloEdit.apmAvailability.serviceName.placeholder": "APMサービスを選択", + "xpack.slo.sloEdit.apmAvailability.transactionName": "トランザクション名", + "xpack.slo.sloEdit.apmAvailability.transactionName.placeholder": "トランザクション名を選択", + "xpack.slo.sloEdit.apmAvailability.transactionType": "トランザクションタイプ", + "xpack.slo.sloEdit.apmAvailability.transactionType.placeholder": "トランザクションタイプを選択", + "xpack.slo.sloEdit.apmLatency.filter": "クエリのフィルター", + "xpack.slo.sloEdit.apmLatency.filter.placeholder": "インデックスで適用するカスタムフィルター", + "xpack.slo.sloEdit.apmLatency.serviceEnvironment": "サービス環境", + "xpack.slo.sloEdit.apmLatency.serviceEnvironment.placeholder": "環境を選択", + "xpack.slo.sloEdit.apmLatency.serviceName": "サービス名", + "xpack.slo.sloEdit.apmLatency.serviceName.placeholder": "APMサービスを選択", + "xpack.slo.sloEdit.apmLatency.threshold.placeholder": "しきい値(ミリ秒)", + "xpack.slo.sloEdit.apmLatency.threshold.tooltip": "SLOで「良好」または「成功」リクエストを定義するしきい値(ミリ秒)を構成します。", + "xpack.slo.sloEdit.apmLatency.transactionName": "トランザクション名", + "xpack.slo.sloEdit.apmLatency.transactionName.placeholder": "トランザクション名を選択", + "xpack.slo.sloEdit.apmLatency.transactionType": "トランザクションタイプ", + "xpack.slo.sloEdit.apmLatency.transactionType.placeholder": "トランザクションタイプを選択", + "xpack.slo.sloEdit.budgetingMethod.label": "予算設定方法", + "xpack.slo.sloEdit.budgetingMethod.tooltip": "出現に基づくSLOは、該当期間における、合計イベント数に対する良好なイベント数の比率を使用します。タイムスライスに基づくSLOは、該当期間における、合計タイムスライス数に対する良好なタイムスライス数の比率を使用します。", + "xpack.slo.sloEdit.calendarTimeWindow.monthly": "月ごと", + "xpack.slo.sloEdit.calendarTimeWindow.weekly": "週ごと", + "xpack.slo.sloEdit.cancelButton": "キャンセル", + "xpack.slo.sloEdit.createSloButton": "SLOの作成", + "xpack.slo.sloEdit.customKql.indexSelection.label": "インデックス", + "xpack.slo.sloEdit.dataPreviewChart.errorMessage": "現在のインジケーター設定は無効です", + "xpack.slo.sloEdit.dataPreviewChart.explanationMessage": "インジケーターフィールドに入力すると、現在のメトリックが可視化されます。", + "xpack.slo.sloEdit.dataPreviewChart.panelLabel": "SLIプレビュー", + "xpack.slo.sloEdit.dataPreviewChart.xTitle": "過去 1 時間", + "xpack.slo.sloEdit.dataPreviewChart.yTitle": "SLI", + "xpack.slo.sloEdit.definition.sliType": "SLIタイプを選択", + "xpack.slo.sloEdit.definition.title": "SLIを定義", + "xpack.slo.sloEdit.description.sloDescription": "説明", + "xpack.slo.sloEdit.description.sloDescriptionPlaceholder": "SLOの簡潔な説明", + "xpack.slo.sloEdit.description.sloName": "SLO名", + "xpack.slo.sloEdit.description.sloNamePlaceholder": "SLOの名前", + "xpack.slo.sloEdit.description.title": "SLOの説明", + "xpack.slo.sloEdit.editSloButton": "SLOの更新", + "xpack.slo.sloEdit.fieldSelector.all": "すべて", + "xpack.slo.sloEdit.groupBy.label": "パーティション", + "xpack.slo.sloEdit.groupBy.placeholder": "パーティション分割する任意のフィールドを選択", + "xpack.slo.sloEdit.groupBy.tooltip": "選択したフィールドの値ごとに個別のSLOを作成します。", + "xpack.slo.sloEdit.objectives.title": "目標を設定", + "xpack.slo.sloEdit.sliType.customKql.customFilter": "インデックスで適用するカスタムフィルター", + "xpack.slo.sloEdit.sliType.customKql.customFilter.tooltip": "このKQLクエリを使用して、一部の関連する条件でドキュメントをフィルタリングできます。", + "xpack.slo.sloEdit.sliType.customKql.goodQuery": "良いクエリ", + "xpack.slo.sloEdit.sliType.customKql.goodQuery.tooltip": "このKQLクエリは、SLOを計算する目的で、「良好」または「成功」と見なされるイベントのサブセットを返します。このクエリは、ステータスコード、エラー、メッセージ、または他の関連するフィールドなどの一部の関連する条件に基づいて、イベントをフィルタリングします。", + "xpack.slo.sloEdit.sliType.customKql.goodQueryPlaceholder": "良いイベントを定義", + "xpack.slo.sloEdit.sliType.customKql.queryFilter": "クエリのフィルター", + "xpack.slo.sloEdit.sliType.customKql.totalQuery": "合計クエリ", + "xpack.slo.sloEdit.sliType.customKql.totalQuery.tooltip": "このKQLクエリは、良好なイベントと問題があるイベントの両方を含む、SLO計算に関連するすべてのイベントを返します。", + "xpack.slo.sloEdit.sliType.customKql.totalQueryPlaceholder": "合計イベントを定義", + "xpack.slo.sloEdit.sliType.customMetric.addMetricAriaLabel": "メトリックを追加", + "xpack.slo.sloEdit.sliType.customMetric.addMetricLabel": "メトリックを追加", + "xpack.slo.sloEdit.sliType.customMetric.customFilter": "インデックスで適用するカスタムフィルター", + "xpack.slo.sloEdit.sliType.customMetric.customFilter.tooltip": "このKQLクエリを使用して、一部の関連する条件でドキュメントをフィルタリングできます。", + "xpack.slo.sloEdit.sliType.customMetric.deleteLabel": "メトリックを削除", + "xpack.slo.sloEdit.sliType.customMetric.equation.invalidCharacters": "等式フィールドでは次の文字のみを使用できます:A-Z、+、-、/、*、(、)、?、!、&、:、|、>、<、=", + "xpack.slo.sloEdit.sliType.customMetric.equationHelpText": "基本的な数式をサポートします。有効な文字:A-Z、+、-、/、*、(、)、?、!、&、:、|、>、<、=", + "xpack.slo.sloEdit.sliType.customMetric.equationLabel": "式", + "xpack.slo.sloEdit.sliType.customMetric.filterLabel": "フィルター", + "xpack.slo.sloEdit.sliType.customMetric.goodTitle": "良好なイベント数", + "xpack.slo.sloEdit.sliType.customMetric.metricField.placeholder": "メトリックフィールドを選択", + "xpack.slo.sloEdit.sliType.customMetric.metricLabel": "メトリック", + "xpack.slo.sloEdit.sliType.customMetric.queryFilter": "クエリのフィルター", + "xpack.slo.sloEdit.sliType.customMetric.totalEquation.tooltip": "これは基本的な数学ロジック(A + B / C)とブールロジック(A < B ?A :B)をサポートします。", + "xpack.slo.sloEdit.sliType.customMetric.totalMetric.tooltip": "このフィールドのデータは「sum」集計で集約されます。", + "xpack.slo.sloEdit.sliType.customMetric.totalTitle": "合計イベント数", + "xpack.slo.sloEdit.sliType.histogram.aggregation.placeholder": "集約を選択してください", + "xpack.slo.sloEdit.sliType.histogram.aggregationLabel": "アグリゲーション", + "xpack.slo.sloEdit.sliType.histogram.aggregationTooltip": "\"value count\"集約は、ヒストグラムフィールドの合計カウントを返します。Rangeは、ヒストグラムフィールドから、以下で定義された範囲内のカウントを返します。", + "xpack.slo.sloEdit.sliType.histogram.customFilter": "インデックスで適用するカスタムフィルター", + "xpack.slo.sloEdit.sliType.histogram.customFilter.tooltip": "このKQLクエリを使用して、一部の関連する条件でドキュメントをフィルタリングできます。", + "xpack.slo.sloEdit.sliType.histogram.fromLabel": "開始:", + "xpack.slo.sloEdit.sliType.histogram.fromTooltip": "\"from\"値は含まれます。", + "xpack.slo.sloEdit.sliType.histogram.goodTitle": "良好なイベント数", + "xpack.slo.sloEdit.sliType.histogram.kqlFilterLabel": "KQLフィルター", + "xpack.slo.sloEdit.sliType.histogram.metricField.placeholder": "ヒストグラムフィールドを選択", + "xpack.slo.sloEdit.sliType.histogram.metricLabel": "フィールド", + "xpack.slo.sloEdit.sliType.histogram.query.tooltip": "このKQLクエリは、このインジケーターのイベントのサブセットを返します。", + "xpack.slo.sloEdit.sliType.histogram.queryFilter": "クエリのフィルター", + "xpack.slo.sloEdit.sliType.histogram.rangeLabel": "範囲", + "xpack.slo.sloEdit.sliType.histogram.sourceTitle": "送信元", + "xpack.slo.sloEdit.sliType.histogram.toLabel": "終了:", + "xpack.slo.sloEdit.sliType.histogram.totalTitle": "合計イベント数", + "xpack.slo.sloEdit.sliType.histogram.toTooltip": "\"to\"値は含まれません。", + "xpack.slo.sloEdit.sliType.histogram.valueCountLabel": "値カウント", + "xpack.slo.sloEdit.tags.label": "タグ", + "xpack.slo.sloEdit.tags.placeholder": "タグを追加", + "xpack.slo.sloEdit.targetSlo.label": "目標 / SLO(%)", + "xpack.slo.sloEdit.targetSlo.tooltip": "SLOの目標(%)。", + "xpack.slo.sloEdit.timeSliceTarget.label": "タイムスライス目標(%)", + "xpack.slo.sloEdit.timeSliceTarget.tooltip": "スライスが良好か問題があるかどうかを判断するために使用される、個別のタイムスライス目標。", + "xpack.slo.sloEdit.timesliceWindow.label": "タイムスライス期間(分)", + "xpack.slo.sloEdit.timesliceWindow.tooltip": "データを評価するために使用されるタイムスライス期間サイズ。", + "xpack.slo.sloEdit.timestampField.label": "タイムスタンプフィールド", + "xpack.slo.sloEdit.timestampField.placeholder": "タイムスタンプフィールドを選択", + "xpack.slo.sloEdit.timeWindow.calendarAligned": "カレンダーが調整されました", + "xpack.slo.sloEdit.timeWindow.rolling": "ローリング", + "xpack.slo.sloEdit.timeWindowDuration.label": "期間", + "xpack.slo.sloEdit.timeWindowDuration.tooltip": "SLOを計算するために使用される時間枠期間。", + "xpack.slo.sloEdit.timeWindowType.label": "時間枠", + "xpack.slo.sloEdit.timeWindowType.tooltip": "ローリング時間枠とカレンダー時間枠のどちらかを選択します。", + "xpack.slo.sloList.welcomePrompt.buttonLabel": "SLOの作成", + "xpack.slo.sloList.welcomePrompt.getStartedMessage": "開始するには、まずSLOを作成します。", + "xpack.slo.sloList.welcomePrompt.learnMore": "詳細について", + "xpack.slo.sloList.welcomePrompt.learnMoreLink": "ドキュメントを読む", + "xpack.slo.sloList.welcomePrompt.messageParagraph1": "SLAを遂行するには、SLI(サービスレベル指標)やSLO(サービスレベル目標)など、ビジネス上重要なメトリックを計測する必要があります。", + "xpack.slo.sloList.welcomePrompt.messageParagraph2": "リアルタイムなインサイトを入手して、サービスのアップタイムや信頼性を手軽に利害関係者向けのレポートにまとめましょう。", + "xpack.slo.sloList.welcomePrompt.needLicenseMessage": "SLOを使用するには、Elastic Cloudサブスクリプションまたはプレミアムライセンスが必要です。", + "xpack.slo.sloList.welcomePrompt.signupForCloud": "Elastic Cloudに登録", + "xpack.slo.sloList.welcomePrompt.signupForLicense": "ライセンスを登録", + "xpack.slo.sloList.welcomePrompt.title": "SLOを追跡して遵守", + "xpack.slo.sloStatusBadge.degrading": "劣化", + "xpack.slo.sloStatusBadge.forecasted": "予測", + "xpack.slo.sloStatusBadge.healthy": "正常", + "xpack.slo.sloStatusBadge.noData": "データなし", + "xpack.slo.sloStatusBadge.noDataTooltip": "データが集約され、利用可能になるまでには時間がかかる場合があります。", + "xpack.slo.sloStatusBadge.violated": "違反", "xpack.observabilityAiAssistant.couldNotFindConversationContent": "id {conversationId}の会話が見つかりませんでした。会話が存在し、それにアクセスできることを確認してください。", "xpack.observabilityAiAssistant.executedFunctionFailureEvent": "関数{functionName}の実行に失敗しました", "xpack.observabilityAiAssistant.poweredByModel": "{model}で駆動", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 3ac57ca2847a3..7dc3322a2cb8f 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -28201,39 +28201,6 @@ "xpack.observability.profilingCo2PerKWHUiSettingDescription": "碳强度衡量您的数据中心电力的清洁程度。 \n 具体来说,它衡量在特定地区每消耗一千瓦时 (kWh) 电力导致的平均 CO2 排放量。\n 请使用云碳足迹 {datasheetLink} 根据您所在的地区更新此值。默认为美国东部(北弗吉尼亚州)。", "xpack.observability.rules.deleteConfirmationModal.deleteButtonLabel": "删除{title}", "xpack.observability.rules.deleteConfirmationModal.descriptionText": "您无法恢复删除的{title}。", - "xpack.observability.slo.alerting.burnRate.reason": "{actionGroupName}:过去 {longWindowDuration} 的消耗速度为 {longWindowBurnRate} 且过去 {shortWindowDuration} 为 {shortWindowBurnRate}。两个窗口超出 {burnRateThreshold} 时告警", - "xpack.observability.slo.alerting.burnRate.reasonForInstanceId": "{actionGroupName}:过去 {longWindowDuration} 的消耗速度为 {longWindowBurnRate},且对于 {instanceId},过去 {shortWindowDuration} 为 {shortWindowBurnRate}。两个窗口超出 {burnRateThreshold} 时告警", - "xpack.observability.slo.burnRate.breachedStatustSubtitle": "按照当前的速率,错误预算将在 {hour} 小时后耗尽。", - "xpack.observability.slo.burnRate.threshold": "阈值为 {threshold}x", - "xpack.observability.slo.create.errorNotification": "创建 {name} 时出现问题", - "xpack.observability.slo.deleteConfirmationModal.title": "删除 {name}?", - "xpack.observability.slo.duration.day": "{duration, plural, other {# 天}}", - "xpack.observability.slo.duration.hour": "{duration, plural, other {# 小时}}", - "xpack.observability.slo.duration.minute": "{duration, plural, other {# 分钟}}", - "xpack.observability.slo.duration.month": "{duration, plural, other {# 个月}}", - "xpack.observability.slo.duration.week": "{duration, plural, other {# 周}}", - "xpack.observability.slo.indicatorTypeBadge.exploreInApm": "查看 {service} 详情", - "xpack.observability.slo.rules.burnRate.errors.invalidThresholdValue": "消耗速度阈值必须介于 1 和 {maxBurnRate} 之间。", - "xpack.observability.slo.rules.groupByMessage": "已使用分区在“{groupByField}”上创建您选定的 SLO。此规则将监测在分区字段中发现的每个实例并为其生成告警。", - "xpack.observability.slo.rules.longWindowDuration.tooltip": "在其间计算消耗速度的回顾期。将使用 {shortWindowDuration} 分钟的较短回顾期(1/12 的回顾期)以便更快恢复", - "xpack.observability.slo.slo.activeAlertsBadge.label": "{count, plural, other {# 个告警}}", - "xpack.observability.slo.slo.delete.errorNotification": "无法删除{name}", - "xpack.observability.slo.slo.delete.successNotification": "已删除 {name}", - "xpack.observability.slo.slo.stats.objective": "{objective} 目标", - "xpack.observability.slo.slo.timeWindow.calendar": "{elapsed}/{total} 天", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.duration": "过去 {duration}", - "xpack.observability.slo.sloDetails.overview.apmSource.environmentLabel": "环境:{value}", - "xpack.observability.slo.sloDetails.overview.apmSource.serviceLabel": "服务:{value}", - "xpack.observability.slo.sloDetails.overview.apmSource.transactionNameLabel": "事务名称:{value}", - "xpack.observability.slo.sloDetails.overview.apmSource.transactionTypeLabel": "事务类型:{value}", - "xpack.observability.slo.sloDetails.overview.calendarAlignedTimeWindow": "{duration} 日历已对齐", - "xpack.observability.slo.sloDetails.overview.observedValueSubtitle": "{value}(目标为 {objective})", - "xpack.observability.slo.sloDetails.overview.rollingTimeWindow": "{duration} 滚动", - "xpack.observability.slo.sloDetails.overview.timeslicesBudgetingMethodDetails": "{duration} 切片,{target} 目标", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.duration": "过去 {duration}", - "xpack.observability.slo.sloEdit.rollingTimeWindow.days": "{number} 天", - "xpack.observability.slo.update.errorNotification": "更新 {name} 时出现问题", - "xpack.observability.slo.update.successNotification": "成功更新 {name}", "xpack.observability.syntheticsThrottlingEnabledExperimentDescription": "在 Synthetics 监测配置中启用限制设置。请注意,即使该设置处于活动状态,可能仍然无法对您的监测应用限制。仅限内部使用。{link}", "xpack.observability.transactionRateLabel": "{value} tpm", "xpack.observability.ux.coreVitals.averageMessage": " 且小于 {bad}", @@ -28302,11 +28269,6 @@ "xpack.observability.breadcrumbs.alertsLinkText": "告警", "xpack.observability.breadcrumbs.overviewLinkText": "概览", "xpack.observability.breadcrumbs.rulesLinkText": "规则", - "xpack.observability.breadcrumbs.sloCreateLabel": "创建", - "xpack.observability.breadcrumbs.sloDetailsLinkText": "详情", - "xpack.observability.breadcrumbs.sloEditLabel": "编辑", - "xpack.observability.breadcrumbs.sloLabel": "SLO", - "xpack.observability.breadcrumbs.slosLinkText": "SLO", "xpack.observability.cases.caseFeatureNoPermissionsMessage": "要查看案例,必须对 Kibana 工作区中的案例功能有权限。有关详细信息,请联系您的 Kibana 管理员。", "xpack.observability.cases.caseFeatureNoPermissionsTitle": "需要 Kibana 功能权限", "xpack.observability.cases.caseView.goToDocumentationButton": "查看文档", @@ -28383,7 +28345,6 @@ "xpack.observability.customThreshold.rule.viewInAppUrlActionVariableDescription": "链接到告警源", "xpack.observability.defaultApmServiceEnvironment": "默认服务环境", "xpack.observability.defaultApmServiceEnvironmentDescription": "为 APM 应用设置默认环境。如果留空,默认情况下将显示所有环境中的数据。", - "xpack.observability.embeddableSlo.config.confirmButtonLabel": "确认配置", "xpack.observability.emptySection.apps.alert.description": "检测 Observability 内的复杂条件,并在满足那些条件时触发操作。", "xpack.observability.emptySection.apps.alert.link": "创建规则", "xpack.observability.emptySection.apps.alert.title": "未找到告警。", @@ -28422,7 +28383,6 @@ "xpack.observability.featureRegistry.deleteSubFeatureDetails": "删除案例和注释", "xpack.observability.featureRegistry.deleteSubFeatureName": "删除", "xpack.observability.featureRegistry.linkObservabilityTitle": "案例", - "xpack.observability.featureRegistry.linkSloTitle": "SLO", "xpack.observability.feedbackMenu.appName": "Observability", "xpack.observability.formatters.hoursTimeUnitLabel": "h", "xpack.observability.formatters.hoursTimeUnitLabelExtended": "小时", @@ -28554,246 +28514,6 @@ "xpack.observability.section.errorPanel": "尝试提取数据时发生错误。请重试", "xpack.observability.serviceGroupMaxServicesUiSettingDescription": "限制给定服务组中服务的数量", "xpack.observability.serviceGroupMaxServicesUiSettingName": "服务组中的最大服务数", - "xpack.observability.slo.alerting.alertDetailsUrlDescription": "链接到告警故障排除视图获取进一步的上下文和详情。如果未配置 server.publicBaseUrl,这将为空字符串。", - "xpack.observability.slo.alerting.burnRate.alertAction": "紧急", - "xpack.observability.slo.alerting.burnRate.highPriorityAction": "高", - "xpack.observability.slo.alerting.burnRate.lowPriorityAction": "低", - "xpack.observability.slo.alerting.burnRate.mediumPriorityAction": "中", - "xpack.observability.slo.alerting.reasonDescription": "告警原因的简洁描述", - "xpack.observability.slo.alerting.sloIdDescription": "SLO 唯一标识符。", - "xpack.observability.slo.alerting.sloInstanceIdDescription": "SLO 实例 ID。", - "xpack.observability.slo.alerting.sloNameDescription": "SLO 名称。", - "xpack.observability.slo.alerting.thresholdDescription": "消耗速度阈值。", - "xpack.observability.slo.alerting.timestampDescription": "检测到告警时的时间戳。", - "xpack.observability.slo.alerting.viewInAppUrlDescription": "SLO 详情页面的 URL,以帮助进行进一步调查。", - "xpack.observability.slo.alerting.windowDescription": "带有关联的消耗速度值的窗口持续时间。", - "xpack.observability.slo.budgetingMethod.occurrences": "发生次数", - "xpack.observability.slo.budgetingMethod.timeslices": "时间片", - "xpack.observability.slo.burnRate.breachedStatustTitle": "已超出临界值", - "xpack.observability.slo.burnRate.noDataStatusSubtitle": "等待更多数据。", - "xpack.observability.slo.burnRate.noDataStatusTitle": "无值", - "xpack.observability.slo.burnRate.okStatusSubtitle": "没有错误预算耗尽风险。", - "xpack.observability.slo.burnRate.okStatusTitle": "可接受的值", - "xpack.observability.slo.burnRate.technicalPreviewBadgeDescription": "此功能处于技术预览状态,可能会有所更改,或在未来版本中移除。设计和代码相对于正式发行版功能还不够成熟,将按原样提供,且不提供任何保证。技术预览功能不受正式发行版功能的支持服务水平协议约束。", - "xpack.observability.slo.burnRate.technicalPreviewBadgeTitle": "技术预览", - "xpack.observability.slo.burnRate.timeRangeBtnLegend": "选择时间范围", - "xpack.observability.slo.burnRate.title": "消耗速度", - "xpack.observability.slo.deleteConfirmationModal.cancelButtonLabel": "取消", - "xpack.observability.slo.deleteConfirmationModal.deleteButtonLabel": "删除", - "xpack.observability.slo.deleteConfirmationModal.descriptionText": "此 SLO 删除后无法恢复。", - "xpack.observability.slo.duration.daily": "每日", - "xpack.observability.slo.duration.hourly": "每小时", - "xpack.observability.slo.duration.minutely": "每分钟", - "xpack.observability.slo.duration.monthly": "每月", - "xpack.observability.slo.duration.weekly": "每周", - "xpack.observability.slo.globalDiagnosis.errorNotification": "您没有适当权限,无法使用此功能。", - "xpack.observability.slo.indicators.apmAvailability": "APM 可用性", - "xpack.observability.slo.indicators.apmLatency": "APM 延迟", - "xpack.observability.slo.indicators.customKql": "定制 KQL", - "xpack.observability.slo.indicators.customMetric": "定制指标", - "xpack.observability.slo.indicators.histogram": "直方图指标", - "xpack.observability.slo.item.actions.button": "操作", - "xpack.observability.slo.item.actions.clone": "克隆", - "xpack.observability.slo.item.actions.createRule": "创建新告警规则", - "xpack.observability.slo.item.actions.delete": "删除", - "xpack.observability.slo.item.actions.details": "详情", - "xpack.observability.slo.item.actions.edit": "编辑", - "xpack.observability.slo.item.actions.manageRules": "管理规则", - "xpack.observability.slo.list.emptyMessage": "没有匹配您的条件的结果。", - "xpack.observability.slo.list.emptyTitle": "无结果", - "xpack.observability.slo.list.errorMessage": "加载 SLO 时出错。请联系您的管理员寻求帮助。", - "xpack.observability.slo.list.errorNotification": "提取 SLO 时出现问题", - "xpack.observability.slo.list.errorTitle": "无法加载 SLO", - "xpack.observability.slo.list.search": "搜索您的 SLO......", - "xpack.observability.slo.list.sortBy.errorBudgetConsumed": "已消耗错误预算", - "xpack.observability.slo.list.sortBy.errorBudgetRemaining": "剩余错误预算", - "xpack.observability.slo.list.sortBy.sliValue": "SLI 值", - "xpack.observability.slo.list.sortBy.sloStatus": "SLO 状态", - "xpack.observability.slo.rules.actionGroupSelectorLabel": "操作组", - "xpack.observability.slo.rules.addWindowAriaLabel": "添加窗口", - "xpack.observability.slo.rules.addWIndowLabel": "添加窗口", - "xpack.observability.slo.rules.burnRate.defaultActionMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\} 为活动状态,条件如下:\n\n- SLO:\\{\\{context.sloName\\}\\}'\n- 过去 \\{\\{context.longWindow.duration\\}\\} 的消耗速度为 \\{\\{context.longWindow.burnRate\\}\\}\n- 过去 \\{\\{context.shortWindow.duration\\}\\} 的消耗速度为 \\{\\{context.shortWindow.burnRate\\}\\}\n- Threshold: \\{\\{context.burnRateThreshold\\}\\}\n\n[查看告警详情](\\{\\{context.alertDetailsUrl\\}\\})\n", - "xpack.observability.slo.rules.burnRate.defaultRecoveryMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\} 已恢复。\n\n- SLO:\\{\\{context.sloName\\}\\}'\n- 过去 \\{\\{context.longWindow.duration\\}\\} 的消耗速度为 \\{\\{context.longWindow.burnRate\\}\\}\n- 过去 \\{\\{context.shortWindow.duration\\}\\} 的消耗速度为 \\{\\{context.shortWindow.burnRate\\}\\}\n- Threshold: \\{\\{context.burnRateThreshold\\}\\}\n\n[查看告警详情](\\{\\{context.alertDetailsUrl\\}\\})\n", - "xpack.observability.slo.rules.burnRate.description": "在定义的期间内 SLO 消耗速度过高时告警。", - "xpack.observability.slo.rules.burnRate.errors.burnRateThresholdRequired": "“消耗速度阈值”必填。", - "xpack.observability.slo.rules.burnRate.errors.sloRequired": "“SLO”必填。", - "xpack.observability.slo.rules.burnRate.errors.windowDurationRequired": "“回顾期”必填。", - "xpack.observability.slo.rules.burnRate.name": "SLO 消耗速度", - "xpack.observability.slo.rules.burnRate.rowLabel": "消耗速度阈值", - "xpack.observability.slo.rules.burnRate.tooltip": "消耗速度是指服务在回顾期内耗用错误预算的速度。", - "xpack.observability.slo.rules.deleteWindowLabel": "删除窗口", - "xpack.observability.slo.rules.longWindow.errorText": "回顾期必须介于 1 到 72 小时之间。", - "xpack.observability.slo.rules.longWindow.rowLabel": "回顾(小时)", - "xpack.observability.slo.rules.longWindow.valueLabel": "回顾期(小时)", - "xpack.observability.slo.rules.sloSelector.ariaLabel": "SLO", - "xpack.observability.slo.rules.sloSelector.placeholder": "选择 SLO", - "xpack.observability.slo.rules.sloSelector.rowLabel": "SLO", - "xpack.observability.slo.slo.activeAlertsBadge.ariaLabel": "活动告警徽章", - "xpack.observability.slo.slo.item.actions.clone": "克隆", - "xpack.observability.slo.slo.item.actions.delete": "删除", - "xpack.observability.slo.slo.rulesBadge.popover": "尚未为此 SLO 配置任何规则。超出 SLO 时,您不会收到告警。", - "xpack.observability.slo.slo.stats.budgetRemaining": "剩余预算", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.chartTitle": "剩余错误预算", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.remaining": "剩余", - "xpack.observability.slo.sloDetails.errorBudgetChartPanel.title": "错误预算逐渐减少", - "xpack.observability.slo.sloDetails.headerControl.actions": "操作", - "xpack.observability.slo.sloDetails.headerControl.createBurnRateRule": "创建新告警规则", - "xpack.observability.slo.sloDetails.headerControl.edit": "编辑", - "xpack.observability.slo.sloDetails.headerControl.manageRules": "管理规则", - "xpack.observability.slo.sloDetails.headerTitle.createdMessage": "创建日期", - "xpack.observability.slo.sloDetails.headerTitle.lastUpdatedMessage": "上次更新时间", - "xpack.observability.slo.sloDetails.overview.apmSource": "APM 源", - "xpack.observability.slo.sloDetails.overview.budgetingMethodTitle": "预算编制方法", - "xpack.observability.slo.sloDetails.overview.descriptionTitle": "描述", - "xpack.observability.slo.sloDetails.overview.indicatorTypeTitle": "指标类型", - "xpack.observability.slo.sloDetails.overview.observedValueTitle": "观察值", - "xpack.observability.slo.sloDetails.overview.tagsTitle": "标签", - "xpack.observability.slo.sloDetails.overview.timeWindowTitle": "时间窗口", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.chartTitle": "SLI 值", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.current": "观察值", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.objective": "目标", - "xpack.observability.slo.sloDetails.sliHistoryChartPanel.title": "历史 SLI", - "xpack.observability.slo.sloDetails.tab.alertsLabel": "告警", - "xpack.observability.slo.sloDetails.tab.overviewLabel": "概览", - "xpack.observability.slo.sloEdit.apm.filter.tooltip": "此 KQL 查询用于根据该 SLO 的某些相关条件筛选 APM 指标。", - "xpack.observability.slo.sloEdit.apm.serviceName.tooltip": "这是受该 SLO 监测的 APM 服务。", - "xpack.observability.slo.sloEdit.apmAvailability.serviceEnvironment": "服务环境", - "xpack.observability.slo.sloEdit.apmAvailability.serviceEnvironment.placeholder": "选择环境", - "xpack.observability.slo.sloEdit.apmAvailability.serviceName": "服务名称", - "xpack.observability.slo.sloEdit.apmAvailability.serviceName.placeholder": "选择 APM 服务", - "xpack.observability.slo.sloEdit.apmAvailability.transactionName": "事务名称", - "xpack.observability.slo.sloEdit.apmAvailability.transactionName.placeholder": "选择事务名称", - "xpack.observability.slo.sloEdit.apmAvailability.transactionType": "事务类型", - "xpack.observability.slo.sloEdit.apmAvailability.transactionType.placeholder": "选择事务类型", - "xpack.observability.slo.sloEdit.apmLatency.filter": "查询筛选", - "xpack.observability.slo.sloEdit.apmLatency.filter.placeholder": "要对索引应用的定制筛选", - "xpack.observability.slo.sloEdit.apmLatency.serviceEnvironment": "服务环境", - "xpack.observability.slo.sloEdit.apmLatency.serviceEnvironment.placeholder": "选择环境", - "xpack.observability.slo.sloEdit.apmLatency.serviceName": "服务名称", - "xpack.observability.slo.sloEdit.apmLatency.serviceName.placeholder": "选择 APM 服务", - "xpack.observability.slo.sloEdit.apmLatency.threshold.placeholder": "阈值 (ms)", - "xpack.observability.slo.sloEdit.apmLatency.threshold.tooltip": "配置为 SLO 定义“良好”或“成功”请求的阈值(毫秒)。", - "xpack.observability.slo.sloEdit.apmLatency.transactionName": "事务名称", - "xpack.observability.slo.sloEdit.apmLatency.transactionName.placeholder": "选择事务名称", - "xpack.observability.slo.sloEdit.apmLatency.transactionType": "事务类型", - "xpack.observability.slo.sloEdit.apmLatency.transactionType.placeholder": "选择事务类型", - "xpack.observability.slo.sloEdit.budgetingMethod.label": "预算编制方法", - "xpack.observability.slo.sloEdit.budgetingMethod.tooltip": "基于发生次数的 SLO 使用时间窗口内良好事件数与事件总数的比率。基于时间片的 SLO 使用时间窗口内良好时间片与时间片总数的比率。", - "xpack.observability.slo.sloEdit.calendarTimeWindow.monthly": "每月", - "xpack.observability.slo.sloEdit.calendarTimeWindow.weekly": "每周", - "xpack.observability.slo.sloEdit.cancelButton": "取消", - "xpack.observability.slo.sloEdit.createSloButton": "创建 SLO", - "xpack.observability.slo.sloEdit.customKql.indexSelection.label": "索引", - "xpack.observability.slo.sloEdit.dataPreviewChart.errorMessage": "当前指标设置无效", - "xpack.observability.slo.sloEdit.dataPreviewChart.explanationMessage": "填写指标字段以查看当前指标的可视化", - "xpack.observability.slo.sloEdit.dataPreviewChart.panelLabel": "SLI 预览", - "xpack.observability.slo.sloEdit.dataPreviewChart.xTitle": "过去一小时", - "xpack.observability.slo.sloEdit.dataPreviewChart.yTitle": "SLI", - "xpack.observability.slo.sloEdit.definition.sliType": "选择 SLI 类型", - "xpack.observability.slo.sloEdit.definition.title": "定义 SLI", - "xpack.observability.slo.sloEdit.description.sloDescription": "描述", - "xpack.observability.slo.sloEdit.description.sloDescriptionPlaceholder": "SLO 的简短描述", - "xpack.observability.slo.sloEdit.description.sloName": "SLO 名称", - "xpack.observability.slo.sloEdit.description.sloNamePlaceholder": "SLO 的名称", - "xpack.observability.slo.sloEdit.description.title": "描述 SLO", - "xpack.observability.slo.sloEdit.editSloButton": "更新 SLO", - "xpack.observability.slo.sloEdit.fieldSelector.all": "全部", - "xpack.observability.slo.sloEdit.groupBy.label": "分区依据", - "xpack.observability.slo.sloEdit.groupBy.placeholder": "选择要依据其分区的可选字段", - "xpack.observability.slo.sloEdit.groupBy.tooltip": "为选定字段中的每个值创建单个 SLO。", - "xpack.observability.slo.sloEdit.objectives.title": "设定目标", - "xpack.observability.slo.sloEdit.sliType.customKql.customFilter": "要对索引应用的定制筛选", - "xpack.observability.slo.sloEdit.sliType.customKql.customFilter.tooltip": "此 KQL 查询可用于基于某些相关条件来筛选文档。", - "xpack.observability.slo.sloEdit.sliType.customKql.goodQuery": "良好查询", - "xpack.observability.slo.sloEdit.sliType.customKql.goodQuery.tooltip": "此 KQL 查询应返回用于计算 SLO 时被视为“良好”或“成功”的事件的子集。此查询应基于某些相关条件(如状态代码、错误消息或其他相关字段)筛选事件。", - "xpack.observability.slo.sloEdit.sliType.customKql.goodQueryPlaceholder": "定义良好事件", - "xpack.observability.slo.sloEdit.sliType.customKql.queryFilter": "查询筛选", - "xpack.observability.slo.sloEdit.sliType.customKql.totalQuery": "查询总数", - "xpack.observability.slo.sloEdit.sliType.customKql.totalQuery.tooltip": "此 KQL 查询应返回与 SLO 计算相关的所有事件,包括良好和不良事件。", - "xpack.observability.slo.sloEdit.sliType.customKql.totalQueryPlaceholder": "定义事件总数", - "xpack.observability.slo.sloEdit.sliType.customMetric.addMetricAriaLabel": "添加指标", - "xpack.observability.slo.sloEdit.sliType.customMetric.addMetricLabel": "添加指标", - "xpack.observability.slo.sloEdit.sliType.customMetric.customFilter": "要对索引应用的定制筛选", - "xpack.observability.slo.sloEdit.sliType.customMetric.customFilter.tooltip": "此 KQL 查询可用于基于某些相关条件来筛选文档。", - "xpack.observability.slo.sloEdit.sliType.customMetric.deleteLabel": "删除指标", - "xpack.observability.slo.sloEdit.sliType.customMetric.equation.invalidCharacters": "方程字段仅支持以下字符:A-Z、+、-、/、*、(、)、?、!、&、:、|、>、<、=", - "xpack.observability.slo.sloEdit.sliType.customMetric.equationHelpText": "支持基本数学方程,有效字符包括:A-Z、+、-、/、*、(、)、?、!、&、:、|、>、<、=", - "xpack.observability.slo.sloEdit.sliType.customMetric.equationLabel": "方程", - "xpack.observability.slo.sloEdit.sliType.customMetric.filterLabel": "筛选", - "xpack.observability.slo.sloEdit.sliType.customMetric.goodTitle": "良好事件", - "xpack.observability.slo.sloEdit.sliType.customMetric.metricField.placeholder": "选择指标字段", - "xpack.observability.slo.sloEdit.sliType.customMetric.metricLabel": "指标", - "xpack.observability.slo.sloEdit.sliType.customMetric.queryFilter": "查询筛选", - "xpack.observability.slo.sloEdit.sliType.customMetric.totalEquation.tooltip": "这支持基本数学 (A + B / C) 和布尔逻辑 (A < B ?A :B)。", - "xpack.observability.slo.sloEdit.sliType.customMetric.totalMetric.tooltip": "来自该字段的此类数据将使用“求和”聚合进行汇总。", - "xpack.observability.slo.sloEdit.sliType.customMetric.totalTitle": "事件合计", - "xpack.observability.slo.sloEdit.sliType.histogram.aggregation.placeholder": "选择聚合", - "xpack.observability.slo.sloEdit.sliType.histogram.aggregationLabel": "聚合", - "xpack.observability.slo.sloEdit.sliType.histogram.aggregationTooltip": "“值计数”聚合将返回直方图字段的总计数。范围将返回在下面定义的范围内的直方图字段中的计数。", - "xpack.observability.slo.sloEdit.sliType.histogram.customFilter": "要对索引应用的定制筛选", - "xpack.observability.slo.sloEdit.sliType.histogram.customFilter.tooltip": "此 KQL 查询可用于基于某些相关条件来筛选文档。", - "xpack.observability.slo.sloEdit.sliType.histogram.fromLabel": "自", - "xpack.observability.slo.sloEdit.sliType.histogram.fromTooltip": "“from”值具有包容性。", - "xpack.observability.slo.sloEdit.sliType.histogram.goodTitle": "良好事件", - "xpack.observability.slo.sloEdit.sliType.histogram.kqlFilterLabel": "KQL 筛选", - "xpack.observability.slo.sloEdit.sliType.histogram.metricField.placeholder": "选择直方图字段", - "xpack.observability.slo.sloEdit.sliType.histogram.metricLabel": "字段", - "xpack.observability.slo.sloEdit.sliType.histogram.query.tooltip": "此 KQL 查询应返回该指标的事件的子集。", - "xpack.observability.slo.sloEdit.sliType.histogram.queryFilter": "查询筛选", - "xpack.observability.slo.sloEdit.sliType.histogram.rangeLabel": "范围", - "xpack.observability.slo.sloEdit.sliType.histogram.sourceTitle": "源", - "xpack.observability.slo.sloEdit.sliType.histogram.toLabel": "至", - "xpack.observability.slo.sloEdit.sliType.histogram.totalTitle": "事件合计", - "xpack.observability.slo.sloEdit.sliType.histogram.toTooltip": "“to”值不具有包容性。", - "xpack.observability.slo.sloEdit.sliType.histogram.valueCountLabel": "值计数", - "xpack.observability.slo.sloEdit.tags.label": "标签", - "xpack.observability.slo.sloEdit.tags.placeholder": "添加标签", - "xpack.observability.slo.sloEdit.targetSlo.label": "目标/SLO (%)", - "xpack.observability.slo.sloEdit.targetSlo.tooltip": "SLO 的目标值 (%)。", - "xpack.observability.slo.sloEdit.timeSliceTarget.label": "时间片目标 (%)", - "xpack.observability.slo.sloEdit.timeSliceTarget.tooltip": "用于确定切片是良好还是不良的单个时间片目标。", - "xpack.observability.slo.sloEdit.timesliceWindow.label": "时间片窗口(分钟)", - "xpack.observability.slo.sloEdit.timesliceWindow.tooltip": "用于评估接收的数据的时间片窗口大小。", - "xpack.observability.slo.sloEdit.timestampField.label": "时间戳字段", - "xpack.observability.slo.sloEdit.timestampField.placeholder": "选择时间戳字段", - "xpack.observability.slo.sloEdit.timeWindow.calendarAligned": "日历已对齐", - "xpack.observability.slo.sloEdit.timeWindow.rolling": "滚动", - "xpack.observability.slo.sloEdit.timeWindowDuration.label": "持续时间", - "xpack.observability.slo.sloEdit.timeWindowDuration.tooltip": "用于在其间计算 SLO 的时间窗口持续时间。", - "xpack.observability.slo.sloEdit.timeWindowType.label": "时间窗口", - "xpack.observability.slo.sloEdit.timeWindowType.tooltip": "选择滚动或日历对齐窗口。", - "xpack.observability.slo.sloList.welcomePrompt.buttonLabel": "创建 SLO", - "xpack.observability.slo.sloList.welcomePrompt.getStartedMessage": "要开始使用,请创建您的首个 SLO。", - "xpack.observability.slo.sloList.welcomePrompt.learnMore": "希望了解详情?", - "xpack.observability.slo.sloList.welcomePrompt.learnMoreLink": "阅读文档", - "xpack.observability.slo.sloList.welcomePrompt.messageParagraph1": "衡量对业务十分重要的关键指标,如服务级别指标和服务级别目标 (SLI/SLO),努力实现 SLA。", - "xpack.observability.slo.sloList.welcomePrompt.messageParagraph2": "通过实时洞察,轻松向利益相关者报告服务的运行时间和可靠性。", - "xpack.observability.slo.sloList.welcomePrompt.needLicenseMessage": "您需要 Elastic Cloud 订阅或白金级许可证才能使用 SLO。", - "xpack.observability.slo.sloList.welcomePrompt.signupForCloud": "注册 Elastic Cloud", - "xpack.observability.slo.sloList.welcomePrompt.signupForLicense": "注册许可证", - "xpack.observability.slo.sloList.welcomePrompt.title": "跟踪和实现 SLO", - "xpack.observability.slo.sloStatusBadge.degrading": "正在降级", - "xpack.observability.slo.sloStatusBadge.forecasted": "已预测", - "xpack.observability.slo.sloStatusBadge.healthy": "运行正常", - "xpack.observability.slo.sloStatusBadge.noData": "无数据", - "xpack.observability.slo.sloStatusBadge.noDataTooltip": "在聚合数据并且数据可用之前,可能需要花费一些时间。", - "xpack.observability.slo.sloStatusBadge.violated": "已违规", - "xpack.observability.sloCreatePageTitle": "创建新 SLO", - "xpack.observability.sloEditPageTitle": "编辑 SLO", - "xpack.observability.sloEmbeddable.config.cancelButtonLabel": "取消", - "xpack.observability.sloEmbeddable.config.errors.sloRequired": "“SLO”必填。", - "xpack.observability.sloEmbeddable.config.sloSelector.ariaLabel": "SLO", - "xpack.observability.sloEmbeddable.config.sloSelector.headerTitle": "SLO 配置", - "xpack.observability.sloEmbeddable.config.sloSelector.placeholder": "选择 SLO", - "xpack.observability.sloEmbeddable.description": "获取 SLO 运行状况概览", - "xpack.observability.sloEmbeddable.displayName": "SLO 概览", - "xpack.observability.sloEmbeddable.displayTitle": "SLO 概览", - "xpack.observability.sloEmbeddable.overview.sloNotFoundText": "SLO 已删除。您可以放心从仪表板中删除小组件。", - "xpack.observability.slos.sloDetails.headerControl.exploreInApm": "服务详情", - "xpack.observability.slosLinkTitle": "SLO", - "xpack.observability.slosPage.autoRefreshButtonLabel": "自动刷新", - "xpack.observability.slosPage.stopRefreshingButtonLabel": "停止刷新", - "xpack.observability.slosPageTitle": "SLO", "xpack.observability.status.dataAvailable": "数据可用。", "xpack.observability.status.dataAvailableTitle": "数据可用于", "xpack.observability.status.learnMoreButton": "了解详情", @@ -28857,6 +28577,260 @@ "xpack.observability.ux.dashboard.webCoreVitals.help": "详细了解", "xpack.observability.ux.dashboard.webCoreVitals.helpAriaLabel": "帮助", "xpack.observability.ux.service.help": "选择流量最高的 RUM 服务", + "xpack.slo.alerting.burnRate.reason": "{actionGroupName}:过去 {longWindowDuration} 的消耗速度为 {longWindowBurnRate} 且过去 {shortWindowDuration} 为 {shortWindowBurnRate}。两个窗口超出 {burnRateThreshold} 时告警", + "xpack.slo.alerting.burnRate.reasonForInstanceId": "{actionGroupName}:过去 {longWindowDuration} 的消耗速度为 {longWindowBurnRate},且对于 {instanceId},过去 {shortWindowDuration} 为 {shortWindowBurnRate}。两个窗口超出 {burnRateThreshold} 时告警", + "xpack.slo.burnRate.breachedStatustSubtitle": "按照当前的速率,错误预算将在 {hour} 小时后耗尽。", + "xpack.slo.burnRate.threshold": "阈值为 {threshold}x", + "xpack.slo.create.errorNotification": "创建 {name} 时出现问题", + "xpack.slo.deleteConfirmationModal.title": "删除 {name}?", + "xpack.slo.duration.day": "{duration, plural, other {# 天}}", + "xpack.slo.duration.hour": "{duration, plural, other {# 小时}}", + "xpack.slo.duration.minute": "{duration, plural, other {# 分钟}}", + "xpack.slo.duration.month": "{duration, plural, other {# 个月}}", + "xpack.slo.duration.week": "{duration, plural, other {# 周}}", + "xpack.slo.indicatorTypeBadge.exploreInApm": "查看 {service} 详情", + "xpack.slo.rules.burnRate.errors.invalidThresholdValue": "消耗速度阈值必须介于 1 和 {maxBurnRate} 之间。", + "xpack.slo.rules.groupByMessage": "已使用分区在“{groupByField}”上创建您选定的 SLO。此规则将监测在分区字段中发现的每个实例并为其生成告警。", + "xpack.slo.rules.longWindowDuration.tooltip": "在其间计算消耗速度的回顾期。将使用 {shortWindowDuration} 分钟的较短回顾期(1/12 的回顾期)以便更快恢复", + "xpack.slo.slo.activeAlertsBadge.label": "{count, plural, other {# 个告警}}", + "xpack.slo.slo.delete.errorNotification": "无法删除{name}", + "xpack.slo.slo.delete.successNotification": "已删除 {name}", + "xpack.slo.slo.timeWindow.calendar": "{elapsed}/{total} 天", + "xpack.slo.sloDetails.errorBudgetChartPanel.duration": "过去 {duration}", + "xpack.slo.sloDetails.overview.apmSource.environmentLabel": "环境:{value}", + "xpack.slo.sloDetails.overview.apmSource.serviceLabel": "服务:{value}", + "xpack.slo.sloDetails.overview.apmSource.transactionNameLabel": "事务名称:{value}", + "xpack.slo.sloDetails.overview.apmSource.transactionTypeLabel": "事务类型:{value}", + "xpack.slo.sloDetails.overview.calendarAlignedTimeWindow": "{duration} 日历已对齐", + "xpack.slo.sloDetails.overview.observedValueSubtitle": "{value}(目标为 {objective})", + "xpack.slo.sloDetails.overview.rollingTimeWindow": "{duration} 滚动", + "xpack.slo.sloDetails.overview.timeslicesBudgetingMethodDetails": "{duration} 切片,{target} 目标", + "xpack.slo.sloDetails.sliHistoryChartPanel.duration": "过去 {duration}", + "xpack.slo.sloEdit.rollingTimeWindow.days": "{number} 天", + "xpack.slo.update.errorNotification": "更新 {name} 时出现问题", + "xpack.slo.update.successNotification": "成功更新 {name}", + "xpack.slo.alerting.alertDetailsUrlDescription": "链接到告警故障排除视图获取进一步的上下文和详情。如果未配置 server.publicBaseUrl,这将为空字符串。", + "xpack.slo.alerting.burnRate.alertAction": "紧急", + "xpack.slo.alerting.burnRate.highPriorityAction": "高", + "xpack.slo.alerting.burnRate.lowPriorityAction": "低", + "xpack.slo.alerting.burnRate.mediumPriorityAction": "中", + "xpack.slo.alerting.reasonDescription": "告警原因的简洁描述", + "xpack.slo.alerting.sloIdDescription": "SLO 唯一标识符。", + "xpack.slo.alerting.sloInstanceIdDescription": "SLO 实例 ID。", + "xpack.slo.alerting.sloNameDescription": "SLO 名称。", + "xpack.slo.alerting.thresholdDescription": "消耗速度阈值。", + "xpack.slo.alerting.timestampDescription": "检测到告警时的时间戳。", + "xpack.slo.alerting.viewInAppUrlDescription": "SLO 详情页面的 URL,以帮助进行进一步调查。", + "xpack.slo.alerting.windowDescription": "带有关联的消耗速度值的窗口持续时间。", + "xpack.slo.budgetingMethod.occurrences": "发生次数", + "xpack.slo.budgetingMethod.timeslices": "时间片", + "xpack.slo.burnRate.breachedStatustTitle": "已超出临界值", + "xpack.slo.burnRate.noDataStatusSubtitle": "等待更多数据。", + "xpack.slo.burnRate.noDataStatusTitle": "无值", + "xpack.slo.burnRate.okStatusSubtitle": "没有错误预算耗尽风险。", + "xpack.slo.burnRate.okStatusTitle": "可接受的值", + "xpack.slo.burnRate.technicalPreviewBadgeDescription": "此功能处于技术预览状态,可能会有所更改,或在未来版本中移除。设计和代码相对于正式发行版功能还不够成熟,将按原样提供,且不提供任何保证。技术预览功能不受正式发行版功能的支持服务水平协议约束。", + "xpack.slo.burnRate.technicalPreviewBadgeTitle": "技术预览", + "xpack.slo.burnRate.timeRangeBtnLegend": "选择时间范围", + "xpack.slo.burnRate.title": "消耗速度", + "xpack.slo.deleteConfirmationModal.cancelButtonLabel": "取消", + "xpack.slo.deleteConfirmationModal.deleteButtonLabel": "删除", + "xpack.slo.deleteConfirmationModal.descriptionText": "此 SLO 删除后无法恢复。", + "xpack.slo.duration.daily": "每日", + "xpack.slo.duration.hourly": "每小时", + "xpack.slo.duration.minutely": "每分钟", + "xpack.slo.duration.monthly": "每月", + "xpack.slo.duration.weekly": "每周", + "xpack.slo.globalDiagnosis.errorNotification": "您没有适当权限,无法使用此功能。", + "xpack.slo.indicators.apmAvailability": "APM 可用性", + "xpack.slo.indicators.apmLatency": "APM 延迟", + "xpack.slo.indicators.customKql": "定制 KQL", + "xpack.slo.indicators.customMetric": "定制指标", + "xpack.slo.indicators.histogram": "直方图指标", + "xpack.slo.item.actions.button": "操作", + "xpack.slo.item.actions.clone": "克隆", + "xpack.slo.item.actions.createRule": "创建新告警规则", + "xpack.slo.item.actions.delete": "删除", + "xpack.slo.item.actions.details": "详情", + "xpack.slo.item.actions.edit": "编辑", + "xpack.slo.item.actions.manageRules": "管理规则", + "xpack.slo.list.emptyMessage": "没有匹配您的条件的结果。", + "xpack.slo.list.emptyTitle": "无结果", + "xpack.slo.list.errorMessage": "加载 SLO 时出错。请联系您的管理员寻求帮助。", + "xpack.slo.list.errorNotification": "提取 SLO 时出现问题", + "xpack.slo.list.errorTitle": "无法加载 SLO", + "xpack.slo.list.search": "搜索您的 SLO......", + "xpack.slo.list.sortBy.errorBudgetConsumed": "已消耗错误预算", + "xpack.slo.list.sortBy.errorBudgetRemaining": "剩余错误预算", + "xpack.slo.list.sortBy.sliValue": "SLI 值", + "xpack.slo.list.sortBy.sloStatus": "SLO 状态", + "xpack.slo.rules.actionGroupSelectorLabel": "操作组", + "xpack.slo.rules.addWindowAriaLabel": "添加窗口", + "xpack.slo.rules.burnRate.defaultActionMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\} 为活动状态,条件如下:\n\n- SLO:\\{\\{context.sloName\\}\\}'\n- 过去 \\{\\{context.longWindow.duration\\}\\} 的消耗速度为 \\{\\{context.longWindow.burnRate\\}\\}\n- 过去 \\{\\{context.shortWindow.duration\\}\\} 的消耗速度为 \\{\\{context.shortWindow.burnRate\\}\\}\n- Threshold: \\{\\{context.burnRateThreshold\\}\\}\n\n[查看告警详情](\\{\\{context.alertDetailsUrl\\}\\})\n", + "xpack.slo.rules.burnRate.defaultRecoveryMessage": "\\{\\{context.reason\\}\\}\n\n\\{\\{rule.name\\}\\} 已恢复。\n\n- SLO:\\{\\{context.sloName\\}\\}'\n- 过去 \\{\\{context.longWindow.duration\\}\\} 的消耗速度为 \\{\\{context.longWindow.burnRate\\}\\}\n- 过去 \\{\\{context.shortWindow.duration\\}\\} 的消耗速度为 \\{\\{context.shortWindow.burnRate\\}\\}\n- Threshold: \\{\\{context.burnRateThreshold\\}\\}\n\n[查看告警详情](\\{\\{context.alertDetailsUrl\\}\\})\n", + "xpack.slo.rules.burnRate.description": "在定义的期间内 SLO 消耗速度过高时告警。", + "xpack.slo.rules.burnRate.errors.burnRateThresholdRequired": "“消耗速度阈值”必填。", + "xpack.slo.rules.burnRate.errors.sloRequired": "“SLO”必填。", + "xpack.slo.rules.burnRate.errors.windowDurationRequired": "“回顾期”必填。", + "xpack.slo.rules.burnRate.name": "SLO 消耗速度", + "xpack.slo.rules.burnRate.rowLabel": "消耗速度阈值", + "xpack.slo.rules.burnRate.tooltip": "消耗速度是指服务在回顾期内耗用错误预算的速度。", + "xpack.slo.rules.deleteWindowLabel": "删除窗口", + "xpack.slo.rules.longWindow.errorText": "回顾期必须介于 1 到 72 小时之间。", + "xpack.slo.rules.longWindow.rowLabel": "回顾(小时)", + "xpack.slo.rules.longWindow.valueLabel": "回顾期(小时)", + "xpack.slo.rules.sloSelector.ariaLabel": "SLO", + "xpack.slo.rules.sloSelector.placeholder": "选择 SLO", + "xpack.slo.rules.sloSelector.rowLabel": "SLO", + "xpack.slo.slo.activeAlertsBadge.ariaLabel": "活动告警徽章", + "xpack.slo.slo.item.actions.clone": "克隆", + "xpack.slo.slo.item.actions.delete": "删除", + "xpack.slo.slo.rulesBadge.popover": "尚未为此 SLO 配置任何规则。超出 SLO 时,您不会收到告警。", + "xpack.slo.sloDetails.errorBudgetChartPanel.chartTitle": "剩余错误预算", + "xpack.slo.sloDetails.errorBudgetChartPanel.remaining": "剩余", + "xpack.slo.sloDetails.errorBudgetChartPanel.title": "错误预算逐渐减少", + "xpack.slo.sloDetails.headerControl.actions": "操作", + "xpack.slo.sloDetails.headerControl.createBurnRateRule": "创建新告警规则", + "xpack.slo.sloDetails.headerControl.edit": "编辑", + "xpack.slo.sloDetails.headerControl.manageRules": "管理规则", + "xpack.slo.sloDetails.headerTitle.createdMessage": "创建日期", + "xpack.slo.sloDetails.headerTitle.lastUpdatedMessage": "上次更新时间", + "xpack.slo.sloDetails.overview.apmSource": "APM 源", + "xpack.slo.sloDetails.overview.budgetingMethodTitle": "预算编制方法", + "xpack.slo.sloDetails.overview.descriptionTitle": "描述", + "xpack.slo.sloDetails.overview.indicatorTypeTitle": "指标类型", + "xpack.slo.sloDetails.overview.observedValueTitle": "观察值", + "xpack.slo.sloDetails.overview.tagsTitle": "标签", + "xpack.slo.sloDetails.overview.timeWindowTitle": "时间窗口", + "xpack.slo.sloDetails.sliHistoryChartPanel.chartTitle": "SLI 值", + "xpack.slo.sloDetails.sliHistoryChartPanel.current": "观察值", + "xpack.slo.sloDetails.sliHistoryChartPanel.objective": "目标", + "xpack.slo.sloDetails.sliHistoryChartPanel.title": "历史 SLI", + "xpack.slo.sloDetails.tab.alertsLabel": "告警", + "xpack.slo.sloDetails.tab.overviewLabel": "概览", + "xpack.slo.sloEdit.apm.filter.tooltip": "此 KQL 查询用于根据该 SLO 的某些相关条件筛选 APM 指标。", + "xpack.slo.sloEdit.apm.serviceName.tooltip": "这是受该 SLO 监测的 APM 服务。", + "xpack.slo.sloEdit.apmAvailability.serviceEnvironment": "服务环境", + "xpack.slo.sloEdit.apmAvailability.serviceEnvironment.placeholder": "选择环境", + "xpack.slo.sloEdit.apmAvailability.serviceName": "服务名称", + "xpack.slo.sloEdit.apmAvailability.serviceName.placeholder": "选择 APM 服务", + "xpack.slo.sloEdit.apmAvailability.transactionName": "事务名称", + "xpack.slo.sloEdit.apmAvailability.transactionName.placeholder": "选择事务名称", + "xpack.slo.sloEdit.apmAvailability.transactionType": "事务类型", + "xpack.slo.sloEdit.apmAvailability.transactionType.placeholder": "选择事务类型", + "xpack.slo.sloEdit.apmLatency.filter": "查询筛选", + "xpack.slo.sloEdit.apmLatency.filter.placeholder": "要对索引应用的定制筛选", + "xpack.slo.sloEdit.apmLatency.serviceEnvironment": "服务环境", + "xpack.slo.sloEdit.apmLatency.serviceEnvironment.placeholder": "选择环境", + "xpack.slo.sloEdit.apmLatency.serviceName": "服务名称", + "xpack.slo.sloEdit.apmLatency.serviceName.placeholder": "选择 APM 服务", + "xpack.slo.sloEdit.apmLatency.threshold.placeholder": "阈值 (ms)", + "xpack.slo.sloEdit.apmLatency.threshold.tooltip": "配置为 SLO 定义“良好”或“成功”请求的阈值(毫秒)。", + "xpack.slo.sloEdit.apmLatency.transactionName": "事务名称", + "xpack.slo.sloEdit.apmLatency.transactionName.placeholder": "选择事务名称", + "xpack.slo.sloEdit.apmLatency.transactionType": "事务类型", + "xpack.slo.sloEdit.apmLatency.transactionType.placeholder": "选择事务类型", + "xpack.slo.sloEdit.budgetingMethod.label": "预算编制方法", + "xpack.slo.sloEdit.budgetingMethod.tooltip": "基于发生次数的 SLO 使用时间窗口内良好事件数与事件总数的比率。基于时间片的 SLO 使用时间窗口内良好时间片与时间片总数的比率。", + "xpack.slo.sloEdit.calendarTimeWindow.monthly": "每月", + "xpack.slo.sloEdit.calendarTimeWindow.weekly": "每周", + "xpack.slo.sloEdit.cancelButton": "取消", + "xpack.slo.sloEdit.createSloButton": "创建 SLO", + "xpack.slo.sloEdit.customKql.indexSelection.label": "索引", + "xpack.slo.sloEdit.dataPreviewChart.errorMessage": "当前指标设置无效", + "xpack.slo.sloEdit.dataPreviewChart.explanationMessage": "填写指标字段以查看当前指标的可视化", + "xpack.slo.sloEdit.dataPreviewChart.panelLabel": "SLI 预览", + "xpack.slo.sloEdit.dataPreviewChart.xTitle": "过去一小时", + "xpack.slo.sloEdit.dataPreviewChart.yTitle": "SLI", + "xpack.slo.sloEdit.definition.sliType": "选择 SLI 类型", + "xpack.slo.sloEdit.definition.title": "定义 SLI", + "xpack.slo.sloEdit.description.sloDescription": "描述", + "xpack.slo.sloEdit.description.sloDescriptionPlaceholder": "SLO 的简短描述", + "xpack.slo.sloEdit.description.sloName": "SLO 名称", + "xpack.slo.sloEdit.description.sloNamePlaceholder": "SLO 的名称", + "xpack.slo.sloEdit.description.title": "描述 SLO", + "xpack.slo.sloEdit.editSloButton": "更新 SLO", + "xpack.slo.sloEdit.fieldSelector.all": "全部", + "xpack.slo.sloEdit.groupBy.label": "分区依据", + "xpack.slo.sloEdit.groupBy.placeholder": "选择要依据其分区的可选字段", + "xpack.slo.sloEdit.groupBy.tooltip": "为选定字段中的每个值创建单个 SLO。", + "xpack.slo.sloEdit.objectives.title": "设定目标", + "xpack.slo.sloEdit.sliType.customKql.customFilter": "要对索引应用的定制筛选", + "xpack.slo.sloEdit.sliType.customKql.customFilter.tooltip": "此 KQL 查询可用于基于某些相关条件来筛选文档。", + "xpack.slo.sloEdit.sliType.customKql.goodQuery": "良好查询", + "xpack.slo.sloEdit.sliType.customKql.goodQuery.tooltip": "此 KQL 查询应返回用于计算 SLO 时被视为“良好”或“成功”的事件的子集。此查询应基于某些相关条件(如状态代码、错误消息或其他相关字段)筛选事件。", + "xpack.slo.sloEdit.sliType.customKql.goodQueryPlaceholder": "定义良好事件", + "xpack.slo.sloEdit.sliType.customKql.queryFilter": "查询筛选", + "xpack.slo.sloEdit.sliType.customKql.totalQuery": "查询总数", + "xpack.slo.sloEdit.sliType.customKql.totalQuery.tooltip": "此 KQL 查询应返回与 SLO 计算相关的所有事件,包括良好和不良事件。", + "xpack.slo.sloEdit.sliType.customKql.totalQueryPlaceholder": "定义事件总数", + "xpack.slo.sloEdit.sliType.customMetric.addMetricAriaLabel": "添加指标", + "xpack.slo.sloEdit.sliType.customMetric.addMetricLabel": "添加指标", + "xpack.slo.sloEdit.sliType.customMetric.customFilter": "要对索引应用的定制筛选", + "xpack.slo.sloEdit.sliType.customMetric.customFilter.tooltip": "此 KQL 查询可用于基于某些相关条件来筛选文档。", + "xpack.slo.sloEdit.sliType.customMetric.deleteLabel": "删除指标", + "xpack.slo.sloEdit.sliType.customMetric.equation.invalidCharacters": "方程字段仅支持以下字符:A-Z、+、-、/、*、(、)、?、!、&、:、|、>、<、=", + "xpack.slo.sloEdit.sliType.customMetric.equationHelpText": "支持基本数学方程,有效字符包括:A-Z、+、-、/、*、(、)、?、!、&、:、|、>、<、=", + "xpack.slo.sloEdit.sliType.customMetric.equationLabel": "方程", + "xpack.slo.sloEdit.sliType.customMetric.filterLabel": "筛选", + "xpack.slo.sloEdit.sliType.customMetric.goodTitle": "良好事件", + "xpack.slo.sloEdit.sliType.customMetric.metricField.placeholder": "选择指标字段", + "xpack.slo.sloEdit.sliType.customMetric.metricLabel": "指标", + "xpack.slo.sloEdit.sliType.customMetric.queryFilter": "查询筛选", + "xpack.slo.sloEdit.sliType.customMetric.totalEquation.tooltip": "这支持基本数学 (A + B / C) 和布尔逻辑 (A < B ?A :B)。", + "xpack.slo.sloEdit.sliType.customMetric.totalMetric.tooltip": "来自该字段的此类数据将使用“求和”聚合进行汇总。", + "xpack.slo.sloEdit.sliType.customMetric.totalTitle": "事件合计", + "xpack.slo.sloEdit.sliType.histogram.aggregation.placeholder": "选择聚合", + "xpack.slo.sloEdit.sliType.histogram.aggregationLabel": "聚合", + "xpack.slo.sloEdit.sliType.histogram.aggregationTooltip": "“值计数”聚合将返回直方图字段的总计数。范围将返回在下面定义的范围内的直方图字段中的计数。", + "xpack.slo.sloEdit.sliType.histogram.customFilter": "要对索引应用的定制筛选", + "xpack.slo.sloEdit.sliType.histogram.customFilter.tooltip": "此 KQL 查询可用于基于某些相关条件来筛选文档。", + "xpack.slo.sloEdit.sliType.histogram.fromLabel": "自", + "xpack.slo.sloEdit.sliType.histogram.fromTooltip": "“from”值具有包容性。", + "xpack.slo.sloEdit.sliType.histogram.goodTitle": "良好事件", + "xpack.slo.sloEdit.sliType.histogram.kqlFilterLabel": "KQL 筛选", + "xpack.slo.sloEdit.sliType.histogram.metricField.placeholder": "选择直方图字段", + "xpack.slo.sloEdit.sliType.histogram.metricLabel": "字段", + "xpack.slo.sloEdit.sliType.histogram.query.tooltip": "此 KQL 查询应返回该指标的事件的子集。", + "xpack.slo.sloEdit.sliType.histogram.queryFilter": "查询筛选", + "xpack.slo.sloEdit.sliType.histogram.rangeLabel": "范围", + "xpack.slo.sloEdit.sliType.histogram.sourceTitle": "源", + "xpack.slo.sloEdit.sliType.histogram.toLabel": "至", + "xpack.slo.sloEdit.sliType.histogram.totalTitle": "事件合计", + "xpack.slo.sloEdit.sliType.histogram.toTooltip": "“to”值不具有包容性。", + "xpack.slo.sloEdit.sliType.histogram.valueCountLabel": "值计数", + "xpack.slo.sloEdit.tags.label": "标签", + "xpack.slo.sloEdit.tags.placeholder": "添加标签", + "xpack.slo.sloEdit.targetSlo.label": "目标/SLO (%)", + "xpack.slo.sloEdit.targetSlo.tooltip": "SLO 的目标值 (%)。", + "xpack.slo.sloEdit.timeSliceTarget.label": "时间片目标 (%)", + "xpack.slo.sloEdit.timeSliceTarget.tooltip": "用于确定切片是良好还是不良的单个时间片目标。", + "xpack.slo.sloEdit.timesliceWindow.label": "时间片窗口(分钟)", + "xpack.slo.sloEdit.timesliceWindow.tooltip": "用于评估接收的数据的时间片窗口大小。", + "xpack.slo.sloEdit.timestampField.label": "时间戳字段", + "xpack.slo.sloEdit.timestampField.placeholder": "选择时间戳字段", + "xpack.slo.sloEdit.timeWindow.calendarAligned": "日历已对齐", + "xpack.slo.sloEdit.timeWindow.rolling": "滚动", + "xpack.slo.sloEdit.timeWindowDuration.label": "持续时间", + "xpack.slo.sloEdit.timeWindowDuration.tooltip": "用于在其间计算 SLO 的时间窗口持续时间。", + "xpack.slo.sloEdit.timeWindowType.label": "时间窗口", + "xpack.slo.sloEdit.timeWindowType.tooltip": "选择滚动或日历对齐窗口。", + "xpack.slo.sloList.welcomePrompt.buttonLabel": "创建 SLO", + "xpack.slo.sloList.welcomePrompt.getStartedMessage": "要开始使用,请创建您的首个 SLO。", + "xpack.slo.sloList.welcomePrompt.learnMore": "希望了解详情?", + "xpack.slo.sloList.welcomePrompt.learnMoreLink": "阅读文档", + "xpack.slo.sloList.welcomePrompt.messageParagraph1": "衡量对业务十分重要的关键指标,如服务级别指标和服务级别目标 (SLI/SLO),努力实现 SLA。", + "xpack.slo.sloList.welcomePrompt.messageParagraph2": "通过实时洞察,轻松向利益相关者报告服务的运行时间和可靠性。", + "xpack.slo.sloList.welcomePrompt.needLicenseMessage": "您需要 Elastic Cloud 订阅或白金级许可证才能使用 SLO。", + "xpack.slo.sloList.welcomePrompt.signupForCloud": "注册 Elastic Cloud", + "xpack.slo.sloList.welcomePrompt.signupForLicense": "注册许可证", + "xpack.slo.sloList.welcomePrompt.title": "跟踪和实现 SLO", + "xpack.slo.sloStatusBadge.degrading": "正在降级", + "xpack.slo.sloStatusBadge.forecasted": "已预测", + "xpack.slo.sloStatusBadge.healthy": "运行正常", + "xpack.slo.sloStatusBadge.noData": "无数据", + "xpack.slo.sloStatusBadge.noDataTooltip": "在聚合数据并且数据可用之前,可能需要花费一些时间。", + "xpack.slo.sloStatusBadge.violated": "已违规", "xpack.observabilityAiAssistant.couldNotFindConversationContent": "找不到 ID 为 {conversationId} 的对话。请确保该对话存在并且您具有访问权限。", "xpack.observabilityAiAssistant.executedFunctionFailureEvent": "无法执行函数 {functionName}", "xpack.observabilityAiAssistant.poweredByModel": "由 {model} 提供支持", diff --git a/x-pack/test/api_integration/apis/slos/create_slo.ts b/x-pack/test/api_integration/apis/slos/create_slo.ts index 18e35eceb835f..4b26c2b0eb4b5 100644 --- a/x-pack/test/api_integration/apis/slos/create_slo.ts +++ b/x-pack/test/api_integration/apis/slos/create_slo.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; import type { CreateSLOInput } from '@kbn/slo-schema'; -import { SO_SLO_TYPE } from '@kbn/observability-plugin/server/saved_objects'; +import { SO_SLO_TYPE } from '@kbn/slo-plugin/server/saved_objects'; import { FtrProviderContext } from '../../ftr_provider_context'; import { sloData } from './fixtures/create_slo'; diff --git a/x-pack/test/api_integration/apis/slos/delete_slo.ts b/x-pack/test/api_integration/apis/slos/delete_slo.ts index 279f0e80464b2..9d4c3b9a4d051 100644 --- a/x-pack/test/api_integration/apis/slos/delete_slo.ts +++ b/x-pack/test/api_integration/apis/slos/delete_slo.ts @@ -7,7 +7,7 @@ import { cleanup } from '@kbn/infra-forge'; import expect from '@kbn/expect'; import type { CreateSLOInput } from '@kbn/slo-schema'; -import { SO_SLO_TYPE } from '@kbn/observability-plugin/server/saved_objects'; +import { SO_SLO_TYPE } from '@kbn/slo-plugin/server/saved_objects'; import { FtrProviderContext } from '../../ftr_provider_context'; import { sloData } from './fixtures/create_slo'; diff --git a/x-pack/test/api_integration/apis/slos/helper/es.ts b/x-pack/test/api_integration/apis/slos/helper/es.ts index d1b50e625365a..f5ac7a6e23c88 100644 --- a/x-pack/test/api_integration/apis/slos/helper/es.ts +++ b/x-pack/test/api_integration/apis/slos/helper/es.ts @@ -8,7 +8,7 @@ import { Client } from '@elastic/elasticsearch'; import { SLO_DESTINATION_INDEX_PATTERN, SLO_SUMMARY_DESTINATION_INDEX_PATTERN, -} from '@kbn/observability-plugin/common/slo/constants'; +} from '@kbn/slo-plugin/common/constants'; export class SloEsClient { constructor(private esClient: Client) {} diff --git a/x-pack/test/api_integration/apis/slos/reset_slo.ts b/x-pack/test/api_integration/apis/slos/reset_slo.ts index 37dfbda0a882f..014e546b2b639 100644 --- a/x-pack/test/api_integration/apis/slos/reset_slo.ts +++ b/x-pack/test/api_integration/apis/slos/reset_slo.ts @@ -6,7 +6,7 @@ */ import { cleanup } from '@kbn/infra-forge'; import expect from '@kbn/expect'; -import { SO_SLO_TYPE } from '@kbn/observability-plugin/server/saved_objects'; +import { SO_SLO_TYPE } from '@kbn/slo-plugin/server/saved_objects'; import { FtrProviderContext } from '../../ftr_provider_context'; import { loadTestData } from './helper/load_test_data'; diff --git a/x-pack/test/api_integration/apis/slos/update_slo.ts b/x-pack/test/api_integration/apis/slos/update_slo.ts index 6727fa8c22241..53768327e7b49 100644 --- a/x-pack/test/api_integration/apis/slos/update_slo.ts +++ b/x-pack/test/api_integration/apis/slos/update_slo.ts @@ -7,7 +7,7 @@ import { cleanup } from '@kbn/infra-forge'; import expect from '@kbn/expect'; import type { CreateSLOInput } from '@kbn/slo-schema'; -import { SO_SLO_TYPE } from '@kbn/observability-plugin/server/saved_objects'; +import { SO_SLO_TYPE } from '@kbn/slo-plugin/server/saved_objects'; import { FtrProviderContext } from '../../ftr_provider_context'; import { loadTestData } from './helper/load_test_data'; diff --git a/x-pack/test/api_integration/services/slo.ts b/x-pack/test/api_integration/services/slo.ts index baa30067f4edf..4d28786df56a5 100644 --- a/x-pack/test/api_integration/services/slo.ts +++ b/x-pack/test/api_integration/services/slo.ts @@ -6,7 +6,7 @@ */ import { CreateSLOInput, FindSLODefinitionsResponse } from '@kbn/slo-schema'; -import { SLO_SUMMARY_DESTINATION_INDEX_NAME } from '@kbn/observability-plugin/common/slo/constants'; +import { SLO_SUMMARY_DESTINATION_INDEX_NAME } from '@kbn/slo-plugin/common/constants'; import { waitForIndexToBeEmpty } from '../apis/slos/helper/wait_for_index_state'; import { FtrProviderContext } from '../ftr_provider_context'; diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index b27b4a4cae18a..fe83912894be7 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -167,6 +167,7 @@ "@kbn/typed-react-router-config", "@kbn/ftr-common-functional-ui-services", "@kbn/infra-forge", + "@kbn/slo-plugin", "@kbn/aiops-test-utils", "@kbn/observability-ai-assistant-app-plugin", ] diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/slos/create_slo.ts b/x-pack/test_serverless/api_integration/test_suites/observability/slos/create_slo.ts index 06059d3bfe0b4..f9fff99103f6b 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/slos/create_slo.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/slos/create_slo.ts @@ -8,13 +8,13 @@ import { cleanup, generate } from '@kbn/infra-forge'; import expect from '@kbn/expect'; import type { GetTransformsResponseSchema } from '@kbn/transform-plugin/common/api_schemas/transforms'; -import { SO_SLO_TYPE } from '@kbn/observability-plugin/server/saved_objects'; +import { SO_SLO_TYPE } from '@kbn/slo-plugin/server/saved_objects'; import { ALL_VALUE } from '@kbn/slo-schema'; import { getSLOSummaryPipelineId, SLO_SUMMARY_TEMP_INDEX_NAME, -} from '@kbn/observability-plugin/common/slo/constants'; +} from '@kbn/slo-plugin/common/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; interface ExpectedTransforms { diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/slos/delete_slo.ts b/x-pack/test_serverless/api_integration/test_suites/observability/slos/delete_slo.ts index 82bcaec6a8631..a275a23fcf281 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/slos/delete_slo.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/slos/delete_slo.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SO_SLO_TYPE } from '@kbn/observability-plugin/server/saved_objects'; +import { SO_SLO_TYPE } from '@kbn/slo-plugin/server/saved_objects'; import { cleanup, generate } from '@kbn/infra-forge'; import expect from '@kbn/expect'; import { ALL_VALUE } from '@kbn/slo-schema'; @@ -13,11 +13,11 @@ import { getSLOSummaryTransformId, getSLOTransformId, getSLOSummaryPipelineId, -} from '@kbn/observability-plugin/common/slo/constants'; +} from '@kbn/slo-plugin/common/constants'; import { SLO_DESTINATION_INDEX_PATTERN, SLO_SUMMARY_DESTINATION_INDEX_PATTERN, -} from '@kbn/observability-plugin/common/slo/constants'; +} from '@kbn/slo-plugin/common/constants'; import { ElasticsearchClient } from '@kbn/core/server'; import { FtrProviderContext } from '../../../ftr_provider_context'; diff --git a/x-pack/test_serverless/tsconfig.json b/x-pack/test_serverless/tsconfig.json index 0aafa5212e6df..3cbecb37dcebd 100644 --- a/x-pack/test_serverless/tsconfig.json +++ b/x-pack/test_serverless/tsconfig.json @@ -92,5 +92,6 @@ "@kbn/es", "@kbn/infra-forge", "@kbn/reporting-common", + "@kbn/slo-plugin", ] } diff --git a/yarn.lock b/yarn.lock index 0acd9456bfc6c..762ffdb748063 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6169,6 +6169,10 @@ version "0.0.0" uid "" +"@kbn/slo-plugin@link:x-pack/plugins/observability_solution/slo": + version "0.0.0" + uid "" + "@kbn/slo-schema@link:x-pack/packages/kbn-slo-schema": version "0.0.0" uid ""