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] Service inventory: detailed stats fetched for all services #134844

Conversation

cauemarcondes
Copy link
Contributor

@cauemarcondes cauemarcondes commented Jun 21, 2022

closes #133697

Service Inventory

service.inventory.mov

Errors Overview

Before:
Screen Shot 2022-06-21 at 11 27 54 AM

After:
Screen Shot 2022-06-21 at 11 43 20 AM

@cauemarcondes cauemarcondes added release_note:fix auto-backport Deprecated: Automatically backport this PR after it's merged v8.4.0 labels Jun 21, 2022
@cauemarcondes cauemarcondes force-pushed the apm-service-inventory-fetch-details-stats branch from 8e14e35 to 195c880 Compare June 21, 2022 16:18
@cauemarcondes cauemarcondes marked this pull request as ready for review June 21, 2022 16:18
@cauemarcondes cauemarcondes requested a review from a team as a code owner June 21, 2022 16:18
@botelastic botelastic bot added the Team:APM All issues that need APM UI Team support label Jun 21, 2022
@elasticmachine
Copy link
Contributor

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

@cauemarcondes
Copy link
Contributor Author

@elasticmachine merge upstream

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.

LGTM

Comment on lines +140 to +156
cy.get('.euiPagination__list').children().should('have.length', 5);
cy.wait('@errorsDetailedStatistics').then((payload) => {
expect(payload.request.body.groupIds).eql(
JSON.stringify([
'0000000000000000000000000Error 0',
'0000000000000000000000000Error 1',
'0000000000000000000000000Error 2',
'0000000000000000000000000Error 3',
'0000000000000000000000000Error 4',
'0000000000000000000000000Error 5',
'0000000000000000000000000Error 6',
'0000000000000000000000000Error 7',
'0000000000000000000000000Error 8',
'0000000000000000000000000Error 9',
])
);
});
Copy link
Member

Choose a reason for hiding this comment

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

This might be technically correct but it's not super clear what this verifies. The test says "calls detailed API with visible items only".

There are 5 visible items afaict on line 140. Yet, detailed statistics requests 10 values. Isn't that a disconnect? Should those two be the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, there are 5 pages, with 10 items on each of them.

Copy link
Member

@sorenlouv sorenlouv Jun 24, 2022

Choose a reason for hiding this comment

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

Okay I missed that. But that's also my point: it's not clear what this is verifying (at least not to me). Why are we asserting the number of pages in the pagination? Is that important when ensuring that it only makes requests for the visible items? Perhaps it's useful to assert that there are more pages than the current one.
Most importantly, I think you should make the connection between pageSize and groupIds more obvious:

    const pageSize = 10;
    cy.visit(`${javaServiceErrorsPageHref}&pageSize=${pageSize}`);
    cy.wait('@errorsMainStatistics');
    cy.get('.euiPagination__list').children().should('be.gt', 1);
    cy.wait('@errorsDetailedStatistics').then((payload) => {
      expect(payload.request.body.groupIds.length).eql(pageSize)
      );
    });

Comment on lines +159 to +171
expect(payload.request.body.groupIds).eql(
JSON.stringify([
'000000000000000000000000Error 10',
'000000000000000000000000Error 11',
'000000000000000000000000Error 12',
'000000000000000000000000Error 13',
'000000000000000000000000Error 14',
'000000000000000000000000Error 15',
'000000000000000000000000Error 16',
'000000000000000000000000Error 17',
'000000000000000000000000Error 18',
'000000000000000000000000Error 19',
])
Copy link
Member

Choose a reason for hiding this comment

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

Same as above. I'd expect this to be something like:

Suggested change
expect(payload.request.body.groupIds).eql(
JSON.stringify([
'000000000000000000000000Error 10',
'000000000000000000000000Error 11',
'000000000000000000000000Error 12',
'000000000000000000000000Error 13',
'000000000000000000000000Error 14',
'000000000000000000000000Error 15',
'000000000000000000000000Error 16',
'000000000000000000000000Error 17',
'000000000000000000000000Error 18',
'000000000000000000000000Error 19',
])
expect(payload.request.body.groupIds.length).eql(NUMBER_OF_VISIBLE_ERROR_GROUPS)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

check the comment above.

offset:
comparisonEnabled && isTimeComparison(offset)
? offset
: undefined,
},
body: {
groupIds: JSON.stringify(
items.map(({ groupId: groupId }) => groupId).sort()
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 items only contains the current page's group id's. That's fine but different from how this is handled in error_group_overview/index.tsx. Can we handle this more consistently?

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 why error_group_overview uses ManagedTable and service_overview_errors_table uses EuiBasicTable. I personally don't like the ManagedTable since it introduces a bug if it is used more than one time on the same page since it updates the table options in the URL (pageIndex, pageSize, sortField and sortDirection).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's an open issue to delete the ManagedTable #111328

@cauemarcondes cauemarcondes enabled auto-merge (squash) June 24, 2022 13:32
@cauemarcondes cauemarcondes merged commit b870b62 into elastic:main Jun 24, 2022
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
apm 2.9MB 2.9MB +951.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
apm 86 87 +1

Total ESLint disabled count

id before after diff
apm 100 101 +1

History

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

@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated: Automatically backport this PR after it's merged backport:skip This commit does not require backporting release_note:fix Team:APM All issues that need APM UI Team support v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] Service inventory: detailed stats fetched for all services
6 participants