-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Uptime] Annotate waterfall chart with additional metrics #103642
Conversation
Pinging @elastic/uptime (Team:uptime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.../public/components/monitor/synthetics/step_detail/waterfall/waterfall_chart_wrapper.test.tsx
Outdated
Show resolved
Hide resolved
...lugins/uptime/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.ts
Outdated
Show resolved
Hide resolved
...ugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx
Outdated
Show resolved
Hide resolved
...ugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx
Outdated
Show resolved
Hide resolved
...ugins/uptime/public/components/monitor/synthetics/waterfall/components/waterfall_markers.tsx
Outdated
Show resolved
Hide resolved
...lugins/uptime/public/components/monitor/synthetics/step_detail/use_step_waterfall_metrics.ts
Outdated
Show resolved
Hide resolved
|
||
if (data) { | ||
const metricDocs = (data.hits.hits as unknown) as Array<{ fields: any }>; | ||
let navigationStart = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, This is prone to errors and wold result in absurd values when navigationStart
is not present in the doc.
I would change this logic to this.
- Find the navigationStart from the metricDocs and if not present don't calculate the flyout metrics.
- If present, calculate the offset metrics as already done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improved it to make sure check for existence explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good to me, tested against latest synthetics it seems to be working great.
LGTM based on the functionality. Unsure if there are any unanswered questions about plotting these steps.
I did have one nit question regarding the code, maybe it's no problem though.
const dispatch = useDispatch(); | ||
|
||
useEffect(() => { | ||
dispatch(getDynamicSettings()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are using data plugin search api, so we need to fetch heartbeat indices settings to construct that query params to pass it to the data.search
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉 I do have one question
- If the step contains multiple requests before the navigation request, would we still show the waterfall markers?
} = fields; | ||
if (metricType?.[0] !== 'navigationStart') { | ||
metrics.push({ | ||
id: metricType?.[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can skip doing the undefined check here?
export const DOCUMENT_CONTENT_LOADED_LABEL = i18n.translate( | ||
'xpack.uptime.synthetics.waterfall.domContentLabel', | ||
{ | ||
defaultMessage: 'DOMContentLoaded', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: DOMContentLoaded event to be in sync with Load event
@@ -10,6 +10,17 @@ import { WaterfallData, WaterfallDataEntry, WaterfallMetadata } from '../types'; | |||
import { OnSidebarClick, OnElementClick, OnProjectionClick } from '../components/use_flyout'; | |||
import { SidebarItems } from '../../step_detail/waterfall/types'; | |||
|
|||
export type MarkerItems = Array<{ | |||
id: | |||
| 'domContentLoaded' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: we also get cls
, but it's not a relative offset or trace. Its an actual value and not presentable in the waterfall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I'm seeing potential problems with really large waterfall charts. When CNN is the first step, no annotations are displayed. Interestingly, I actually saw the annotations flash then disappear at one point during testing.
- Why is the DOMContentLoaded 0 for subsequent steps?
Here is my github profile as the first step
Here it is as a second step
Also other second/third steps:
Example inline journey
step("goto cnn", async () => page.goto('https://www.cnn.com'));
step("goto github", async () => page.goto('https://github.com/dominiqueclarke'));
step("goto facebook", async () => page.goto('https://www.facebook.com'));
const heartbeatIndices = settings?.heartbeatIndices || ''; | ||
|
||
const { data, loading } = useEsSearch( | ||
hasNavigationRequest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this whole hook depends on hasNavigation request, can be exit early if this is false and return an empty metrics array and loading false?
@@ -26,9 +27,10 @@ export const renderLegendItem: RenderItem<LegendItem> = (item) => { | |||
interface Props { | |||
total: number; | |||
data: NetworkItems; | |||
markerItems: MarkerItems; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this optional all the way down the component tree? That way you won't need to pass it to existing tests all the way through the component tree? You already have an early return here to account for it being option https://github.com/elastic/kibana/pull/103642/files#diff-06ea7122b3e4859a49d4baeb64472ed36489474493b8f6024f40a40d2e34fa49R47
} | ||
); | ||
|
||
export function WaterfallCharMarkers() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function WaterfallCharMarkers() { | |
export function WaterfallChartMarkers() { |
metricDocs.forEach(({ fields }) => { | ||
if (fields['browser.relative_trace.type']?.[0] === 'mark') { | ||
const { | ||
'browser.relative_trace.name': metricType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can reuse the constants above for both these values.
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: cc @shahzad31 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…3642) Co-authored-by: Kibana Machine <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
1 similar comment
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
…113898) Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Shahzad <[email protected]>
Post FF Testing A webpage alibaba.com is visited as the first step in a browser monitor. The step goes successful and visiting the performance break waterfall chart, the following annotations are available
Comparison of FCP and LCP metrics with Lighthouse and calibreapp for the same page:
Issues: |
Summary
Related to elastic/synthetics#120
Since synthetics added relative performance metrics like LCP, FCP, CLS, Load event and DocumnetLoad
Annotated all of these metrics on top of waterfall chart