66
77import {
88 EuiButtonEmpty ,
9+ EuiCallOut ,
910 EuiFlexGroup ,
1011 EuiFlexItem ,
1112 EuiFlyout ,
1213 EuiFlyoutBody ,
1314 EuiFlyoutHeader ,
1415 EuiHorizontalRule ,
16+ EuiLink ,
1517 EuiPortal ,
1618 EuiTitle
1719} from '@elastic/eui' ;
20+ import { get } from 'lodash' ;
1821import React from 'react' ;
22+ import styled from 'styled-components' ;
1923import { IUrlParams } from 'x-pack/plugins/apm/public/store/urlParams' ;
24+ import { APM_AGENT_DROPPED_SPANS_DOCS } from 'x-pack/plugins/apm/public/utils/documentation/agents' ;
2025import { Transaction } from 'x-pack/plugins/apm/typings/Transaction' ;
2126import { DiscoverTransactionLink } from '../../../ActionMenu' ;
2227import { StickyTransactionProperties } from '../../../StickyTransactionProperties' ;
@@ -32,6 +37,61 @@ interface Props {
3237 waterfall : IWaterfall ;
3338}
3439
40+ const ResponsiveFlyout = styled ( EuiFlyout ) `
41+ width: 100%;
42+
43+ @media (min-width: 800px) {
44+ width: 90%;
45+ }
46+
47+ @media (min-width: 1000px) {
48+ width: 70%;
49+ }
50+
51+ @media (min-width: 1400px) {
52+ width: 50%;
53+ }
54+
55+ @media (min-width: 2000px) {
56+ width: 35%;
57+ }
58+ ` ;
59+
60+ function DroppedSpansWarning ( {
61+ transactionDoc
62+ } : {
63+ transactionDoc : Transaction ;
64+ } ) {
65+ const dropped : number = get (
66+ transactionDoc ,
67+ 'transaction.span_count.dropped.total' ,
68+ 0
69+ ) ;
70+
71+ if ( dropped === 0 ) {
72+ return null ;
73+ }
74+
75+ const url =
76+ APM_AGENT_DROPPED_SPANS_DOCS [ transactionDoc . context . service . agent . name ] ;
77+
78+ const docsLink = url ? (
79+ < EuiLink href = { url } target = "_blank" >
80+ Learn more.
81+ </ EuiLink >
82+ ) : null ;
83+
84+ return (
85+ < React . Fragment >
86+ < EuiCallOut size = "s" >
87+ The APM agent that reported this transaction dropped { dropped } spans or
88+ more based on its configuration. { docsLink }
89+ </ EuiCallOut >
90+ < EuiHorizontalRule />
91+ </ React . Fragment >
92+ ) ;
93+ }
94+
3595export function TransactionFlyout ( {
3696 transaction : transactionDoc ,
3797 onClose,
@@ -45,7 +105,7 @@ export function TransactionFlyout({
45105
46106 return (
47107 < EuiPortal >
48- < EuiFlyout onClose = { onClose } size = "m" ownFocus = { true } >
108+ < ResponsiveFlyout onClose = { onClose } ownFocus = { true } maxWidth = { false } >
49109 < EuiFlyoutHeader hasBorder >
50110 < EuiFlexGroup >
51111 < EuiFlexItem grow = { false } >
@@ -71,13 +131,14 @@ export function TransactionFlyout({
71131 totalDuration = { waterfall . traceRootDuration }
72132 />
73133 < EuiHorizontalRule />
134+ < DroppedSpansWarning transactionDoc = { transactionDoc } />
74135 < TransactionPropertiesTableForFlyout
75136 transaction = { transactionDoc }
76137 location = { location }
77138 urlParams = { urlParams }
78139 />
79140 </ EuiFlyoutBody >
80- </ EuiFlyout >
141+ </ ResponsiveFlyout >
81142 </ EuiPortal >
82143 ) ;
83144}
0 commit comments