Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into kbn-62016-createh…
Browse files Browse the repository at this point in the history
…ref-basepath
  • Loading branch information
pgayvallet committed Apr 8, 2020
2 parents e4b8eeb + d212102 commit 737c5df
Show file tree
Hide file tree
Showing 104 changed files with 2,688 additions and 1,189 deletions.
Binary file added docs/apm/images/service-maps-java.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/apm/images/service-maps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions docs/apm/service-maps.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[[service-maps]]
=== Service maps

beta::[]

A service map is a real-time diagram of the interactions occurring in your application’s architecture.
It allows you to easily visualize data flow and high-level statistics, like average transaction duration,
requests per minute, errors per minute, and metrics, allowing you to quickly assess the status of your services.

Our beta offering creates two types of service maps:

* Global: All services and connections are shown.
* Service-specific: Selecting a specific service will highlight it's connections.

[role="screenshot"]
image::apm/images/service-maps.png[Example view of service maps in the APM app in Kibana]

[float]
[[visualize-your-architecture]]
=== Visualize your architecture

Select the **Service Map** tab to get started.
By default, all services and connections are shown.
Whether your onboarding a new engineer, or just trying to grasp the big picture,
click around, zoom in and out, and begin to visualize how your services are connected.

If there's a specific service that interests you, select that service to highlight its connections.
Clicking **Focus map** will refocus the map on that specific service and lock the connection highlighting.
From here, select **Service Details**, or click on the **Transaction** tab to jump to the Transaction overview.
You can also use the tabs at the top of the page to easily jump to the **Errors** or **Metrics** overview.

While it's not possible to query in service maps, it is possible to filter by environment.
This can be useful if you have two or more services, in separate environments, but with the same name.
Use the environment drop down to only see the data you're interested in, like `dev` or `production`.

[role="screenshot"]
image::apm/images/service-maps-java.png[Example view of service maps with Java highlighted in the APM app in Kibana]

[float]
[[service-maps-legend]]
=== Legend

Nodes appear on the map in one of two shapes:

* **Circle**: Instrumented services. Interior icons are based on the language of the agent used.
* **Diamond**: Databases, external, and messaging. Interior icons represent the generic type,
with specific icons for known entities, like Elasticsearch.
Type and subtype are based on `span.type`, and `span.subtype`.
2 changes: 2 additions & 0 deletions docs/apm/using-the-apm-ui.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ include::transactions.asciidoc[]

include::spans.asciidoc[]

include::service-maps.asciidoc[]

include::errors.asciidoc[]

include::metrics.asciidoc[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ export function createRegionMapVisualization({ serviceSettings, $injector, uiSet
}

this._choroplethLayer.on('select', event => {
const rowIndex = this._chartData.rows.findIndex(row => row[0] === event);
const { rows, columns } = this._chartData;
const rowIndex = rows.findIndex(row => row[columns[0].id] === event);
this._vis.API.events.filter({
table: this._chartData,
column: 0,
Expand Down
6 changes: 3 additions & 3 deletions test/functional/apps/discover/_discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default function({ getService, getPageObjects }) {
});

describe('query', function() {
this.tags(['skipFirefox']);
const queryName1 = 'Query # 1';

it('should show correct time range string by timepicker', async function() {
Expand Down Expand Up @@ -100,9 +99,10 @@ export default function({ getService, getPageObjects }) {
const newDurationHours = await PageObjects.timePicker.getTimeDurationInHours();
expect(Math.round(newDurationHours)).to.be(25);
const rowData = await PageObjects.discover.getDocTableField(1);
log.debug(`The first timestamp value in doc table: ${rowData}`);
expect(Date.parse(rowData)).to.be.within(
Date.parse('Sep 20, 2015 @ 22:00:00.000'),
Date.parse('Sep 20, 2015 @ 23:30:00.000')
Date.parse('Sep 20, 2015 @ 21:30:00.000'),
Date.parse('Sep 20, 2015 @ 23:00:00.000')
);
});

Expand Down
66 changes: 13 additions & 53 deletions test/functional/page_objects/common_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,10 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
appConfig: {};
ensureCurrentUrl: boolean;
shouldLoginIfPrompted: boolean;
shouldAcceptAlert: boolean;
useActualUrl: boolean;
}

class CommonPage {
/**
* Navigates the browser window to provided URL
* @param url URL
* @param shouldAcceptAlert pass 'true' if browser alert should be accepted
*/
private static async navigateToUrlAndHandleAlert(url: string, shouldAcceptAlert: boolean) {
log.debug('Navigate to: ' + url);
try {
await browser.get(url);
} catch (navigationError) {
log.debug('Error navigating to url');
const alert = await browser.getAlert();
if (alert && alert.accept) {
if (shouldAcceptAlert) {
log.debug('Should accept alert');
try {
await alert.accept();
} catch (alertException) {
log.debug('Error accepting alert');
throw alertException;
}
} else {
log.debug('Will not accept alert');
throw navigationError;
}
} else {
throw navigationError;
}
}
}

/**
* Returns Kibana host URL
*/
Expand Down Expand Up @@ -127,21 +95,19 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
}

private async navigate(navigateProps: NavigateProps) {
const {
appConfig,
ensureCurrentUrl,
shouldLoginIfPrompted,
shouldAcceptAlert,
useActualUrl,
} = navigateProps;
const { appConfig, ensureCurrentUrl, shouldLoginIfPrompted, useActualUrl } = navigateProps;
const appUrl = getUrl.noAuth(config.get('servers.kibana'), appConfig);

await retry.try(async () => {
if (useActualUrl) {
log.debug(`navigateToActualUrl ${appUrl}`);
await browser.get(appUrl);
} else {
await CommonPage.navigateToUrlAndHandleAlert(appUrl, shouldAcceptAlert);
log.debug(`navigateToUrl ${appUrl}`);
await browser.get(appUrl);
// accept alert if it pops up
const alert = await browser.getAlert();
await alert?.accept();
}

const currentUrl = shouldLoginIfPrompted
Expand All @@ -167,7 +133,6 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
basePath = '',
ensureCurrentUrl = true,
shouldLoginIfPrompted = true,
shouldAcceptAlert = true,
useActualUrl = false,
} = {}
) {
Expand All @@ -180,7 +145,6 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
appConfig,
ensureCurrentUrl,
shouldLoginIfPrompted,
shouldAcceptAlert,
useActualUrl,
});
}
Expand All @@ -200,7 +164,6 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
basePath = '',
ensureCurrentUrl = true,
shouldLoginIfPrompted = true,
shouldAcceptAlert = true,
useActualUrl = true,
} = {}
) {
Expand All @@ -214,7 +177,6 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
appConfig,
ensureCurrentUrl,
shouldLoginIfPrompted,
shouldAcceptAlert,
useActualUrl,
});
}
Expand All @@ -228,18 +190,12 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
async navigateToActualUrl(
appName: string,
hash?: string,
{
basePath = '',
ensureCurrentUrl = true,
shouldLoginIfPrompted = true,
shouldAcceptAlert = true,
} = {}
{ basePath = '', ensureCurrentUrl = true, shouldLoginIfPrompted = true } = {}
) {
await this.navigateToUrl(appName, hash, {
basePath,
ensureCurrentUrl,
shouldLoginIfPrompted,
shouldAcceptAlert,
useActualUrl: true,
});
}
Expand All @@ -252,7 +208,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo

async navigateToApp(
appName: string,
{ basePath = '', shouldLoginIfPrompted = true, shouldAcceptAlert = true, hash = '' } = {}
{ basePath = '', shouldLoginIfPrompted = true, hash = '' } = {}
) {
let appUrl: string;
if (config.has(['apps', appName])) {
Expand All @@ -274,7 +230,11 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
await retry.tryForTime(defaultTryTimeout * 2, async () => {
let lastUrl = await retry.try(async () => {
// since we're using hash URLs, always reload first to force re-render
await CommonPage.navigateToUrlAndHandleAlert(appUrl, shouldAcceptAlert);
log.debug('navigate to: ' + appUrl);
await browser.get(appUrl);
// accept alert if it pops up
const alert = await browser.getAlert();
await alert?.accept();
await this.sleep(700);
log.debug('returned from get, calling refresh');
await browser.refresh();
Expand Down
6 changes: 3 additions & 3 deletions test/functional/page_objects/discover_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider

await browser
.getActions()
.move({ x: 200, y: 20, origin: el._webElement })
.move({ x: 0, y: 20, origin: el._webElement })
.click()
.perform();
}
Expand All @@ -147,8 +147,8 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
const el = await elasticChart.getCanvas();

await browser.dragAndDrop(
{ location: el, offset: { x: 200, y: 20 } },
{ location: el, offset: { x: 400, y: 30 } }
{ location: el, offset: { x: -300, y: 20 } },
{ location: el, offset: { x: -100, y: 30 } }
);
}

Expand Down
3 changes: 2 additions & 1 deletion test/functional/services/remote/webdriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ async function attemptToCreateCommand(
chromeOptions.push('headless', 'disable-gpu', 'remote-debugging-port=9222');
}
chromeCapabilities.set('goog:chromeOptions', {
w3c: false,
w3c: true,
args: chromeOptions,
});
chromeCapabilities.set('unexpectedAlertBehaviour', 'accept');
chromeCapabilities.set('goog:loggingPrefs', { browser: 'ALL' });

const session = await new Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ function FormRow({
<EuiFieldNumber
placeholder={setting.placeholder}
value={(amount as unknown) as number}
min={'min' in setting ? setting.min : 1}
onChange={e =>
onChange(
setting.key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@
* 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 { EuiLink, EuiText } from '@elastic/eui';
import Mustache from 'mustache';
import React from 'react';
import styled from 'styled-components';
import { CustomLink } from '../../../../../../../../plugins/apm/common/custom_link/custom_link_types';
import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
import {
SectionLinks,
SectionLink
} from '../../../../../../../../plugins/observability/public';
import { px, truncate, units } from '../../../../style/variables';

const LinkContainer = styled.li`
margin-top: ${px(units.half)};
&:first-of-type {
margin-top: 0;
}
`;

const TruncateText = styled(EuiText)`
font-weight: 500;
line-height: ${px(units.unit)};
${truncate(px(units.unit * 25))}
`;

export const CustomLinkSection = ({
customLinks,
Expand All @@ -19,7 +31,7 @@ export const CustomLinkSection = ({
customLinks: CustomLink[];
transaction: Transaction;
}) => (
<SectionLinks>
<ul>
{customLinks.map(link => {
let href = link.url;
try {
Expand All @@ -28,13 +40,12 @@ export const CustomLinkSection = ({
// ignores any error that happens
}
return (
<SectionLink
key={link.id}
label={link.label}
href={href}
target="_blank"
/>
<LinkContainer key={link.id}>
<EuiLink href={href} target="_blank">
<TruncateText size="s">{link.label}</TruncateText>
</EuiLink>
</LinkContainer>
);
})}
</SectionLinks>
</ul>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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 enum DemoRows {
CI = 'ci',
SHIRTS = 'shirts',
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@

import { cloneDeep } from 'lodash';
import ci from './ci.json';
import { DemoRows } from './demo_rows_types';
import shirts from './shirts.json';
import { getFunctionErrors } from '../../../../i18n';

export enum DemoRows {
CI = 'ci',
SHIRTS = 'shirts',
}

export function getDemoRows(arg: string | null) {
if (arg === DemoRows.CI) {
return cloneDeep(ci);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { sortBy } from 'lodash';
import { ExpressionFunctionDefinition } from 'src/plugins/expressions';
// @ts-ignore unconverted lib file
import { queryDatatable } from '../../../../common/lib/datatable/query';
import { DemoRows, getDemoRows } from './get_demo_rows';
import { DemoRows } from './demo_rows_types';
import { getDemoRows } from './get_demo_rows';
import { Filter, Datatable, DatatableColumn, DatatableRow } from '../../../../types';
import { getFunctionHelp } from '../../../../i18n';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { applyTemplateStrings } from '../../i18n/templates';

import darkTemplate from './theme_dark.json';
import lightTemplate from './theme_light.json';
import pitchTemplate from './pitch_presentation.json';
// import pitchTemplate from './pitch_presentation.json';
import statusTemplate from './status_report.json';
import summaryTemplate from './summary_report.json';

// Registry expects a function that returns a spec object
export const templateSpecs = applyTemplateStrings([
darkTemplate,
lightTemplate,
pitchTemplate,
// pitchTemplate,
statusTemplate,
summaryTemplate,
]);
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n';
import { demodata } from '../../../canvas_plugin_src/functions/server/demodata';
import { FunctionHelp } from '../function_help';
import { FunctionFactory } from '../../../types';
import { DemoRows } from '../../../canvas_plugin_src/functions/server/demodata/get_demo_rows';
import { DemoRows } from '../../../canvas_plugin_src/functions/server/demodata/demo_rows_types';

export const help: FunctionHelp<FunctionFactory<typeof demodata>> = {
help: i18n.translate('xpack.canvas.functions.demodataHelpText', {
Expand Down
Loading

0 comments on commit 737c5df

Please sign in to comment.