Skip to content
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

[APM] Add waterfall to dependency operations #143257

Merged
merged 15 commits into from
Oct 27, 2022

Conversation

dgieselaar
Copy link
Member

@dgieselaar dgieselaar commented Oct 13, 2022

Closes #142368.

Adds a trace waterfall in the dependency operation detail view.

CleanShot 2022-10-13 at 13 53 24@2x

@dgieselaar dgieselaar marked this pull request as ready for review October 13, 2022 12:53
@dgieselaar dgieselaar requested a review from a team as a code owner October 13, 2022 12:53
@botelastic botelastic bot added the Team:APM All issues that need APM UI Team support label Oct 13, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:APM)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 1334 1336 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 3.1MB 3.1MB +2.6KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Comment on lines +122 to +124
const queryRef = useRef(query);

queryRef.current = query;
Copy link
Member

Choose a reason for hiding this comment

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

Isn't the ref initialised on every render with query?

Copy link
Member

Choose a reason for hiding this comment

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

... and why do we need it ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is to get around the dependencies lint rule for the useEffect call. I'd rather do this (which is not great either) than disable the lint rule for the entire call. I don't want to redirect when the page or pageSize changes.

history,
page: queryRef.current.page ?? 0,
pageSize: queryRef.current.pageSize ?? 10,
replace,
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to pass replace as an argument? It is a singleton that you can import from ../../shared/links/url_helpers.

Copy link
Member

Choose a reason for hiding this comment

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

ah.. does it make testing easier?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep!

spanId: '11',
});
});
});
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the test

Comment on lines +77 to +81
const samplePageIndex = isControlled
? selectedSample
? traceSamples?.indexOf(selectedSample)
: 0
: sampleActivePage;
Copy link
Member

Choose a reason for hiding this comment

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

It looks like isControlled is not needed and makes the code slightly harder to read

Suggested change
const samplePageIndex = isControlled
? selectedSample
? traceSamples?.indexOf(selectedSample)
: 0
: sampleActivePage;
const samplePageIndex = selectedSample !== undefined
? traceSamples?.indexOf(selectedSample)
: sampleActivePage;

Copy link
Member Author

Choose a reason for hiding this comment

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

The purpose of isControlled is to make it explicit that there are two modes: controlled and uncontrolled. Additionally, if I don't use an intermediate variable, I end up having to pass selectedSample == undefined as a dependency to the useEffect call which is weird to me.

Comment on lines +71 to +73
if (!isControlled) {
setSampleActivePage(index);
}
Copy link
Member

Choose a reason for hiding this comment

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

I think this would be easier to read than having an intermediary variable:

Suggested change
if (!isControlled) {
setSampleActivePage(index);
}
if (selectedSample !== undefined) {
setSampleActivePage(index);
}


import React, { useRef } from 'react';

export function ResettingHeightRetainer(
Copy link
Member

@sorenlouv sorenlouv Oct 27, 2022

Choose a reason for hiding this comment

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

Is this meant to disable the existing behaviour of HeightRetainer? Is it possible to extend HeightRetainer and disable/reset it that way?

Copy link
Member Author

Choose a reason for hiding this comment

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

HeightRetainer never resets (ie, it keeps the max height of all dimensions it has seen), but because the implementation is quite different I opted for a new component. Hopefully we can eventually replace HeightRetainer with this one, but I was worried I'd break something in other components, so I left it out of scope for this PR.

@dgieselaar dgieselaar merged commit f648ef3 into elastic:main Oct 27, 2022
@dgieselaar dgieselaar deleted the dependencies-trace-waterfall branch October 27, 2022 17:09
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Oct 27, 2022
jloleysens added a commit to jloleysens/kibana that referenced this pull request Oct 27, 2022
* main: (24 commits)
  [Files] Add file upload to file picker (elastic#143969)
  [Security solution] Guided onboarding, alerts & cases (elastic#143598)
  [APM] Critical path for a single trace (elastic#143735)
  skip failing test suite (elastic#143933)
  [Fleet] Update GH Projects automation (elastic#144123)
  [APM] Performance fix for 'cardinality' telemetry task (elastic#144061)
  [Enterprise Search] Attach ML Inference Pipeline - Pipeline re-use (elastic#143979)
  [8.5][DOCS] Add support for differential logs (elastic#143242)
  Bump nwsapi from v2.2.0 to v2.2.2 (elastic#144001)
  [APM] Add waterfall to dependency operations (elastic#143257)
  [Shared UX] Add deprecation message to kibana react Markdown (elastic#143766)
  [Security Solution][Endpoint] Adds RBAC API checks for Blocklist (elastic#144047)
  Improve `needs-team` auto labeling regex (elastic#143787)
  [Reporting/CSV Export] _id field can not be formatted (elastic#143807)
  Adds SavedObjectsWarning to analytics results pages. (elastic#144109)
  Bump chromedriver to 107 (elastic#144073)
  Update cypress (elastic#143755)
  [Maps] nest security layers in layer group (elastic#144055)
  [Lens][Agg based Heatmap] Navigate to Lens Agg based Heatmap. (elastic#143820)
  Added support of saved search (elastic#144095)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:enhancement Team:APM All issues that need APM UI Team support v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] Add trace waterfall workflow to Dependencies Operations
6 participants