-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 UI] Replace IFieldType references #121108
[Infra UI] Replace IFieldType references #121108
Conversation
d4f4d50
to
a4b90e4
Compare
a4b90e4
to
8b66df7
Compare
Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI) |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: cc @Kerry350 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation! Out of curiosity, what brought you to this opinion?
Over on the logs side it may well make more sense for some sections of code to use
ResolvedLogSourceConfiguration['fields']
rather than relying on the underlying, backing types.
@weltenwort Thanks for the review.
I think it was mostly with regards to refactoring. I think when we type "our" concept (source config here) and use that, it makes it a lot easier to change things later. It can also make it a bit easier to reason about where things originate from and how they fit into things overall. There are pros and cons though. This would arguably leak concepts and implementation details to layers where they shouldn't be. Anyway, I wimped out regardless and kept with the |
💔 Backport failedThe backport operation could not be completed due to the following error: The backport PRs will be merged automatically after passing CI. To backport manually run: |
Yes, that makes sense. We can introduce custom types when they start to diverge from the data view concepts. |
Summary
Fixes #107885
Replaces all instances of
IFieldType
with suitable replacements.Due to the super permissible nature of the
IFieldType
interface there were some types that were just represented incorrectly. But, becauseIFieldType
designated most fields as optional it didn't really surface the type mismatches.E.g. on the metrics side the derived index pattern was often designated as a
DataViewBase
, and in many ways it looks like one, the problem with the base type is it also expects thefields
to be of the base version. However, we actually use a custom type for the representation there. It's not quite the "full" field, nor the base type, which is why it made more sense to introduce a new accurate type.Over on the logs side it may well make more sense for some sections of code to use
ResolvedLogSourceConfiguration['fields']
rather than relying on the underlying, backing types. However, I had issues getting that to play nicely where we usesupportedFields
in the alerting code (even though there should have been no type mismatch), so instead kept this as theDataViewField
type.