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

Remove kuery from uiFilters #91932

Merged
merged 23 commits into from
Feb 23, 2021
Merged

Remove kuery from uiFilters #91932

merged 23 commits into from
Feb 23, 2021

Conversation

smith
Copy link
Contributor

@smith smith commented Feb 18, 2021

  • Make kuery a standalone query parameter instead of part of uiFilters
  • Move getEsFilters helper to RUM
  • Move query utils from "common" to "server" (it uses esKuery from the data plugin, which is exported from server, not common.)
  • Move uiFiltersRt to RUM routes

References #84526.

@smith smith added 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 v8.0.0 labels Feb 19, 2021
@smith smith marked this pull request as ready for review February 19, 2021 17:44
@smith smith requested review from a team as code owners February 19, 2021 17:44
@smith smith mentioned this pull request Feb 19, 2021
8 tasks
@botelastic botelastic bot added Team:APM All issues that need APM UI Team support Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability labels Feb 19, 2021
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

Copy link
Member

@dgieselaar dgieselaar left a comment

Choose a reason for hiding this comment

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

Such a good change! 👍👍👍 I've got one question: we previously had a type guard around uiFilters, that it was not available on Setup unless the corresponding query parameter/rt is set (similar to SetupTimeRange). Looks like that was removed (not sure why). I think we should put that guard back, because it will help the removal of uiFilters altogether. How do you feel about that? I can push a commit to this branch that puts it back. It would be good to get feedback from whoever removed it as well, there may have been a good reason that I'm not aware of. I think it was @sqren?

@@ -43,7 +49,7 @@ export function getErrorGroupSample({
{ term: { [ERROR_GROUP_ID]: groupId } },
...rangeQuery(start, end),
...environmentQuery(environment),
...esFilter,
...searchQuery(kuery),
Copy link
Member

Choose a reason for hiding this comment

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

what about kqlToQueryDSL 😬 ?

Copy link
Member

Choose a reason for hiding this comment

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

or just kqlToQuery, or queryFromKql, you get the idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So far these functions are all *thing*Query: rangeQuery, environmentQuery, serviceNodeNameQuery, etc. How about kqlQuery?

Copy link
Member

Choose a reason for hiding this comment

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

yeah, works for me 👍

Copy link
Member

Choose a reason for hiding this comment

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

(assuming you won't go with kqlQuery instead of kuery like Shahzad suggested)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm just leaving kuery as the name of the query string parameter, and kqlQuery as the name of the function that converts the KQL query text into a QueryContainer[].

setup,
serviceName,
serviceNodeName,
}: {
environment?: string;
kuery?: string;
Copy link
Member

Choose a reason for hiding this comment

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

Should these be optional always? Can we avoid it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't think of a case where it wouldn't be optional, since you can always have an empty kuery bar and it's present on most pages.

Copy link
Member

Choose a reason for hiding this comment

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

if it's empty I'd say it's still a string? But making it optional makes it easy to accidentally leave out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd like to revisit the "requiredness" of parameters shortly in a future PR. Since useUrlParams always returns an object with everything optional, it's a bit tricky to make something required, and there are some endpoints where kuery and environment aren't there at all. If we can make some improvements to the client-side routes to have more type information about their query parameters we can make this less error-prone.

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 we can just make kuery required in the UrlParams type. I can have a look if you want (and also make the uiFilters type change).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please do, but this PR is already changing 144 files so I don't want to make it too much bigger.

Copy link
Member

Choose a reason for hiding this comment

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

@smith Alright, if you can create the issue I'll take a stab on a follow-up PR, that way you're not blocked by me.

Copy link
Member

Choose a reason for hiding this comment

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

Quid pro quo 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Pleasure doing business 🤝

Comment on lines -47 to -51
Object {
"term": Object {
"service.environment": "test",
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. esFilter was a property of setup but now it's removed. The places where it was used in UX have been replaced with a call to getEsFilter with the uiFilters.

Comment on lines -61 to -65
Object {
"term": Object {
"service.environment": "test",
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, see above.

@smith smith requested a review from shahzad31 February 22, 2021 17:54
Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

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

This looks good, though i found another issue, which is possible side effect of this #89647 or maybe it got broken later. But UX app environment filter isn't working, i mean it's not passing environment filter to API's.

@smith
Copy link
Contributor Author

smith commented Feb 23, 2021

This looks good, though i found another issue, which is possible side effect of this #89647 or maybe it got broken later. But UX app environment filter isn't working, i mean it's not passing environment filter to API's.

@shahzad31 Thanks I'll make sure this gets fixed. Is it working on 7.12 but not master?

@shahzad31
Copy link
Contributor

This looks good, though i found another issue, which is possible side effect of this #89647 or maybe it got broken later. But UX app environment filter isn't working, i mean it's not passing environment filter to API's.

@shahzad31 Thanks I'll make sure this gets fixed. Is it working on 7.12 but not master?

i haven't taken a look at 7.12, but i suspect it's broken there as well.

@smith
Copy link
Contributor Author

smith commented Feb 23, 2021

@shahzad31

i haven't taken a look at 7.12, but i suspect it's broken there as well.

In 7.12 we're only removing UI filters from the APM UI. None of the changes to environment or kuery are backported there. Environment switching on UX on dev-edge seems to work fine right now.

@kibanamachine
Copy link
Contributor

💚 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 5.3MB 5.3MB -1.2KB

History

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

@smith smith merged commit 57dfb81 into elastic:master Feb 23, 2021
@smith smith deleted the nls/no-kuery branch February 23, 2021 20:04
@kibanamachine
Copy link
Contributor

💔 Backport failed

❌ 7.x: Commit could not be cherrypicked due to conflicts

To backport manually, check out the target branch and run:
node scripts/backport --pr 91932

smith added a commit to smith/kibana that referenced this pull request Feb 24, 2021
* Make kuery a standalone query parameter instead of part of uiFilters
* Move getEsFilters helper to RUM
* Move query utils from "common" to "server" (it uses esKuery from the data plugin, which is exported from server, not common.)
* Move uiFiltersRt to RUM routes

References elastic#84526.
# Conflicts:
#	x-pack/plugins/apm/public/context/annotations/annotations_context.tsx
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 25, 2021
@kibanamachine
Copy link
Contributor

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.

2 similar comments
@kibanamachine
Copy link
Contributor

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.

@kibanamachine
Copy link
Contributor

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.

@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 2, 2021
smith added a commit that referenced this pull request Mar 2, 2021
* Make kuery a standalone query parameter instead of part of uiFilters
* Move getEsFilters helper to RUM
* Move query utils from "common" to "server" (it uses esKuery from the data plugin, which is exported from server, not common.)
* Move uiFiltersRt to RUM routes

References #84526.
# Conflicts:
#	x-pack/plugins/apm/public/context/annotations/annotations_context.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants