Skip to content

Conversation

@dgieselaar
Copy link
Member

(See dgieselaar#3 for other feedback).

In preparation for a metrics-powered UI, we are creating two clients with distinct purposes, one for querying APM events, and an internal client for talking to the APM system indices (.apm-agent-configuration and .apm-custom-links.

The purpose of this PR is to:

  • have a more clear separation of responsibilities between the different clients
  • make it easier to compose ES queries

The changes being made are:

  • projections are moved to server
  • client in setupRequest will be renamed to apmEventClient
  • This client only exposes a search method, and swaps the index: string property with a apm.events: ProcessorEvent property. This is type-checked via the APMEventESSearchRequest type.
  • Types for _source are inferred based on apm.events.
  • index and a terms query will also be set based on apm.events.
  • internalClient no longer cares about legacy data.
  • For getIndicesPrivileges, Elasticsearch is called directly (via the legacy client) with a callClientWithDebug helper.

dgieselaar and others added 30 commits June 24, 2020 11:12
We don't need a dynamic index pattern for parsing the filters from the query bar. Additionally, instead of fetching uiIndices in `getParamsForSearchRequest`, we can use `indices` that we already fetched in `setupRequest`.
Instead of using a combination of index + terms filters on processor.event, add a top-level setting that allows you to define a type, which can be a processor event type, agent configuration or custom link. This allows us to more easily compose queries.
@dgieselaar dgieselaar added Team:APM - DEPRECATED Use Team:obs-ux-infra_services. release_note:skip Skip the PR/issue when compiling release notes v7.10.0 labels Jul 28, 2020
@dgieselaar dgieselaar requested a review from a team as a code owner July 28, 2020 13:58
@elasticmachine
Copy link
Contributor

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

@dgieselaar dgieselaar changed the title [APM] Optimize service overview queries [APM] Use apmEventClient for querying APM event indices Jul 28, 2020
@dgieselaar
Copy link
Member Author

@elasticmachine merge upstream

Copy link
Contributor

@smith smith left a comment

Choose a reason for hiding this comment

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

Very nice cleanup. I think this will help a lot.

* you may not use this file except in compliance with the Elastic License.
*/

export enum PROJECTION {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why anything at all in our whole codebase needs to be ALL_CAPS. I prefer the formatting of the ProcessorEvent enum. Just my opinion and I don't care enough to ever block merging of anything.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree, changed.

sourcemap = 'sourcemap',
}

export type UIProcessorEvent =
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we put a JSDoc comment on here explaining what this means and what it's used for?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

});

it('if index is not an APM index, it should not add `observer.version_major` filter', async () => {
it('should not add `observer.version_major` filter if `includeLegacyData=true`', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This would read better as describe('when includeLegacyData=true', () => { it('does not add an observer.version_major filter', () => ...

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, restructured the tests.

],
apm: {
events: [
ProcessorEvent.transaction,
Copy link
Contributor

Choose a reason for hiding this comment

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

We use this array in a few places. Maybe there's a good place to export a uiProcessorEvents that we can reuse.

Copy link
Member Author

Choose a reason for hiding this comment

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

UIProcessorEvent is specifically meant for public (the query bar). I don't think it belongs in server code.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

async chunks size

id value diff baseline
apm 3.7MB +140.0B 3.7MB

History

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

@dgieselaar dgieselaar merged commit c66ea65 into elastic:master Jul 31, 2020
kibanamachine pushed a commit that referenced this pull request Jul 31, 2020
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Backport successful

The PR was backported to the following branches:

dgieselaar added a commit that referenced this pull request Jul 31, 2020
)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Dario Gieselaar <dario.gieselaar@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes Team:APM - DEPRECATED Use Team:obs-ux-infra_services. v7.10.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants