Skip to content

Commit

Permalink
Merge branch 'main' into 172506-obsux-add-feedback-form-to-apm
Browse files Browse the repository at this point in the history
  • Loading branch information
jennypavlova authored Jan 4, 2024
2 parents c13ed03 + 1182ce6 commit c576542
Show file tree
Hide file tree
Showing 143 changed files with 4,469 additions and 1,702 deletions.
10 changes: 0 additions & 10 deletions .buildkite/pipelines/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ steps:
- exit_status: '*'
limit: 1

- command: KIBANA_DOCKER_CONTEXT=ubi8 .buildkite/scripts/steps/artifacts/docker_context.sh
label: 'Docker Context Verification'
agents:
queue: n2-2
timeout_in_minutes: 30
retry:
automatic:
- exit_status: '*'
limit: 1

- command: KIBANA_DOCKER_CONTEXT=ubi .buildkite/scripts/steps/artifacts/docker_context.sh
label: 'Docker Context Verification'
agents:
Expand Down
2 changes: 2 additions & 0 deletions docs/settings/fleet-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ See the {fleet-guide}/index.html[{fleet}] docs for more information about {fleet
`xpack.fleet.agents.enabled` {ess-icon}::
Set to `true` (default) to enable {fleet}.

`xpack.fleet.isAirGapped`::
Set to `true` to indicate {fleet} is running in an air-gapped environment. Refer to {fleet-guide}/air-gapped.html[Air-gapped environments] for details. Enabling this flag helps Fleet skip needless requests and improve the user experience for air-gapped environments.

[[fleet-data-visualizer-settings]]

Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/dashboard/group5/embed_mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ export default function ({
await browser.setWindowSize(1300, 900);
});

// FLAKY: https://github.com/elastic/kibana/issues/163207
describe.skip('default URL params', () => {
describe('default URL params', () => {
it('hides the chrome', async () => {
const globalNavShown = await globalNav.exists();
expect(globalNavShown).to.be(true);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import { waitFor } from '@testing-library/react';

jest.mock('../../../containers/api');

describe('EditTagsFlyout', () => {
// Failing: See https://github.com/elastic/kibana/issues/174176
// Failing: See https://github.com/elastic/kibana/issues/174177
describe.skip('EditTagsFlyout', () => {
let appMock: AppMockRenderer;

/**
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/common/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type {

export interface FleetConfigType {
enabled: boolean;
isAirGapped?: boolean;
registryUrl?: string;
registryProxyUrl?: string;
agents: {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const config: PluginConfigDescriptor = {
],
schema: schema.object(
{
isAirGapped: schema.maybe(schema.boolean({ defaultValue: false })),
registryUrl: schema.maybe(schema.uri({ scheme: ['http', 'https'] })),
registryProxyUrl: schema.maybe(schema.uri({ scheme: ['http', 'https'] })),
agents: schema.object({
Expand Down
21 changes: 18 additions & 3 deletions x-pack/plugins/fleet/server/services/agents/versions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
import { readFile } from 'fs/promises';

import fetch from 'node-fetch';
import type { DeepPartial } from 'utility-types';

import type { FleetConfigType } from '../../../public/plugin';

import { getAvailableVersions } from './versions';

let mockKibanaVersion = '300.0.0';
let mockConfig = {};
let mockConfig: DeepPartial<FleetConfigType> = {};

jest.mock('../app_context', () => {
const { loggerMock } = jest.requireActual('@kbn/logging-mocks');
return {
Expand All @@ -33,8 +39,6 @@ const emptyResponse = {
text: jest.fn().mockResolvedValue(JSON.stringify({})),
} as any;

import { getAvailableVersions } from './versions';

describe('getAvailableVersions', () => {
beforeEach(() => {
mockedReadFile.mockReset();
Expand Down Expand Up @@ -204,4 +208,15 @@ describe('getAvailableVersions', () => {
// Should sort, uniquify and filter out versions < 7.17
expect(res).toEqual(['8.1.0', '8.0.0', '7.17.0']);
});

it('should not fetch from product versions API when air-gapped config is set', async () => {
mockKibanaVersion = '300.0.0';
mockedReadFile.mockResolvedValue(`["8.1.0", "8.0.0", "7.17.0", "7.16.0"]`);

mockConfig = { isAirGapped: true };
const res = await getAvailableVersions({ ignoreCache: true });

expect(res).toEqual(['8.1.0', '8.0.0', '7.17.0']);
expect(mockedFetch).not.toBeCalled();
});
});
5 changes: 5 additions & 0 deletions x-pack/plugins/fleet/server/services/agents/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ export const getAvailableVersions = async ({
};

async function fetchAgentVersionsFromApi() {
// If the airgapped flag is set, do not attempt to reach out to the product versions API
if (appContextService.getConfig()?.isAirGapped) {
return [];
}

const logger = appContextService.getLogger();

const options = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
*/

import { i18n } from '@kbn/i18n';
import React from 'react';
import { ContentTabIds, type Tab } from '../../components/asset_details/types';
import { NewBadge } from '../../components/new_badge';

export const commonFlyoutTabs: Tab[] = [
{
Expand All @@ -32,6 +34,7 @@ export const commonFlyoutTabs: Tab[] = [
name: i18n.translate('xpack.infra.metrics.nodeDetails.tabs.profiling', {
defaultMessage: 'Universal Profiling',
}),
append: <NewBadge />,
},
{
id: ContentTabIds.LOGS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import React from 'react';
import { i18n } from '@kbn/i18n';
import { EuiButtonEmpty } from '@elastic/eui';
import { EuiBadge } from '@elastic/eui';
import { EuiFlexGroup } from '@elastic/eui';
import { NewBadge } from '../../../../new_badge';
import { useProfilingIntegrationSetting } from '../../../../../hooks/use_profiling_integration_setting';
import { useTabSwitcherContext } from '../../../hooks/use_tab_switcher';

Expand All @@ -28,21 +28,17 @@ export function CpuProfilingPrompt() {
gutterSize="s"
data-test-subj="infraAssetDetailsCPUProfilingPrompt"
>
<EuiBadge color="success">
{i18n.translate('xpack.infra.cpuProfilingPrompt.newBadgeLabel', {
defaultMessage: 'NEW',
})}
</EuiBadge>
<NewBadge />
<EuiFlexGroup alignItems="baseline" justifyContent="flexStart" gutterSize="xs">
{i18n.translate('xpack.infra.cpuProfilingPrompt.p.viewCPUBreakdownUsingLabel', {
{i18n.translate('xpack.infra.cpuProfilingPrompt.promptText', {
defaultMessage: 'View CPU Breakdown using',
})}
<EuiButtonEmpty
data-test-subj="infraCpuProfilingPromptProfilingButton"
onClick={() => showTab('profiling')}
flush="both"
>
{i18n.translate('xpack.infra.cpuProfilingPrompt.profilingButtonEmptyLabel', {
{i18n.translate('xpack.infra.cpuProfilingPrompt.profilingLinkLabel', {
defaultMessage: 'Profiling',
})}
</EuiButtonEmpty>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { findInventoryModel } from '@kbn/metrics-data-access-plugin/common';
import useAsync from 'react-use/lib/useAsync';
import { KPI_CHART_HEIGHT } from '../../../../../common/visualizations';
import { Kpi } from './kpi';
import { CpuProfilingPrompt } from './cpu_profiling_prompt';

interface Props {
dataView?: DataView;
Expand Down Expand Up @@ -49,7 +48,6 @@ export const KPIGrid = ({ assetName, dataView, dateRange }: Props) => {
assetName={assetName}
height={KPI_CHART_HEIGHT}
/>
{chartProps.id === 'cpuUsage' && <CpuProfilingPrompt />}
</EuiFlexItem>
))}
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { useDatePickerContext } from '../../hooks/use_date_picker';
import { SectionSeparator } from './section_separator';
import { MetadataErrorCallout } from '../../components/metadata_error_callout';
import { useIntersectingState } from '../../hooks/use_intersecting_state';
import { CpuProfilingPrompt } from './kpis/cpu_profiling_prompt';

export const Overview = () => {
const ref = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -63,6 +64,7 @@ export const Overview = () => {
<EuiFlexGroup direction="column" gutterSize="m" ref={ref}>
<EuiFlexItem grow={false}>
<KPIGrid assetName={asset.name} dateRange={state.dateRange} dataView={metrics.dataView} />
<CpuProfilingPrompt />
</EuiFlexItem>
<EuiFlexItem grow={false}>
{fetchMetadataError && !metadataLoading ? <MetadataErrorCallout /> : metadataSummarySection}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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, { useCallback } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiButton, EuiCallOut, EuiFlexGroup, EuiLink, EuiSpacer, EuiText } from '@elastic/eui';
import useLocalStorage from 'react-use/lib/useLocalStorage';

const LOCAL_STORAGE_KEY = 'infra-profiling-description-callout-dismissed';

export function DescriptionCallout() {
const [isDismissed, setIsDismissed] = useLocalStorage(LOCAL_STORAGE_KEY, false);

const onDismissClick = useCallback(() => setIsDismissed(true), [setIsDismissed]);

if (isDismissed) {
return null;
}

return (
<>
<EuiCallOut
title={i18n.translate('xpack.infra.profiling.descriptionCallout.title', {
defaultMessage: 'Displaying Resource Consumption for this Host',
})}
iconType="iInCircle"
>
<EuiText>
{i18n.translate('xpack.infra.profiling.descriptionCallout.body', {
defaultMessage:
'Universal Profiling helps you optimize resource usage and find performance bottlenecks by showing which lines of code are consuming resources on your host, down to the application code, kernel, and third-party libraries.',
})}
</EuiText>
<EuiSpacer />
<EuiFlexGroup alignItems="center">
<EuiLink
data-test-subj="infraProfilingDescriptionCalloutLearnMoreLink"
href="https://www.elastic.co/guide/en/observability/current/profiling-get-started.html"
external
target="_blank"
>
{i18n.translate('xpack.infra.profiling.descriptionCallout.learnMore', {
defaultMessage: 'Learn more',
})}
</EuiLink>
<EuiButton data-test-subj="infraDescriptionCalloutDismissButton" onClick={onDismissClick}>
{i18n.translate('xpack.infra.profiling.descriptionCallout.dismiss', {
defaultMessage: 'Dismiss',
})}
</EuiButton>
</EuiFlexGroup>
</EuiCallOut>
<EuiSpacer />
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
*/
import { i18n } from '@kbn/i18n';

import { EuiSpacer, EuiTabbedContent, type EuiTabbedContentProps } from '@elastic/eui';
import { EuiLink, EuiSpacer, EuiTabbedContent, type EuiTabbedContentProps } from '@elastic/eui';
import React from 'react';
import { ProfilingEmptyState } from '@kbn/observability-shared-plugin/public';
import { EuiLoadingSpinner } from '@elastic/eui';
import { css } from '@emotion/react';
import { EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { Flamegraph } from './flamegraph';
import { Functions } from './functions';
import { DatePicker } from '../../date_picker/date_picker';
Expand All @@ -19,6 +21,8 @@ import { useTabSwitcherContext } from '../../hooks/use_tab_switcher';
import { ContentTabIds } from '../../types';
import { ErrorPrompt } from './error_prompt';
import { Threads } from './threads';
import { DescriptionCallout } from './description_callout';
import { Popover } from '../common/popover';

export function Profiling() {
const { activeTabId } = useTabSwitcherContext();
Expand All @@ -38,6 +42,30 @@ export function Profiling() {
<Flamegraph />
</>
),
append: (
<Popover iconSize="s" iconColor="subdued" icon="questionInCircle">
<EuiText size="xs">
<FormattedMessage
id="xpack.infra.profiling.flamegraphInfoPopoverBody"
defaultMessage="See a visual representation of the functions that consume the most resources. Each rectangle represents a function. The rectangle width represents the time spent in the function, and the number of stacked rectangles represents the number of functions called to reach the current function. {learnMoreLink}"
values={{
learnMoreLink: (
<EuiLink
data-test-subj="infraProfilingFlamegraphTabLearnMoreLink"
href="https://www.elastic.co/guide/en/observability/current/universal-profiling.html#profiling-flamegraphs-intro"
external
target="_blank"
>
{i18n.translate('xpack.infra.profiling.flamegraphTabLearnMoreLink', {
defaultMessage: 'Learn more',
})}
</EuiLink>
),
}}
/>
</EuiText>
</Popover>
),
},
{
id: 'functions',
Expand All @@ -50,6 +78,30 @@ export function Profiling() {
<Functions />
</>
),
append: (
<Popover iconSize="s" iconColor="subdued" icon="questionInCircle">
<EuiText size="xs">
<FormattedMessage
id="xpack.infra.profiling.functionsInfoPopoverBody"
defaultMessage="Identify the most expensive lines of code on your host by looking at the most frequently sampled functions, broken down by CPU time, annualized CO2, and annualized cost estimates. {learnMoreLink}"
values={{
learnMoreLink: (
<EuiLink
data-test-subj="infraProfilingFunctionsTabLearnMoreLink"
href="https://www.elastic.co/guide/en/observability/current/universal-profiling.html#profiling-functions-intro"
external
target="_blank"
>
{i18n.translate('xpack.infra.profiling.functionsTabLearnMoreLink', {
defaultMessage: 'Learn more',
})}
</EuiLink>
),
}}
/>
</EuiText>
</Popover>
),
},
{
id: 'threads',
Expand Down Expand Up @@ -89,6 +141,7 @@ export function Profiling() {
) : (
<>
<DatePicker />
<DescriptionCallout />
<EuiTabbedContent tabs={tabs} initialSelectedTab={tabs[0]} />
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function ProfilingLinks({
target="_blank"
>
{i18n.translate('xpack.infra.flamegraph.profilingFeedbackLink', {
defaultMessage: 'Give feedback about profiling',
defaultMessage: 'Give feedback',
})}
</EuiLink>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export type RenderMode = FlyoutProps | FullPageProps;
export interface Tab {
id: ContentTabIds;
name: string;
append?: JSX.Element;
}

export type LinkOptions = 'alertRule' | 'nodeDetails' | 'apmServices';
Expand Down
18 changes: 18 additions & 0 deletions x-pack/plugins/infra/public/components/new_badge.tsx
Original file line number Diff line number Diff line change
@@ -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 { EuiBadge } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';

export const NewBadge = () => (
<EuiBadge color="accent">
{i18n.translate('xpack.infra.newBadgeLabel', {
defaultMessage: 'NEW',
})}
</EuiBadge>
);
Loading

0 comments on commit c576542

Please sign in to comment.