Skip to content

Commit

Permalink
Merge branch 'main' into eui/82.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jul 6, 2023
2 parents c3fffe3 + 8a17024 commit d700b1b
Show file tree
Hide file tree
Showing 52 changed files with 624 additions and 276 deletions.
Binary file modified docs/management/cases/images/cases-visualization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/management/cases/images/cases.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/management/cases/manage-cases.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ TIP: In the `Description` area, you can use
https://www.markdownguide.org/cheat-sheet[Markdown] syntax to create formatted
text.

. Optionally, add assignees and tags. You can add users only if they meet
the necessary <<setup-cases,prerequisites>>.
. Optionally, add a category, assignees, and tags.
You can add users only if they meet the necessary <<setup-cases,prerequisites>>.

. For *External incident management system*, select a connector. For more
information, refer to <<add-case-connectors>>.
Expand Down Expand Up @@ -115,7 +115,7 @@ When you subsequently add assignees to cases, they receive an email.
=== Manage cases

In *Management > {stack-manage-app} > Cases*, you can search cases and filter
them by attributes such as assignees, severity, status, and tags. You can also
them by attributes such as assignees, categories, severity, status, and tags. You can also
select multiple cases and use bulk actions to delete cases or change their
attributes.

Expand All @@ -126,7 +126,7 @@ To view a case, click on its name. You can then:
* Add or remove assignees.
* Add a connector.
* Send updates to external systems (if external connections are configured).
* Edit tags.
* Edit the category and tags.
* Refresh the case to retrieve the latest updates.
* Change the status.
* Change the severity.
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pageLoadAssetSize:
osquery: 107090
painlessLab: 179748
presentationUtil: 58834
profiling: 18628
profiling: 36694
remoteClusters: 51327
reporting: 57003
rollup: 97204
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/apm/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"taskManager",
"usageCollection",
"customIntegrations", // Move this to requiredPlugins after completely migrating from the Tutorials Home App
"licenseManagement"
"licenseManagement",
"profiling"
],
"requiredBundles": [
"advancedSettings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import { isEmpty, pickBy } from 'lodash';
import moment from 'moment';
import url from 'url';
import type { InfraLocators } from '@kbn/infra-plugin/common/locators';
import type { ProfilingLocators } from '@kbn/profiling-plugin/public';
import type { Transaction } from '../../../../typings/es_schemas/ui/transaction';
import { getDiscoverHref } from '../links/discover_links/discover_link';
import { getDiscoverQuery } from '../links/discover_links/discover_transaction_link';
import { getInfraHref } from '../links/infra_link';
import { fromQuery } from '../links/url_helpers';
import { SectionRecord, getNonEmptySections, Action } from './sections_helper';
import { TRACE_ID } from '../../../../common/es_fields/apm';
import { HOST_NAME, TRACE_ID } from '../../../../common/es_fields/apm';
import { ApmRouter } from '../../routing/apm_route_config';

function getInfraMetricsQuery(transaction: Transaction) {
Expand All @@ -38,13 +39,15 @@ export const getSections = ({
apmRouter,
infraLocators,
infraLinksAvailable,
profilingLocators,
}: {
transaction?: Transaction;
basePath: IBasePath;
location: Location;
apmRouter: ApmRouter;
infraLocators: InfraLocators;
infraLinksAvailable: boolean;
profilingLocators?: ProfilingLocators;
}) => {
if (!transaction) return [];
const hostName = transaction.host?.hostname;
Expand Down Expand Up @@ -163,6 +166,42 @@ export const getSections = ({
}),
condition: !!hostName,
},
{
key: 'hostProfilingFlamegraph',
label: i18n.translate(
'xpack.apm.transactionActionMenu.showHostProfilingFlamegraphLinkLabel',
{ defaultMessage: 'Host flamegraph' }
),
href: profilingLocators?.flamegraphLocator.getRedirectUrl({
kuery: `${HOST_NAME}: "${hostName}"`,
}),
condition: !!hostName && !!profilingLocators,
showNewBadge: true,
},
{
key: 'hostProfilingTopNFunctions',
label: i18n.translate(
'xpack.apm.transactionActionMenu.showHostProfilingTopNFunctionsLinkLabel',
{ defaultMessage: 'Host topN functions' }
),
href: profilingLocators?.topNFunctionsLocator.getRedirectUrl({
kuery: `${HOST_NAME}: "${hostName}"`,
}),
condition: !!hostName && !!profilingLocators,
showNewBadge: true,
},
{
key: 'hostProfilingStacktraces',
label: i18n.translate(
'xpack.apm.transactionActionMenu.showHostProfilingStacktracesLinkLabel',
{ defaultMessage: 'Host stacktraces' }
),
href: profilingLocators?.stacktracesLocator.getRedirectUrl({
kuery: `${HOST_NAME}: "${hostName}"`,
}),
condition: !!hostName && !!profilingLocators,
showNewBadge: true,
},
];

const logActions: Action[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface Action {
href?: string;
onClick?: (event: MouseEvent) => void;
condition: boolean;
showNewBadge?: boolean;
}

interface Section {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@

import { EuiButton } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { ObservabilityTriggerId } from '@kbn/observability-shared-plugin/common';
import {
ActionMenu,
ActionMenuDivider,
getContextMenuItemsFromActions,
Section,
SectionLink,
SectionLinks,
SectionSubtitle,
SectionTitle,
} from '@kbn/observability-shared-plugin/public';
import { ObservabilityTriggerId } from '@kbn/observability-shared-plugin/common';
import { getContextMenuItemsFromActions } from '@kbn/observability-shared-plugin/public';
import { ProfilingLocators } from '@kbn/profiling-plugin/public';
import React, { useState } from 'react';
import { useLocation } from 'react-router-dom';
import useAsync from 'react-use/lib/useAsync';
Expand All @@ -27,6 +28,7 @@ import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_
import { useLicenseContext } from '../../../context/license/use_license_context';
import { useApmFeatureFlag } from '../../../hooks/use_apm_feature_flag';
import { useApmRouter } from '../../../hooks/use_apm_router';
import { useProfilingPlugin } from '../../../hooks/use_profiling_plugin';
import { CustomLinkMenuSection } from './custom_link_menu_section';
import { getSections } from './sections';

Expand Down Expand Up @@ -63,6 +65,9 @@ export function TransactionActionMenu({ transaction, isLoading }: Props) {

const [isActionPopoverOpen, setIsActionPopoverOpen] = useState(false);

const { isProfilingPluginInitialized, profilingLocators } =
useProfilingPlugin();

return (
<>
<ActionMenu
Expand All @@ -72,7 +77,7 @@ export function TransactionActionMenu({ transaction, isLoading }: Props) {
anchorPosition="downRight"
button={
<ActionMenuButton
isLoading={isLoading}
isLoading={isLoading || isProfilingPluginInitialized === undefined}
onClick={() =>
setIsActionPopoverOpen(
(prevIsActionPopoverOpen) => !prevIsActionPopoverOpen
Expand All @@ -81,14 +86,23 @@ export function TransactionActionMenu({ transaction, isLoading }: Props) {
/>
}
>
<ActionMenuSections transaction={transaction} />
<ActionMenuSections
transaction={transaction}
profilingLocators={profilingLocators}
/>
{hasGoldLicense && <CustomLinkMenuSection transaction={transaction} />}
</ActionMenu>
</>
);
}

function ActionMenuSections({ transaction }: { transaction?: Transaction }) {
function ActionMenuSections({
transaction,
profilingLocators,
}: {
transaction?: Transaction;
profilingLocators?: ProfilingLocators;
}) {
const {
core,
uiActions,
Expand All @@ -108,6 +122,7 @@ function ActionMenuSections({ transaction }: { transaction?: Transaction }) {
apmRouter,
infraLocators: locators,
infraLinksAvailable,
profilingLocators,
});

const externalMenuItems = useAsync(() => {
Expand Down Expand Up @@ -156,6 +171,7 @@ function ActionMenuSections({ transaction }: { transaction?: Transaction }) {
label={action.label}
href={action.href}
onClick={action.onClick}
showNewBadge={action.showNewBadge}
/>
))}
</SectionLinks>
Expand Down
35 changes: 35 additions & 0 deletions x-pack/plugins/apm/public/hooks/use_profiling_plugin.tsx
Original file line number Diff line number Diff line change
@@ -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 { useEffect, useState } from 'react';
import { useApmPluginContext } from '../context/apm_plugin/use_apm_plugin_context';

export function useProfilingPlugin() {
const { plugins } = useApmPluginContext();
const [isProfilingPluginInitialized, setIsProfilingPluginInitialized] =
useState<boolean | undefined>();

useEffect(() => {
async function fetchIsProfilingSetup() {
if (!plugins.profiling) {
setIsProfilingPluginInitialized(false);
return;
}
const resp = await plugins.profiling.hasSetup();
setIsProfilingPluginInitialized(resp);
}

fetchIsProfilingSetup();
}, [plugins.profiling]);

return {
isProfilingPluginInitialized,
profilingLocators: isProfilingPluginInitialized
? plugins.profiling?.locators
: undefined,
};
}
6 changes: 6 additions & 0 deletions x-pack/plugins/apm/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ import { FieldFormatsStart } from '@kbn/field-formats-plugin/public';
import { UiActionsStart, UiActionsSetup } from '@kbn/ui-actions-plugin/public';
import { ObservabilityTriggerId } from '@kbn/observability-shared-plugin/common';
import { LicenseManagementUIPluginSetup } from '@kbn/license-management-plugin/public';
import {
ProfilingPluginSetup,
ProfilingPluginStart,
} from '@kbn/profiling-plugin/public';
import {
DiscoverStart,
DiscoverSetup,
Expand Down Expand Up @@ -98,6 +102,7 @@ export interface ApmPluginSetupDeps {
triggersActionsUi: TriggersAndActionsUIPublicPluginSetup;
share: SharePluginSetup;
uiActions: UiActionsSetup;
profiling?: ProfilingPluginSetup;
}

export interface ApmPluginStartDeps {
Expand All @@ -124,6 +129,7 @@ export interface ApmPluginStartDeps {
storage: IStorageWrapper;
lens: LensPublicStart;
uiActions: UiActionsStart;
profiling?: ProfilingPluginStart;
}

const servicesTitle = i18n.translate('xpack.apm.navigation.servicesTitle', {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/apm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"@kbn/dashboard-plugin",
"@kbn/controls-plugin",
"@kbn/core-http-server",
"@kbn/profiling-plugin",
"@kbn/logs-shared-plugin",
"@kbn/unified-field-list",
"@kbn/slo-schema",
Expand Down
11 changes: 10 additions & 1 deletion x-pack/plugins/cases/common/api/cases/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
MAX_ASSIGNEES_FILTER_LENGTH,
MAX_REPORTERS_FILTER_LENGTH,
MAX_TAGS_FILTER_LENGTH,
MAX_CASES_TO_UPDATE,
MAX_BULK_GET_CASES,
MAX_CASES_PER_PAGE,
} from '../../constants';
Expand Down Expand Up @@ -461,7 +462,15 @@ export const CasePatchRequestRt = rt.intersection([
rt.strict({ id: rt.string, version: rt.string }),
]);

export const CasesPatchRequestRt = rt.strict({ cases: rt.array(CasePatchRequestRt) });
export const CasesPatchRequestRt = rt.strict({
cases: limitedArraySchema({
codec: CasePatchRequestRt,
min: 1,
max: MAX_CASES_TO_UPDATE,
fieldName: 'cases',
}),
});

export const CasesRt = rt.array(CaseRt);

export const CasePushRequestParamsRt = rt.strict({
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/cases/common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export const MAX_COMMENT_LENGTH = 30000 as const;
export const MAX_LENGTH_PER_TAG = 256 as const;
export const MAX_TAGS_PER_CASE = 200 as const;
export const MAX_DELETE_IDS_LENGTH = 100 as const;
export const MAX_CASES_TO_UPDATE = 100 as const;

/**
* Cases features
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/cases/docs/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -5198,6 +5198,8 @@
"cases": {
"type": "array",
"description": "An array containing one or more case objects.",
"maxItems": 100,
"minItems": 1,
"items": {
"type": "object",
"required": [
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/cases/docs/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3337,6 +3337,8 @@ components:
cases:
type: array
description: An array containing one or more case objects.
maxItems: 100
minItems: 1
items:
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ properties:
cases:
type: array
description: An array containing one or more case objects.
maxItems: 100
minItems: 1
items:
type: object
required:
Expand Down Expand Up @@ -35,7 +37,7 @@ properties:
settings:
$ref: 'settings.yaml'
severity:
$ref: 'severity_property.yaml'
$ref: 'severity_property.yaml'
status:
$ref: 'status.yaml'
tags:
Expand All @@ -55,4 +57,4 @@ properties:
maxLength: 160
version:
description: The current version of the case. To determine this value, use the get case or find cases APIs.
type: string
type: string
Loading

0 comments on commit d700b1b

Please sign in to comment.