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] Validate params for local UI filters config #43267

Closed
dgieselaar opened this issue Aug 14, 2019 · 4 comments
Closed

[APM] Validate params for local UI filters config #43267

dgieselaar opened this issue Aug 14, 2019 · 4 comments
Labels
Team:APM All issues that need APM UI Team support technical debt Improvement of the software architecture and operational architecture

Comments

@dgieselaar
Copy link
Member

dgieselaar commented Aug 14, 2019

For the API calls that fetch the local UI filter data (available options + their count), we need to pass in some parameters for the projection that is being used. E.g., for transactions, we send serviceName etc as parameters to the endpoint, that constructs the projection with the given serviceName. Right now there's no validation in the client-side call, only on the endpoint. To improve our confidence in the client-side call we can explore ways to get type safety here as well. The config now looks like this:

const localFiltersConfig: React.ComponentProps<
    typeof LocalUIFilters
  > = useMemo(
    () => ({
      filterNames: ['host', 'containerId', 'podId'],
      params: {
        serviceName
      },
      projection: PROJECTION.METRICS,
      showCount: false
    }),
    [serviceName]
  );

Right now there's no way to check if { serviceName } is the right set of parameters for the metrics projection, the scope of this issue is to make sure we can check that with TypeScript.

@dgieselaar dgieselaar added the Team:APM All issues that need APM UI Team support label Aug 14, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui

@sorenlouv sorenlouv added [zube]: Impl Backlog technical debt Improvement of the software architecture and operational architecture labels Aug 14, 2019
@sorenlouv
Copy link
Member

sorenlouv commented Aug 22, 2019

As talked about on zoom this issue could also fix the problem of not being able to see the transactions overview page when transactionType=undefined. To fix this the following lines have to change:

// TODO: improve urlParams typings.
// `serviceName` or `transactionType` will never be undefined here, and this check should not be needed
if (!serviceName || !transactionType) {
return null;
}

And instead be something like:

  // TODO: improve urlParams typings.
  // `serviceName` will never be undefined here, and this check should not be needed
  if (!serviceName) {
    return null;
  }

This in turn will cause one of the ui filters endpoints to fail since transactionType is required:
GET http://localhost:5601/api/apm/ui_filters/local_filters/transactionGroups?uiFilters=%7B%7D&start=2019-08-22T09%3A03%3A50.003Z&end=2019-08-22T09%3A18%3A50.003Z&filterNames=%5B%22transactionResult%22%2C%22host%22%2C%22containerId%22%2C%22podName%22%5D&serviceName=opbeans-node
Returns 400 Bad Request

@sorenlouv
Copy link
Member

@dgieselaar Is it still useful with an issue for tracking this?

@dgieselaar
Copy link
Member Author

@sqren fine with closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:APM All issues that need APM UI Team support technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

No branches or pull requests

3 participants