Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APM Experiments settings #81554

Merged
merged 3 commits into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions x-pack/plugins/apm/common/ui_settings_keys.ts
Original file line number Diff line number Diff line change
@@ -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;
* you may not use this file except in compliance with the Elastic License.
*/

export const enableCorrelations = 'apm:enableCorrelations';
export const enableServiceOverview = 'apm:enableServiceOverview';
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { EuiTabs } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { isJavaAgentName, isRumAgentName } from '../../../../common/agent_name';
import { enableServiceOverview } from '../../../../common/ui_settings_keys';
import { useAgentName } from '../../../hooks/useAgentName';
import { useApmPluginContext } from '../../../hooks/useApmPluginContext';
import { EuiTabLink } from '../../shared/EuiTabLink';
Expand All @@ -29,7 +30,19 @@ interface Props {

export function ServiceDetailTabs({ serviceName, tab }: Props) {
const { agentName } = useAgentName();
const { serviceMapEnabled } = useApmPluginContext().config;
const { uiSettings } = useApmPluginContext().core;

const overviewTab = {
link: (
<a title="UNDER CONSTRUCTION" href="#">
Copy link
Contributor

@ogupte ogupte Oct 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is UNDER CONSTRUCTION intentional because it's an experiment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It's just a placeholder and behind the flag and will be replaced in #81718.

{i18n.translate('xpack.apm.serviceDetails.overviewTabLabel', {
defaultMessage: 'Overview',
})}
</a>
),
render: () => <></>,
name: 'overview',
};

const transactionsTab = {
link: (
Expand Down Expand Up @@ -57,7 +70,23 @@ export function ServiceDetailTabs({ serviceName, tab }: Props) {
name: 'errors',
};

const tabs = [transactionsTab, errorsTab];
const serviceMapTab = {
link: (
<ServiceMapLink serviceName={serviceName}>
{i18n.translate('xpack.apm.home.serviceMapTabLabel', {
defaultMessage: 'Service Map',
})}
</ServiceMapLink>
),
render: () => <ServiceMap serviceName={serviceName} />,
name: 'service-map',
};

const tabs = [transactionsTab, errorsTab, serviceMapTab];

if (uiSettings.get(enableServiceOverview)) {
tabs.unshift(overviewTab);
}
Copy link
Contributor

@ogupte ogupte Oct 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're initializing tabs here anyways we can avoid an array mutation:

const tabs = uiSettings.get(enableServiceOverview) ? 
    [overviewTab, transactionsTab, errorsTab, serviceMapTab] : 
    [transactionsTab, errorsTab, serviceMapTab];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left the mutation since we're pushing on to the array later anyway and I thought is was clearer.


if (isJavaAgentName(agentName)) {
const nodesListTab = {
Expand Down Expand Up @@ -89,22 +118,6 @@ export function ServiceDetailTabs({ serviceName, tab }: Props) {
tabs.push(metricsTab);
}

const serviceMapTab = {
link: (
<ServiceMapLink serviceName={serviceName}>
{i18n.translate('xpack.apm.home.serviceMapTabLabel', {
defaultMessage: 'Service Map',
})}
</ServiceMapLink>
),
render: () => <ServiceMap serviceName={serviceName} />,
name: 'service-map',
};

if (serviceMapEnabled) {
tabs.push(serviceMapTab);
}

const selectedTab = tabs.find((serviceTab) => serviceTab.name === tab);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import {
EuiButton,
EuiFlexGroup,
Expand Down Expand Up @@ -37,14 +36,22 @@ export function AgentConfigurations() {

return (
<>
<EuiTitle size="l">
<h1>
{i18n.translate('xpack.apm.agentConfig.titleText', {
defaultMessage: 'Agent remote configuration',
})}
</h1>
</EuiTitle>
<EuiSpacer size="l" />
<EuiPanel>
<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={false}>
<EuiTitle>
<h2>
{i18n.translate(
'xpack.apm.agentConfig.configurationsPanelTitle',
{ defaultMessage: 'Agent remote configuration' }
{ defaultMessage: 'Configurations' }
)}
</h2>
</EuiTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ describe('ApmIndices', () => {
);

expect(getByText('Indices')).toMatchInlineSnapshot(`
<h2
class="euiTitle euiTitle--medium"
<h1
class="euiTitle euiTitle--large"
>
Indices
</h2>
</h1>
`);

expect(spy).toHaveBeenCalledTimes(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,24 @@ export function ApmIndices() {
};

return (
<EuiPanel>
<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={false}>
<EuiTitle>
<h2>
{i18n.translate('xpack.apm.settings.apmIndices.title', {
defaultMessage: 'Indices',
})}
</h2>
</EuiTitle>
<EuiSpacer size="m" />
<EuiText size="s" grow={false}>
<p>
{i18n.translate('xpack.apm.settings.apmIndices.description', {
defaultMessage: `The APM UI uses index patterns to query your APM indices. If you've customized the index names that APM Server writes events to, you may need to update these patterns for the APM UI to work. Settings here take precedence over those set in kibana.yml.`,
})}
</p>
<>
<EuiTitle size="l">
<h1>
{i18n.translate('xpack.apm.settings.apmIndices.title', {
defaultMessage: 'Indices',
})}
</h1>
</EuiTitle>
<EuiSpacer size="l" />
<EuiText>
{i18n.translate('xpack.apm.settings.apmIndices.description', {
defaultMessage: `The APM UI uses index patterns to query your APM indices. If you've customized the index names that APM Server writes events to, you may need to update these patterns for the APM UI to work. Settings here take precedence over those set in kibana.yml.`,
})}
</EuiText>
<EuiSpacer size="l" />
<EuiPanel>
<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={false}>
<EuiForm>
{APM_INDEX_LABELS.map(({ configurationName, label }) => {
const matchedConfiguration = data.find(
Expand Down Expand Up @@ -239,11 +240,10 @@ export function ApmIndices() {
</EuiFlexItem>
</EuiFlexGroup>
</EuiForm>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>

<EuiSpacer size="m" />
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="m" />
</EuiPanel>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n';

export function CreateCustomLinkButton({ onClick }: { onClick: () => void }) {
return (
<EuiButton color="primary" fill onClick={onClick}>
<EuiButton color="primary" fill iconType="plusInCircle" onClick={onClick}>
{i18n.translate(
'xpack.apm.settings.customizeUI.customLink.createCustomLink',
{ defaultMessage: 'Create custom link' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,23 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { EuiFlexGroup, EuiFlexItem, EuiIconTip, EuiTitle } from '@elastic/eui';

import { EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';

export function Title() {
return (
<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={false}>
<EuiTitle size="s">
<EuiTitle>
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false}>
<EuiFlexItem grow={false}>
<h1>
<h2>
{i18n.translate('xpack.apm.settings.customizeUI.customLink', {
defaultMessage: 'Custom Links',
})}
</h1>
</EuiFlexItem>

<EuiFlexItem grow={false}>
<EuiIconTip
type="iInCircle"
position="top"
content={i18n.translate(
'xpack.apm.settings.customizeUI.customLink.info',
{
defaultMessage:
'These links will be shown in the Actions context menu for transactions.',
}
)}
/>
</h2>
</EuiFlexItem>
</EuiFlexGroup>
</EuiTitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,26 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiPanel, EuiSpacer, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import {
EuiFlexGroup,
EuiFlexItem,
EuiPanel,
EuiSpacer,
EuiText,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { isEmpty } from 'lodash';
import React, { useEffect, useState } from 'react';
import { INVALID_LICENSE } from '../../../../../../common/custom_link';
import { CustomLink } from '../../../../../../common/custom_link/custom_link_types';
import { FETCH_STATUS, useFetcher } from '../../../../../hooks/useFetcher';
import { useLicense } from '../../../../../hooks/useLicense';
import { useFetcher, FETCH_STATUS } from '../../../../../hooks/useFetcher';
import { LicensePrompt } from '../../../../shared/LicensePrompt';
import { CreateCustomLinkButton } from './CreateCustomLinkButton';
import { CustomLinkFlyout } from './CustomLinkFlyout';
import { CustomLinkTable } from './CustomLinkTable';
import { EmptyPrompt } from './EmptyPrompt';
import { Title } from './Title';
import { CreateCustomLinkButton } from './CreateCustomLinkButton';
import { LicensePrompt } from '../../../../shared/LicensePrompt';

export function CustomLinkOverview() {
const license = useLicense();
Expand Down Expand Up @@ -82,8 +89,13 @@ export function CustomLinkOverview() {
</EuiFlexItem>
)}
</EuiFlexGroup>

<EuiSpacer size="m" />
<EuiSpacer size="l" />
<EuiText>
{i18n.translate('xpack.apm.settings.customizeUI.customLink.info', {
defaultMessage:
'These links will be shown in the Actions context menu for transactions.',
})}
</EuiText>
{hasValidLicense ? (
showEmptyPrompt ? (
<EmptyPrompt onCreateCustomLinkClick={onCreateCustomLinkClick} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function JobsList({ data, status, onAddEnvironments }: Props) {
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton fill onClick={onAddEnvironments}>
<EuiButton fill iconType="plusInCircle" onClick={onAddEnvironments}>
{i18n.translate(
'xpack.apm.settings.anomalyDetection.jobList.addEnvironments',
{
Expand Down
Loading