Skip to content

Commit

Permalink
Merge branch 'master' into reporting/switch-to-tm-pre
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Sep 21, 2020
2 parents 42dc16a + e15b4c4 commit 9c13f38
Show file tree
Hide file tree
Showing 53 changed files with 625 additions and 1,876 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,77 @@
*/

import { i18n } from '@kbn/i18n';
import { get } from 'lodash';

export function getPainlessError(error: Error) {
const rootCause: Array<{ lang: string; script: string }> | undefined = get(
error,
'body.attributes.error.root_cause'
);
const message: string = get(error, 'body.message');
interface FailedShards {
shard: number;
index: string;
node: string;
reason: {
type: string;
reason: string;
script_stack: string[];
script: string;
lang: string;
position: {
offset: number;
start: number;
end: number;
};
caused_by: {
type: string;
reason: string;
};
};
}

interface EsError {
body: {
statusCode: number;
error: string;
message: string;
attributes?: {
error?: {
root_cause?: [
{
lang: string;
script: string;
}
];
type: string;
reason: string;
caused_by: {
type: string;
reason: string;
phase: string;
grouped: boolean;
failed_shards: FailedShards[];
};
};
};
};
}

export function getCause(error: EsError) {
const cause = error.body?.attributes?.error?.root_cause;
if (cause) {
return cause[0];
}

const failedShards = error.body?.attributes?.error?.caused_by?.failed_shards;

if (failedShards && failedShards[0] && failedShards[0].reason) {
return error.body?.attributes?.error?.caused_by?.failed_shards[0].reason;
}
}

export function getPainlessError(error: EsError) {
const cause = getCause(error);

if (!rootCause) {
if (!cause) {
return;
}

const [{ lang, script }] = rootCause;
const { lang, script } = cause;

if (lang !== 'painless') {
return;
Expand All @@ -44,6 +101,6 @@ export function getPainlessError(error: Error) {
defaultMessage: "Error with Painless scripted field '{script}'.",
values: { script },
}),
error: message,
error: error.body?.message,
};
}
2 changes: 1 addition & 1 deletion test/accessibility/apps/dashboard_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/

import { FtrProviderContext } from '../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'home', 'settings']);
const a11y = getService('a11y');
Expand All @@ -31,6 +30,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', {
useActualUrl: true,
});

await PageObjects.home.addSampleDataSet('flights');
await PageObjects.common.navigateToApp('dashboard');
await testSubjects.click('dashboardListingTitleLink-[Flights]-Global-Flight-Dashboard');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }) {
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['common', 'discover', 'timePicker']);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ export const generalSettings: RawSettingDefinition[] = [
key: 'transaction_max_spans',
type: 'integer',
min: 0,
max: 32000,
defaultValue: '500',
label: i18n.translate('xpack.apm.agentConfig.transactionMaxSpans.label', {
defaultMessage: 'Transaction max spans',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.
*/

import React from 'react';
import { EuiButton, EuiCallOut, EuiSpacer, EuiText } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { useApmPluginContext } from '../../../hooks/useApmPluginContext';

export function ClientSideMonitoringCallout() {
const { core } = useApmPluginContext();
const clientSideMonitoringHref = core.http.basePath.prepend(`/app/csm`);

return (
<EuiCallOut
iconType="cheer"
title={i18n.translate(
'xpack.apm.transactionOverview.clientSideMonitoring.calloutTitle',
{ defaultMessage: 'Introducing: Client Side Monitoring' }
)}
>
<EuiText>
{i18n.translate(
'xpack.apm.transactionOverview.clientSideMonitoring.calloutText',
{
defaultMessage:
'We are beyond excited to introduce a new experience for analyzing the user experience metrics specifically for your RUM services. It provides insights into the core vitals and visitor breakdown by browser and location. The app is always available in the left sidebar among the other Observability views.',
}
)}
</EuiText>
<EuiSpacer size="m" />
<EuiButton href={clientSideMonitoringHref}>
{i18n.translate(
'xpack.apm.transactionOverview.clientSideMonitoring.linkLabel',
{ defaultMessage: 'Take me there' }
)}
</EuiButton>
</EuiCallOut>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import { LocalUIFilters } from '../../shared/LocalUIFilters';
import { TransactionTypeFilter } from '../../shared/LocalUIFilters/TransactionTypeFilter';
import { TransactionList } from './TransactionList';
import { useRedirect } from './useRedirect';
import { TRANSACTION_PAGE_LOAD } from '../../../../common/transaction_types';
import { ClientSideMonitoringCallout } from './ClientSideMonitoringCallout';

function getRedirectLocation({
urlParams,
Expand Down Expand Up @@ -125,6 +127,12 @@ export function TransactionOverview({ serviceName }: TransactionOverviewProps) {
</LocalUIFilters>
</EuiFlexItem>
<EuiFlexItem grow={7}>
{transactionType === TRANSACTION_PAGE_LOAD && (
<>
<ClientSideMonitoringCallout />
<EuiSpacer size="s" />
</>
)}
<ChartsSyncContextProvider>
<TransactionCharts
charts={transactionCharts}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('MLJobLink', () => {
);

expect(href).toMatchInlineSnapshot(
`"/basepath/app/ml#/timeseriesexplorer?_g=(ml:(jobIds:!(myservicename-mytransactiontype-high_mean_response_time)),refreshInterval:(pause:!t,value:0),time:(from:now/w,to:now-4h))&_a=(mlTimeSeriesExplorer:(entities:(service.name:opbeans-test,transaction.type:request),zoom:(from:now/w,to:now-4h)))"`
`"/basepath/app/ml#/timeseriesexplorer?_g=(ml:(jobIds:!(myservicename-mytransactiontype-high_mean_response_time)),refreshInterval:(pause:!t,value:0),time:(from:now/w,to:now-4h))&_a=(mlTimeSeriesExplorer:(entities:(service.name:opbeans-test,transaction.type:request)))"`
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('useTimeSeriesExplorerHref', () => {
});

expect(href).toMatchInlineSnapshot(
`"/app/ml#/timeseriesexplorer?_g=(ml:(jobIds:!(apm-production-485b-high_mean_transaction_duration)),refreshInterval:(pause:!t,value:10000),time:(from:'2020-07-29T17:27:29.000Z',to:'2020-07-29T18:45:00.000Z'))&_a=(mlTimeSeriesExplorer:(entities:(service.name:opbeans-java,transaction.type:request),zoom:(from:'2020-07-29T17:27:29.000Z',to:'2020-07-29T18:45:00.000Z')))"`
`"/app/ml#/timeseriesexplorer?_g=(ml:(jobIds:!(apm-production-485b-high_mean_transaction_duration)),refreshInterval:(pause:!t,value:10000),time:(from:'2020-07-29T17:27:29.000Z',to:'2020-07-29T18:45:00.000Z'))&_a=(mlTimeSeriesExplorer:(entities:(service.name:opbeans-java,transaction.type:request)))"`
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function useTimeSeriesExplorerHref({
'service.name': serviceName,
'transaction.type': transactionType,
},
zoom: time,
},
}),
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9c13f38

Please sign in to comment.