Skip to content

Commit

Permalink
Merge branch 'main' into ftr/serverless-user-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlemeshko authored Dec 4, 2023
2 parents 484af20 + 79b3927 commit f789475
Show file tree
Hide file tree
Showing 68 changed files with 256 additions and 193 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,19 @@ async function sendReleaseSlackAnnouncement({
text:
'*Useful links:*\n\n' +
Object.entries(usefulLinksSection)
.filter(([name]) => !name.includes('GPCTL'))
.map(([name, link]) => ` • <${link}|${name}>`)
.join('\n'),
},
},
{
type: 'section',
text: {
type: 'mrkdwn',
text:
'*GPCTL Dashboards:*\n\n' +
Object.entries(usefulLinksSection)
.filter(([name]) => name.includes('GPCTL'))
.map(([name, link]) => ` • <${link}|${name}>`)
.join('\n'),
},
Expand Down
8 changes: 8 additions & 0 deletions packages/kbn-rule-data-utils/src/rule_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { AlertConsumers } from '../alerts_as_data_rbac';
import { STACK_ALERTS_FEATURE_ID } from './stack_rules';

export * from './stack_rules';
export * from './o11y_rules';

export type RuleCreationValidConsumer =
| typeof AlertConsumers.LOGS
| typeof AlertConsumers.INFRASTRUCTURE
| typeof AlertConsumers.OBSERVABILITY
| typeof STACK_ALERTS_FEATURE_ID;
3 changes: 2 additions & 1 deletion packages/kbn-text-based-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "@kbn/text-based-editor",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
"license": "SSPL-1.0 OR Elastic License 2.0",
"sideEffects": ["*.scss"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,24 @@ import { FormattedMessage } from '@kbn/i18n-react';
import type { DataView } from '@kbn/data-plugin/common';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { STACK_ALERTS_FEATURE_ID } from '@kbn/rule-data-utils';
import {
AlertConsumers,
ES_QUERY_ID,
RuleCreationValidConsumer,
STACK_ALERTS_FEATURE_ID,
} from '@kbn/rule-data-utils';
import { DiscoverStateContainer } from '../../services/discover_state';
import { DiscoverServices } from '../../../../build_services';

const container = document.createElement('div');
let isOpen = false;

const ALERT_TYPE_ID = '.es-query';
const EsQueryValidConsumer: RuleCreationValidConsumer[] = [
AlertConsumers.INFRASTRUCTURE,
AlertConsumers.LOGS,
AlertConsumers.OBSERVABILITY,
STACK_ALERTS_FEATURE_ID,
];

interface AlertsPopoverProps {
onClose: () => void;
Expand Down Expand Up @@ -98,7 +108,7 @@ export function AlertsPopover({

return triggersActionsUi?.getAddRuleFlyout({
metadata: discoverMetadata,
consumer: STACK_ALERTS_FEATURE_ID,
consumer: 'alerts',
onClose: (_, metadata) => {
onFinishFlyoutInteraction(metadata as EsQueryAlertMetaData);
onClose();
Expand All @@ -107,8 +117,12 @@ export function AlertsPopover({
onFinishFlyoutInteraction(metadata as EsQueryAlertMetaData);
},
canChangeTrigger: false,
ruleTypeId: ALERT_TYPE_ID,
ruleTypeId: ES_QUERY_ID,
initialValues: { params: getParams() },
validConsumers: EsQueryValidConsumer,
useRuleProducer: true,
// Default to the Logs consumer if it's available. This should fall back to Stack Alerts if it's not.
initialSelectedConsumer: AlertConsumers.LOGS,
});
}, [alertFlyoutVisible, triggersActionsUi, discoverMetadata, getParams, onClose, stateContainer]);

Expand Down
6 changes: 2 additions & 4 deletions src/plugins/discover/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,12 @@
"@kbn/react-kibana-context-render",
"@kbn/unified-data-table",
"@kbn/no-data-page-plugin",
"@kbn/rule-data-utils",
"@kbn/global-search-plugin",
"@kbn/resizable-layout",
"@kbn/unsaved-changes-badge",
"@kbn/rule-data-utils",
"@kbn/core-chrome-browser",
"@kbn/core-plugins-server"
],
"exclude": [
"target/**/*"
]
"exclude": ["target/**/*"]
}
10 changes: 9 additions & 1 deletion x-pack/packages/ml/anomaly_utils/field_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,12 @@ export const _DOC_COUNT = '_doc_count';
/**
* List of system fields we don't want to display.
*/
export const OMIT_FIELDS: string[] = ['_source', '_type', '_index', '_id', '_version', '_score'];
export const OMIT_FIELDS: string[] = [
'_source',
'_type',
'_index',
'_id',
'_version',
'_score',
'_tier',
];
10 changes: 9 additions & 1 deletion x-pack/plugins/data_visualizer/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ export const SUPPORTED_FIELD_TYPES = {
UNKNOWN: 'unknown',
} as const;

export const OMIT_FIELDS: string[] = ['_source', '_type', '_index', '_id', '_version', '_score'];
export const OMIT_FIELDS: string[] = [
'_source',
'_type',
'_index',
'_id',
'_version',
'_score',
'_tier',
];

export const NON_AGGREGATABLE_FIELD_TYPES = new Set<string>([
KBN_FIELD_TYPES.GEO_SHAPE,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/data_visualizer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@kbn/core-notifications-browser",
"@kbn/ebt-tools",
"@kbn/ml-chi2test",
"@kbn/field-utils"
"@kbn/field-utils",
],
"exclude": [
"target/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { useEuiTheme } from '@elastic/eui';
import { TypedLensByValueInput } from '@kbn/lens-plugin/public';
import { ALL_VALUE, SLOResponse, timeslicesBudgetingMethodSchema } from '@kbn/slo-schema';
import { SLO_DESTINATION_INDEX_PATTERN } from '../../../../common/slo/constants';

export function useLensDefinition(slo: SLOResponse): TypedLensByValueInput['attributes'] {
const { euiTheme } = useEuiTheme();
Expand Down Expand Up @@ -555,7 +556,7 @@ export function useLensDefinition(slo: SLOResponse): TypedLensByValueInput['attr
adHocDataViews: {
'32ca1ad4-81c0-4daf-b9d1-07118044bdc5': {
id: '32ca1ad4-81c0-4daf-b9d1-07118044bdc5',
title: '.slo-observability.sli-v2.*',
title: SLO_DESTINATION_INDEX_PATTERN,
timeFieldName: '@timestamp',
sourceFilters: [],
fieldFormats: {},
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/observability/public/pages/rules/rules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useLoadRuleTypes } from '@kbn/triggers-actions-ui-plugin/public';
import { ALERTS_FEATURE_ID } from '@kbn/alerting-plugin/common';
import { useBreadcrumbs } from '@kbn/observability-shared-plugin/public';

import { AlertConsumers } from '@kbn/rule-data-utils';
import { RULES_LOGS_PATH, RULES_PATH } from '../../../common/locators/paths';
import { useKibana } from '../../utils/kibana_react';
import { usePluginContext } from '../../hooks/use_plugin_context';
Expand Down Expand Up @@ -144,6 +145,7 @@ export function RulesPage({ activeTab = RULES_TAB_NAME }: RulesPageProps) {
consumer={ALERTS_FEATURE_ID}
filteredRuleTypes={filteredRuleTypes}
validConsumers={observabilityRuleCreationValidConsumers}
initialSelectedConsumer={AlertConsumers.LOGS}
onClose={() => {
setAddRuleFlyoutVisibility(false);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SLO_RESOURCES_VERSION } from '../constants';
import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants';

export const getSLOMappingsTemplate = (name: string) => ({
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SLO_RESOURCES_VERSION } from '../constants';
import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants';

export const getSLOSettingsTemplate = (name: string) => ({
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SLO_RESOURCES_VERSION } from '../constants';
import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants';

export const getSLOSummaryMappingsTemplate = (name: string) => ({
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SLO_RESOURCES_VERSION } from '../constants';
import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants';

export const getSLOSummarySettingsTemplate = (name: string) => ({
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SLO_RESOURCES_VERSION } from '../constants';
import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants';

export const getSLOIndexTemplate = (name: string, indexPattern: string, composedOf: string[]) => ({
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SLO_RESOURCES_VERSION } from '../constants';
import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants';

export const getSLOSummaryIndexTemplate = (
name: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SLO_RESOURCES_VERSION } from '../constants';
import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants';

export const getSLOPipelineTemplate = (id: string, indexNamePrefix: string) => ({
id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SLO_RESOURCES_VERSION } from '../constants';
import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants';

export const getSLOSummaryPipelineTemplate = (id: string) => ({
id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
TransformSource,
TransformTimeSync,
} from '@elastic/elasticsearch/lib/api/types';
import { SLO_RESOURCES_VERSION } from '../constants';
import { SLO_RESOURCES_VERSION } from '../../../common/slo/constants';

export interface TransformSettings {
frequency: TransformPutTransformRequest['frequency'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 '../../../../assets/constants';
import { SLO_DESTINATION_INDEX_PATTERN } from '../../../../../common/slo/constants';
import {
buildQuery,
EvaluationAfterKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { ElasticsearchClient } from '@kbn/core/server';
import { ALL_VALUE, CreateSLOParams, CreateSLOResponse } from '@kbn/slo-schema';
import { v4 as uuidv4 } from 'uuid';
import { SLO_SUMMARY_TEMP_INDEX_NAME } from '../../assets/constants';
import { SLO_SUMMARY_TEMP_INDEX_NAME } from '../../../common/slo/constants';
import { Duration, DurationUnit, SLO } from '../../domain/models';
import { validateSLO } from '../../domain/services';
import { SLORepository } from './slo_repository';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
getSLOTransformId,
SLO_DESTINATION_INDEX_PATTERN,
SLO_SUMMARY_DESTINATION_INDEX_PATTERN,
} from '../../assets/constants';
} from '../../../common/slo/constants';
import { DeleteSLO } from './delete_slo';
import { createAPMTransactionErrorRateIndicator, createSLO } from './fixtures/slo';
import { createSLORepositoryMock, createTransformManagerMock } from './mocks';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
getSLOTransformId,
SLO_DESTINATION_INDEX_PATTERN,
SLO_SUMMARY_DESTINATION_INDEX_PATTERN,
} from '../../assets/constants';
} from '../../../common/slo/constants';
import { SLORepository } from './slo_repository';
import { TransformManager } from './transform_manager';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ALL_VALUE, DeleteSLOInstancesParams } from '@kbn/slo-schema';
import {
SLO_DESTINATION_INDEX_PATTERN,
SLO_SUMMARY_DESTINATION_INDEX_PATTERN,
} from '../../assets/constants';
} from '../../../common/slo/constants';
import { IllegalArgumentError } from '../../errors';

interface SloInstanceTuple {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 '../../assets/constants';
import { SLO_DESTINATION_INDEX_PATTERN } from '../../../common/slo/constants';
import { SLORepository } from './slo_repository';

export class GetSLOInstances {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { assertNever } from '@kbn/std';
import * as t from 'io-ts';
import moment from 'moment';
import { SLO_DESTINATION_INDEX_PATTERN } from '../../assets/constants';
import { SLO_DESTINATION_INDEX_PATTERN } from '../../../common/slo/constants';
import { DateRange, HistoricalSummary, SLO, SLOId } from '../../domain/models';
import {
computeSLI,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { getSLOTransformId } from '../../assets/constants';
import { getSLOTransformId } from '../../../common/slo/constants';
import { SLORepository } from './slo_repository';
import { TransformManager } from './transform_manager';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
SLO_SUMMARY_COMPONENT_TEMPLATE_SETTINGS_NAME,
SLO_SUMMARY_INDEX_TEMPLATE_NAME,
SLO_SUMMARY_INGEST_PIPELINE_NAME,
} from '../../assets/constants';
} from '../../../common/slo/constants';
import { DefaultResourceInstaller } from './resource_installer';

describe('resourceInstaller', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
SLO_SUMMARY_INDEX_TEMPLATE_PATTERN,
SLO_SUMMARY_INGEST_PIPELINE_NAME,
SLO_SUMMARY_TEMP_INDEX_NAME,
} from '../../assets/constants';
} 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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
timeslicesBudgetingMethodSchema,
} from '@kbn/slo-schema';
import { assertNever } from '@kbn/std';
import { SLO_DESTINATION_INDEX_PATTERN } from '../../assets/constants';
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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { ElasticsearchClientMock, elasticsearchServiceMock } from '@kbn/core/server/mocks';
import moment from 'moment';
import { SLO_DESTINATION_INDEX_PATTERN } from '../../assets/constants';
import { SLO_DESTINATION_INDEX_PATTERN } from '../../../common/slo/constants';
import { Duration, DurationUnit } from '../../domain/models';
import { createSLO } from './fixtures/slo';
import { sevenDaysRolling, weeklyCalendarAligned } from './fixtures/time_window';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
toMomentUnitOfTime,
} from '@kbn/slo-schema';
import moment from 'moment';
import { SLO_DESTINATION_INDEX_PATTERN } from '../../assets/constants';
import { SLO_DESTINATION_INDEX_PATTERN } from '../../../common/slo/constants';
import { DateRange, SLO, Summary } from '../../domain/models';
import { computeSLI, computeSummaryStatus, toErrorBudget } from '../../domain/services';
import { toDateRange } from '../../domain/services/date_range';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ElasticsearchClient, Logger } from '@kbn/core/server';
import { ALL_VALUE } from '@kbn/slo-schema';
import { assertNever } from '@kbn/std';
import _ from 'lodash';
import { SLO_SUMMARY_DESTINATION_INDEX_PATTERN } from '../../assets/constants';
import { SLO_SUMMARY_DESTINATION_INDEX_PATTERN } from '../../../common/slo/constants';
import { SLOId, Status, Summary } from '../../domain/models';
import { toHighPrecision } from '../../utils/number';
import { getElastichsearchQueryOrThrow } from './transform_generators';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { ElasticsearchClient, Logger } from '@kbn/core/server';
import {
SLO_SUMMARY_TRANSFORMS_VERSION,
SLO_SUMMARY_TRANSFORM_NAME_PREFIX,
} from '../../../assets/constants';
} from '../../../../common/slo/constants';
import { retryTransientEsErrors } from '../../../utils/retry';
import { ALL_TRANSFORM_TEMPLATES } from './templates';

Expand Down
Loading

0 comments on commit f789475

Please sign in to comment.