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] Split dependencies API adding a new API to return comparison statistics #95407

Closed

Conversation

cauemarcondes
Copy link
Contributor

@cauemarcondes cauemarcondes commented Mar 25, 2021

closes #90575

Comparison enabled:
Screen Shot 2021-03-25 at 16 06 33

Comparison disabled:
Screen Shot 2021-03-25 at 16 06 45

@cauemarcondes cauemarcondes force-pushed the apm-comparison-dependencies branch from d29b7c1 to f22c24d Compare March 25, 2021 17:45
@cauemarcondes cauemarcondes added apm:comparison auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes v7.13.0 labels Mar 25, 2021
@cauemarcondes cauemarcondes marked this pull request as ready for review March 25, 2021 20:08
@cauemarcondes cauemarcondes requested a review from a team as a code owner March 25, 2021 20:08
@botelastic botelastic bot added the Team:APM All issues that need APM UI Team support label Mar 29, 2021
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@ogupte ogupte left a comment

Choose a reason for hiding this comment

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

Few code style nits, but everything looks good and works locally for me!

@dgieselaar
Copy link
Member

@cauemarcondes can you verify:

  • how does the performance of this approach compare to two parallel requests?
  • what happens if a dependency was available in the comparison time range, but not in the current time range?

@kuisathaverat
Copy link
Contributor

/oblt-deploy

1 similar comment
@kuisathaverat
Copy link
Contributor

/oblt-deploy

@kuisathaverat
Copy link
Contributor

sorry for the noise I was testing the build with comments

@cauemarcondes
Copy link
Contributor Author

cauemarcondes commented Apr 1, 2021

  • how does the performance of this approach compare to two parallel requests?

@dgieselaar Even though a single query that fetches both periods is a few ms slower, in the end, the result is a bit faster than having two queries. But the difference isn't that much, so I'd rather keeping with what I've done on this PR if it's okay for you.

@dgieselaar
Copy link
Member

@cauemarcondes can you put some numbers to that and elaborate on the two things that you compared?

@cauemarcondes
Copy link
Contributor Author

@cauemarcondes can you put some numbers to that and elaborate on the two things that you compared?

@dgieselaar I'm comparing the response time, for the last 15 minutes.

Screen Shot 2021-04-01 at 12 52 47

  • /dependencies: one query that fetches both current and comparison periods.
  • /test: Two queries one for the current period and another for the comparison periods.

Most of the time the /test, that runs two queries, takes a few seconds more to return compared to the other call.

Do you want me to run any specific test?

@dgieselaar
Copy link
Member

dgieselaar commented Apr 1, 2021

@cauemarcondes you need to call ES directly, on a longer time range. There are many other things happening in a request that will influence the result. If you open a trace from an instrumented Kibana instance you can see that there are other ES calls that happen before that.

Edit: also, are the two queries in parallel, or one after the other? Also can you post the full ES search requests for both strategies?

@cauemarcondes
Copy link
Contributor Author

Edit: also, are the two queries in parallel, or one after the other? Also can you post the full ES search requests for both strategies?

They are running in parallel with Promise.all. In these two files, there are all queries made for both strategies.

single_query.txt
two_queries.txt

@dgieselaar
Copy link
Member

@cauemarcondes I would also recommend to run them through the profiler to see what the differences are.

@cauemarcondes
Copy link
Contributor Author

@cauemarcondes I would also recommend to run them through the profiler to see what the differences are.

just did it:

Fetching current and comparison periods in a single query:
Screen Shot 2021-04-01 at 13 39 01

Fetching current period:
Screen Shot 2021-04-01 at 13 39 08

By comparing the two images, it clear that the single query strategy is worse than the two queries. Especially because the two queries will run in parallel.

Based on that I'd say going for the two queries strategy would be the best solution, WDYT @dgieselaar ?

@cauemarcondes
Copy link
Contributor Author

  • what happens if a dependency was available in the comparison time range, but not in the current time range?

@dgieselaar the dependency will be shown in the table, with the comparison sparkline but without the value beside it. I think if we show the value as well the user might be confused and think that the value shown is from the current period. Alternatively, we could show it in a different color. @formgeist

@cauemarcondes cauemarcondes requested a review from dgieselaar April 7, 2021 13:01
@cauemarcondes
Copy link
Contributor Author

@elasticmachine merge upstream

@cauemarcondes cauemarcondes requested a review from ogupte April 19, 2021 11:58
@cauemarcondes
Copy link
Contributor Author

@elasticmachine merge upstream

Comment on lines -454 to +458
"impact": 1.36961744704522,
"latency": 2568.40816326531,
"currentPeriodImpact": 1.54893576051104,
"name": "elasticsearch",
"throughput": 13.0666666666667,
"previousPeriodImpact": 1.19757368986118,
Copy link
Member

Choose a reason for hiding this comment

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

Why did impact change from "1.36961744704522" to "1.54893576051104"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's because the value 1.36961744704522 was based on the entire 30 minutes of data before adding the comparison range. With the comparison time range filtering the result, it is only 15 minutes for the current period and 15 minutes for the previous period. That's why it changed to 1.54893576051104 and now it also has "previousPeriodImpact": 1.19757368986118,

@@ -441,38 +444,33 @@ export default function ApiTest({ getService }: FtrProviderContext) {
const impactValues = sortBy(
response.body.serviceDependencies.map((item) => ({
name: item.name,
impact: item.impact,
latency: item.latency.value,
Copy link
Member

Choose a reason for hiding this comment

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

Was latency not used here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then latency values are already being checked in another test

it('returns the right latency values', () => {
, that's why I removed it from here and left only the impact, which is what this test must validate.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 1583 1584 +1

Async chunks

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

id before after diff
apm 4.2MB 4.2MB +2.5KB

History

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:comparison auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support v7.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] Split dependencies API adding a new API to return comparison statistics
7 participants