Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@

import {
EuiButtonEmpty,
EuiCallOut,
EuiFlexGroup,
EuiFlexItem,
EuiFlyout,
EuiFlyoutBody,
EuiFlyoutHeader,
EuiHorizontalRule,
EuiLink,
EuiPortal,
EuiTitle
} from '@elastic/eui';
import { get } from 'lodash';
import React from 'react';
import styled from 'styled-components';
import { IUrlParams } from 'x-pack/plugins/apm/public/store/urlParams';
import { APM_AGENT_DROPPED_SPANS_DOCS } from 'x-pack/plugins/apm/public/utils/documentation/agents';
import { Transaction } from 'x-pack/plugins/apm/typings/Transaction';
import { DiscoverTransactionLink } from '../../../ActionMenu';
import { StickyTransactionProperties } from '../../../StickyTransactionProperties';
Expand All @@ -32,6 +37,61 @@ interface Props {
waterfall: IWaterfall;
}

const ResponsiveFlyout = styled(EuiFlyout)`
Copy link
Member

Choose a reason for hiding this comment

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

This feels like something that should be part of EUIFlyout

Copy link
Contributor

Choose a reason for hiding this comment

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

++

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I totally agree.

width: 100%;

@media (min-width: 800px) {
width: 90%;
}

@media (min-width: 1000px) {
width: 70%;
}

@media (min-width: 1400px) {
width: 50%;
}

@media (min-width: 2000px) {
width: 35%;
}
`;

function DroppedSpansWarning({
transactionDoc
}: {
transactionDoc: Transaction;
}) {
const dropped: number = get(
transactionDoc,
'transaction.span_count.dropped.total',
Copy link
Member

Choose a reason for hiding this comment

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

This should be added to the constants file.

Copy link
Member

Choose a reason for hiding this comment

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

@jasonrhodes Minor thing: I noticed this didn't get changed. I can just do it as part of another PR so no biggie - unless it was intentional?

0
);

if (dropped === 0) {
return null;
}

const url =
APM_AGENT_DROPPED_SPANS_DOCS[transactionDoc.context.service.agent.name];

const docsLink = url ? (
<EuiLink href={url} target="_blank">
Learn more.
</EuiLink>
) : null;

return (
<React.Fragment>
<EuiCallOut size="s">
The APM agent that reported this transaction dropped {dropped} spans or
more based on its configuration. {docsLink}
</EuiCallOut>
<EuiHorizontalRule />
</React.Fragment>
);
}

export function TransactionFlyout({
transaction: transactionDoc,
onClose,
Expand All @@ -45,7 +105,7 @@ export function TransactionFlyout({

return (
<EuiPortal>
<EuiFlyout onClose={onClose} size="m" ownFocus={true}>
<ResponsiveFlyout onClose={onClose} ownFocus={true} maxWidth={false}>
<EuiFlyoutHeader hasBorder>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
Expand All @@ -71,13 +131,14 @@ export function TransactionFlyout({
totalDuration={waterfall.traceRootDuration}
/>
<EuiHorizontalRule />
<DroppedSpansWarning transactionDoc={transactionDoc} />
<TransactionPropertiesTableForFlyout
transaction={transactionDoc}
location={location}
urlParams={urlParams}
/>
</EuiFlyoutBody>
</EuiFlyout>
</ResponsiveFlyout>
</EuiPortal>
);
}
11 changes: 6 additions & 5 deletions x-pack/plugins/apm/public/utils/documentation/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@

const AGENT_URL_ROOT = 'https://www.elastic.co/guide/en/apm/agent';

// TODO: currently unused but should be added to timeline view
export const APM_AGENT_DROPPED_SPANS_DOCS = {
interface AgentNamedValues {
[agentName: string]: string;
}

export const APM_AGENT_DROPPED_SPANS_DOCS: AgentNamedValues = {
nodejs: `${AGENT_URL_ROOT}/nodejs/1.x/agent-api.html#transaction-max-spans`,
python: `${AGENT_URL_ROOT}/python/2.x/configuration.html#config-transaction-max-spans`
};

const APM_AGENT_FEATURE_DOCS: {
[featureName: string]: {
[agentName: string]: string;
};
[featureName: string]: AgentNamedValues;
} = {
user: {
java: `${AGENT_URL_ROOT}/java/0.7/public-api.html#api-transaction-set-user`,
Expand Down