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

[Infra] Replace infra aggregation runtime types with the types in estypes #190497

Closed
jennypavlova opened this issue Aug 14, 2024 · 1 comment · Fixed by #192059
Closed

[Infra] Replace infra aggregation runtime types with the types in estypes #190497

jennypavlova opened this issue Aug 14, 2024 · 1 comment · Fixed by #192059
Assignees
Labels
good first issue low hanging fruit Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team technical debt Improvement of the software architecture and operational architecture

Comments

@jennypavlova
Copy link
Member

Followup #190311

As described in the issue we are trying to replace the infra aggregation types with the types provided by the Elasticsearch client.

So we need to replace the types here and adjust the check here finding the corresponding types in estypes - we should make sure that the correct types are using matching the older ones.

For example:

export const isDerivativeAgg = (
  aggs: unknown
): aggs is estypes.AggregationsDerivativeAggregation => {
  return !!(aggs as estypes.AggregationsAggregationContainer).derivative;
};

AC:

  • All aggregation runtime types should be replaced by the corresponding types in estypes
  • Check for other aggregation types in the code and replace them as well
  • This should be done after the PR in the main issue is merged
@jennypavlova jennypavlova added good first issue low hanging fruit Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team technical debt Improvement of the software architecture and operational architecture labels Aug 14, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

stephmilovic pushed a commit to stephmilovic/kibana that referenced this issue Aug 21, 2024
…onsAggregate` (elastic#190495)

Closes [elastic#190311](elastic#190311)

## Summary

This PR replaces `MetricsUIAggregation` in favor of
`estypes.AggregationsAggregate`. Now the `MetricsUIAggregation` uses
estypes.AggregationsAggregate and the `MetricsUIAggregationRT `is
removed which also allows us to remove the `ESAggregationRT`. Instead of
maintaining the runtime types we now rely on the types provided by
elasticsearch.

A follow-up issue will be linked here to address the other aggregation
types related changes:
[elastic#190497](elastic#190497)

## Testing
- Check the types 
- Host page should load with no errors
- To test if the API works use the request provided in the
[x-pack/plugins/observability_solution/infra/server/routes/infra/README.md](https://github.com/elastic/kibana/compare/main...jennypavlova:kibana:190311-infra-replace-metricsuiaggregation-in-favor-of-estypesaggregationsaggregate?expand=1#diff-e853fdd3f4073eff8ff8a4df6a657f8cb5fefaa231be0116fe3692ae929f26a8)
- if the body is not valid 400 is returned

---------

Co-authored-by: kibanamachine <[email protected]>
@miloszmarcinkowski miloszmarcinkowski self-assigned this Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue low hanging fruit Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants