Skip to content

Commit

Permalink
[APM] Add UI Indices runtime configuration (#48079)
Browse files Browse the repository at this point in the history
* Add UI Indices runtime configuration
- index configuration in settings page
- defaults to kibana.yml configuration values

* fix tests

* Code review feedback and cleanup

* fix i18n

* Code review feedback

* Address code review feedback.

* Fixes bug where legacy data filter was including the
.apm-agent-configuration index which caused failures in those APIs
  • Loading branch information
ogupte authored Oct 29, 2019
1 parent 13fb20f commit c3996e2
Show file tree
Hide file tree
Showing 57 changed files with 826 additions and 169 deletions.
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']
],
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"
},
"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

0 comments on commit c3996e2

Please sign in to comment.