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] Add UI Indices runtime configuration #48079

Merged
merged 7 commits into from
Oct 29, 2019
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
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/apm/common/projections/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export function getErrorGroupsProjection({
setup: Setup;
serviceName: string;
}) {
const { start, end, uiFiltersES, config } = setup;
const { start, end, uiFiltersES, indices } = setup;

return {
index: config.get<string>('apm_oss.errorIndices'),
index: indices['apm_oss.errorIndices'],
body: {
query: {
bool: {
Expand Down
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/apm/common/projections/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function getMetricsProjection({
serviceName: string;
serviceNodeName?: string;
}) {
const { start, end, uiFiltersES, config } = setup;
const { start, end, uiFiltersES, indices } = setup;

const filter = [
{ term: { [SERVICE_NAME]: serviceName } },
Expand All @@ -45,7 +45,7 @@ export function getMetricsProjection({
];

return {
index: config.get<string>('apm_oss.metricsIndices'),
index: indices['apm_oss.metricsIndices'],
body: {
query: {
bool: {
Expand Down
8 changes: 4 additions & 4 deletions x-pack/legacy/plugins/apm/common/projections/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { SERVICE_NAME, PROCESSOR_EVENT } from '../elasticsearch_fieldnames';
import { rangeFilter } from '../../server/lib/helpers/range_filter';

export function getServicesProjection({ setup }: { setup: Setup }) {
const { start, end, uiFiltersES, config } = setup;
const { start, end, uiFiltersES, indices } = setup;

return {
index: [
config.get<string>('apm_oss.metricsIndices'),
config.get<string>('apm_oss.errorIndices'),
config.get<string>('apm_oss.transactionIndices')
indices['apm_oss.metricsIndices'],
indices['apm_oss.errorIndices'],
indices['apm_oss.transactionIndices']
Copy link
Member

@sorenlouv sorenlouv Oct 25, 2019

Choose a reason for hiding this comment

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

Each config options can contain a comma separated list of several options. This is mostly used for CCS like apm-*, *:apm-*:

index: [
  'apm-*-transaction-*, *:apm-*-transaction-*',
  'apm-*-span-*, *:apm-*-span-*',
  'apm-*-error-*, *:apm-*-error-*'
]

Can you make sure that queries work with comma-separated strings?

],
body: {
size: 0,
Expand Down
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/apm/common/projections/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function getTransactionsProjection({
transactionName?: string;
transactionType?: string;
}) {
const { start, end, uiFiltersES, config } = setup;
const { start, end, uiFiltersES, indices } = setup;

const transactionNameFilter = transactionName
? [{ term: { [TRANSACTION_NAME]: transactionName } }]
Expand All @@ -48,7 +48,7 @@ export function getTransactionsProjection({
};

return {
index: config.get<string>('apm_oss.transactionIndices'),
index: indices['apm_oss.transactionIndices'],
body: {
query: {
bool
Expand Down
3 changes: 1 addition & 2 deletions x-pack/legacy/plugins/apm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ export const apm: LegacyPluginInitializer = kibana => {
apmUiEnabled: config.get('xpack.apm.ui.enabled'),
// TODO: rename to apm_oss.indexPatternTitle in 7.0 (breaking change)
apmIndexPatternTitle: config.get('apm_oss.indexPattern'),
apmServiceMapEnabled: config.get('xpack.apm.serviceMapEnabled'),
apmTransactionIndices: config.get('apm_oss.transactionIndices')
apmServiceMapEnabled: config.get('xpack.apm.serviceMapEnabled')
};
},
hacks: ['plugins/apm/hacks/toggle_app_link_in_nav'],
Expand Down
25 changes: 25 additions & 0 deletions x-pack/legacy/plugins/apm/mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,30 @@
}
}
}
},
"apm-indices": {
"properties": {
"apm_oss.sourcemapIndices": {
"type": "keyword"
},
Copy link
Member

@sorenlouv sorenlouv Oct 25, 2019

Choose a reason for hiding this comment

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

Seems like a good move to flatten the option keys 👍

"apm_oss.errorIndices": {
"type": "keyword"
},
"apm_oss.onboardingIndices": {
"type": "keyword"
},
"apm_oss.spanIndices": {
"type": "keyword"
},
"apm_oss.transactionIndices": {
"type": "keyword"
},
"apm_oss.metricsIndices": {
"type": "keyword"
},
"apm_oss.apmAgentConfigurationIndex": {
"type": "keyword"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import { TransactionDetails } from '../../TransactionDetails';
import { Home } from '../../Home';
import { BreadcrumbRoute } from '../ProvideBreadcrumbs';
import { RouteName } from './route_names';
import { Settings } from '../../Settings';
import { AgentConfigurations } from '../../Settings/AgentConfigurations';
import { ApmIndices } from '../../Settings/ApmIndices';
import { toQuery } from '../../../shared/Links/url_helpers';
import { ServiceNodeMetrics } from '../../ServiceNodeMetrics';
import { resolveUrlParams } from '../../../../context/UrlParamsContext/resolveUrlParams';
Expand Down Expand Up @@ -69,12 +71,41 @@ export const routes: BreadcrumbRoute[] = [
{
exact: true,
path: '/settings',
component: AgentConfigurations,
render: renderAsRedirectTo('/settings/agent-configuration'),
breadcrumb: i18n.translate('xpack.apm.breadcrumb.listSettingsTitle', {
defaultMessage: 'Settings'
}),
name: RouteName.SETTINGS
},
{
exact: true,
path: '/settings/apm-indices',
component: () => (
<Settings>
<ApmIndices />
</Settings>
),
breadcrumb: i18n.translate('xpack.apm.breadcrumb.settings.indicesTitle', {
defaultMessage: 'Indices'
}),
name: RouteName.INDICES
},
{
exact: true,
path: '/settings/agent-configuration',
component: () => (
<Settings>
<AgentConfigurations />
</Settings>
),
breadcrumb: i18n.translate(
'xpack.apm.breadcrumb.settings.agentConfigurationTitle',
{
defaultMessage: 'Agent Configuration'
}
),
name: RouteName.AGENT_CONFIGURATION
},
{
exact: true,
path: '/services/:serviceName',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ export enum RouteName {
TRANSACTION_TYPE = 'transaction_type',
TRANSACTION_NAME = 'transaction_name',
SETTINGS = 'settings',
AGENT_CONFIGURATION = 'agent_configuration',
INDICES = 'indices',
SERVICE_NODES = 'nodes'
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import {
EuiTitle,
EuiFlexGroup,
EuiFlexItem,
EuiButtonEmpty,
EuiPanel,
EuiSpacer,
EuiButton
} from '@elastic/eui';
import { isEmpty } from 'lodash';
import { useFetcher } from '../../../../hooks/useFetcher';
import { AgentConfigurationListAPIResponse } from '../../../../../server/lib/settings/agent_configuration/list_configurations';
import { HomeLink } from '../../../shared/Links/apm/HomeLink';
import { AgentConfigurationList } from './AgentConfigurationList';
import { useTrackPageview } from '../../../../../../infra/public';
import { AddEditFlyout } from './AddEditFlyout';
Expand Down Expand Up @@ -62,30 +60,6 @@ export function AgentConfigurations() {
/>
)}

<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={false}>
<EuiTitle size="l">
<h1>
{i18n.translate('xpack.apm.settings.agentConf.pageTitle', {
defaultMessage: 'Settings'
})}
</h1>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<HomeLink>
<EuiButtonEmpty size="s" color="primary" iconType="arrowLeft">
{i18n.translate(
'xpack.apm.settings.agentConf.returnToOverviewLinkLabel',
{ defaultMessage: 'Return to overview' }
)}
</EuiButtonEmpty>
</HomeLink>
</EuiFlexItem>
</EuiFlexGroup>

<EuiSpacer size="l" />

<EuiPanel>
<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={false}>
Expand Down
Loading