Skip to content

Commit

Permalink
Merge branch 'main' into test/162593/kbn-es-serverless-ftr
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski authored Aug 30, 2023
2 parents f1fee62 + a511426 commit c54fb7b
Show file tree
Hide file tree
Showing 28 changed files with 516 additions and 214 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/create-deploy-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
# on the main branch only in a verification step.
# This is only to prevent accidental creation of the tag on other branches and cannot be used to prevent malicious creation of the tag.

name: create-deploy-tag
name: Initiate Serverless Deploy

on:
workflow_dispatch:
inputs:
commit:
description: "The commit to tag (default: latest commit on main)"
description: "The commit to deploy (default: latest commit on main)"

concurrency:
group: ${{ github.workflow }}
Expand All @@ -30,10 +30,10 @@ jobs:
run: |
commit="${{ github.event.inputs.commit || github.sha }}"
echo "COMMIT=${commit}" >> "${GITHUB_ENV}"
- name: Verify selected commit isn't already tagged
- name: Verify selected or newer commit isn't already tagged
run: |
git tag --contains ${COMMIT} | grep -P "^deploy@\d+$" && {
echo "Tag already exists on selected commit"
echo "A deploy-tag already exists on the selected or newer commit!"
exit 1
} || true
- name: Verify branch
Expand All @@ -51,10 +51,10 @@ jobs:
git tag ${TAG_NAME} ${COMMIT}
git push origin "refs/tags/${TAG_NAME}"
- if: always()
uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current
id: slack
uses: slackapi/[email protected]
with:
message: ${{ job.status == 'success' && format('Created tag `{0}` for commit `{1}`', env.TAG_NAME, env.COMMIT) || 'Creating a deploy tag failed' }}
vaultUrl: ${{ secrets.VAULT_ADDR }}
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
slackChannel: "#kibana-mission-control"
channel-id: kibana-mission-control
slack-message: ${{ job.status == 'success' && format('Created tag `{0}` for commit `{1}`', env.TAG_NAME, env.COMMIT) || 'Creating a deploy tag failed. See https://github.com/elastic/kibana/actions/workflows/create-deploy-tag.yml' }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const applicationUsageSchema = {
enterpriseSearchApplications: commonSchema,
enterpriseSearchEsre: commonSchema,
enterpriseSearchVectorSearch: commonSchema,
elasticsearch: commonSchema,
enterpriseSearchElasticsearch: commonSchema,
appSearch: commonSchema,
workplaceSearch: commonSchema,
searchExperiences: commonSchema,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2622,7 +2622,7 @@
}
}
},
"elasticsearch": {
"enterpriseSearchElasticsearch": {
"properties": {
"appId": {
"type": "keyword",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/enterprise_search/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const ANALYTICS_PLUGIN = {
};

export const ELASTICSEARCH_PLUGIN = {
ID: 'elasticsearch',
ID: 'enterpriseSearchElasticsearch',
NAME: i18n.translate('xpack.enterpriseSearch.elasticsearch.productName', {
defaultMessage: 'Elasticsearch',
}),
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/enterprise_search/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class EnterpriseSearchPlugin implements Plugin<void, EnterpriseSearchPlug
enterpriseSearchApplications: showEnterpriseSearch,
enterpriseSearchEsre: showEnterpriseSearch,
enterpriseSearchVectorSearch: showEnterpriseSearch,
elasticsearch: showEnterpriseSearch,
enterpriseSearchElasticsearch: showEnterpriseSearch,
appSearch: hasAppSearchAccess && config.canDeployEntSearch,
workplaceSearch: hasWorkplaceSearchAccess && config.canDeployEntSearch,
searchExperiences: showEnterpriseSearch,
Expand All @@ -215,7 +215,7 @@ export class EnterpriseSearchPlugin implements Plugin<void, EnterpriseSearchPlug
enterpriseSearchApplications: showEnterpriseSearch,
enterpriseSearchEsre: showEnterpriseSearch,
enterpriseSearchVectorSearch: showEnterpriseSearch,
elasticsearch: showEnterpriseSearch,
enterpriseSearchElasticsearch: showEnterpriseSearch,
appSearch: hasAppSearchAccess && config.canDeployEntSearch,
workplaceSearch: hasWorkplaceSearchAccess && config.canDeployEntSearch,
searchExperiences: showEnterpriseSearch,
Expand Down
10 changes: 9 additions & 1 deletion x-pack/plugins/infra/common/http_api/metadata_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ export const InfraMetadataInfoRT = rt.partial({
cloud: InfraMetadataCloudRT,
host: InfraMetadataHostRT,
agent: InfraMetadataAgentRT,
'@timestamp': rt.string,
});

export const InfraMetadataInfoResponseRT = rt.partial({
cloud: InfraMetadataCloudRT,
host: InfraMetadataHostRT,
agent: InfraMetadataAgentRT,
timestamp: rt.string,
});

const InfraMetadataRequiredRT = rt.type({
Expand All @@ -92,7 +100,7 @@ const InfraMetadataRequiredRT = rt.type({
});

const InfraMetadataOptionalRT = rt.partial({
info: InfraMetadataInfoRT,
info: InfraMetadataInfoResponseRT,
});

export const InfraMetadataRT = rt.intersection([InfraMetadataRequiredRT, InfraMetadataOptionalRT]);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* 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 { EuiText, EuiLink } from '@elastic/eui';
import { FormattedDate, FormattedMessage, FormattedTime } from '@kbn/i18n-react';
import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui';
import { Popover } from '../tabs/common/popover';
import { useMetadataStateProviderContext } from '../hooks/use_metadata_state';

const HOSTNAME_DOCS_LINK =
'https://www.elastic.co/guide/en/ecs/current/ecs-host.html#field-host-name';

const MetadataExplanationTooltipContent = React.memo(() => {
const onClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
e.stopPropagation();
};

return (
<EuiText size="s" onClick={onClick} style={{ width: 200 }}>
<FormattedMessage
id="xpack.infra.assetDetails.metadata.tooltip.documentationLabel"
defaultMessage="{metadata} is populated from the last event detected for this {hostName} for the selected date period."
values={{
metadata: (
<i>
<FormattedMessage
id="xpack.infra.assetDetails.metadata.tooltip.metadata"
defaultMessage="Metadata"
/>
</i>
),
hostName: (
<EuiLink
data-test-subj="infraAssetDetailsTooltipDocumentationLink"
href={HOSTNAME_DOCS_LINK}
target="_blank"
>
<FormattedMessage
id="xpack.infra.assetDetails.metadata.tooltip.documentationLink"
defaultMessage="host.name"
/>
</EuiLink>
),
}}
/>
</EuiText>
);
});

export const MetadataExplanationMessage = () => {
const { metadata, loading } = useMetadataStateProviderContext();

return loading ? (
<EuiLoadingSpinner />
) : metadata?.info?.timestamp ? (
<EuiFlexGroup gutterSize="xs" alignItems="baseline">
<EuiFlexItem grow={false}>
<EuiText size="xs" color="subdued">
<FormattedMessage
id="xpack.infra.assetDetails.metadata.tooltip.metadataSectionTitle"
defaultMessage="Showing metadata collected on {date} @ {time}"
values={{
date: (
<FormattedDate
value={new Date(metadata?.info?.timestamp)}
month="short"
day="numeric"
year="numeric"
/>
),
time: (
<FormattedTime
value={new Date(metadata?.info?.timestamp)}
hour12={false}
hour="2-digit"
minute="2-digit"
second="2-digit"
/>
),
}}
/>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<Popover
iconSize="s"
iconColor="subdued"
icon="iInCircle"
panelPaddingSize="m"
data-test-subj="infraAssetDetailsMetadataPopoverButton"
>
<MetadataExplanationTooltipContent />
</Popover>
</EuiFlexItem>
</EuiFlexGroup>
) : null;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* 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 { EuiText, EuiLink } from '@elastic/eui';
import { FormattedDate, FormattedMessage, FormattedTime } from '@kbn/i18n-react';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { useDateRangeProviderContext } from '../hooks/use_date_range';
import { Popover } from '../tabs/common/popover';

const DOCUMENTATION_LINK =
'https://www.elastic.co/guide/en/observability/current/view-infrastructure-metrics.html';
const SYSTEM_INTEGRATION_DOCS_LINK = 'https://docs.elastic.co/en/integrations/system';

const ProcessesExplanationTooltipContent = React.memo(() => {
const onClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
e.stopPropagation();
};

return (
<EuiText size="s" onClick={onClick} style={{ width: 300 }}>
<p>
<FormattedMessage
id="xpack.infra.assetDetails.processes.tooltip.explanationLabel"
defaultMessage="The processes listed are based on an aggregation of the top CPU and the top memory consuming processes for the 1 minute preceding the end date of the selected time period. The number of top processes is configurable in the {systemIntegration}."
values={{
systemIntegration: (
<EuiLink
data-test-subj="infraAssetDetailsTooltipSystemIntegrationDocumentationLink"
href={SYSTEM_INTEGRATION_DOCS_LINK}
target="_blank"
>
<FormattedMessage
id="xpack.infra.assetDetails.processes.tooltip.systemIntegrationDocumentationLink"
defaultMessage="System Integration"
/>
</EuiLink>
),
}}
/>
</p>
<p>
<FormattedMessage
id="xpack.infra.assetDetails.processes.tooltip.documentationLabel"
defaultMessage="Please see the following {documentation} for more details on processes."
values={{
documentation: (
<EuiLink
data-test-subj="infraAssetDetailsTooltipDocumentationLink"
href={DOCUMENTATION_LINK}
target="_blank"
>
<FormattedMessage
id="xpack.infra.assetDetails.processes.tooltip.documentationLink"
defaultMessage="documentation"
/>
</EuiLink>
),
}}
/>
</p>
</EuiText>
);
});

export const ProcessesExplanationMessage = () => {
const { getDateRangeInTimestamp } = useDateRangeProviderContext();
const dateFromRange = new Date(getDateRangeInTimestamp().to);

return (
<EuiFlexGroup gutterSize="xs" alignItems="baseline">
<EuiFlexItem grow={false}>
<EuiText size="xs" color="subdued">
<FormattedMessage
id="xpack.infra.assetDetails.overview.processesSectionTitle"
defaultMessage="Showing process data collected for the 1 minute preceding {date} @ {time}"
values={{
date: (
<FormattedDate value={dateFromRange} month="short" day="numeric" year="numeric" />
),
time: (
<FormattedTime
value={dateFromRange}
hour12={false}
hour="2-digit"
minute="2-digit"
second="2-digit"
/>
),
}}
/>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<Popover
iconSize="s"
iconColor="subdued"
icon="iInCircle"
panelPaddingSize="m"
data-test-subj="infraAssetDetailsProcessesPopoverButton"
>
<ProcessesExplanationTooltipContent />
</Popover>
</EuiFlexItem>
</EuiFlexGroup>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,37 @@
* 2.0.
*/

import { EuiPopover, EuiIcon, IconType } from '@elastic/eui';
import { PanelPaddingSize } from '@elastic/eui';
import { EuiPopover, EuiIcon, type IconType, type IconColor, type IconSize } from '@elastic/eui';
import { css } from '@emotion/react';
import React from 'react';
import { useBoolean } from '../../../../hooks/use_boolean';

export const Popover = ({
children,
icon,
iconColor,
iconSize,
panelPaddingSize,
...props
}: {
children: React.ReactNode;
icon: IconType;
iconColor?: IconColor;
iconSize?: IconSize;
panelPaddingSize?: PanelPaddingSize;
'data-test-subj'?: string;
}) => {
const [isPopoverOpen, { off: closePopover, toggle: togglePopover }] = useBoolean(false);
return (
<EuiPopover
panelPaddingSize="s"
panelPaddingSize={panelPaddingSize ?? 's'}
button={
<EuiIcon
data-test-subj={props['data-test-subj']}
type={icon}
color={iconColor ?? 'text'}
size={iconSize ?? 'original'}
onClick={togglePopover}
css={css`
cursor: pointer;
Expand Down
Loading

0 comments on commit c54fb7b

Please sign in to comment.