Skip to content

ref(perf): Accept MutableQuery in data loading hooks#67080

Merged
gggritso merged 7 commits intomasterfrom
ref/perf/accept-mutable-query-in-data-hooks
Mar 18, 2024
Merged

ref(perf): Accept MutableQuery in data loading hooks#67080
gggritso merged 7 commits intomasterfrom
ref/perf/accept-mutable-query-in-data-hooks

Conversation

@gggritso
Copy link
Copy Markdown
Member

@gggritso gggritso commented Mar 15, 2024

Hooks like useSpanMetrics and useSpanMetricsSeries were written early in Starfish, for simple use cases. The filters object is a simple key-value of fields and the values we want. This served us well when we were iterating quickly, but it's not a good choice anymore.

  1. Lots of complex filter conditions can't be expressed using a simple key-value object
  2. We use MutableSearch everywhere else. It's not consistent to have a different API here, and using an object doesn't provide a clear win now that MutableSearch.fromQueryObject exists and makes it easy to create simple filters

This PR updates the data loading hooks to accept a MutableSearch instead.

I think it also would have been fine to have accept either filters or MutableSearch but I didn't like that, it's just more thinking IMO, but you tell me.

gggritso added 6 commits March 6, 2024 13:27
Set `enabled` to the simplest expression that mimics the existing
behaviour.
Replace the `filters` param of `useSpanMetrics` and
`useSpanMetricsSeries` with a `search` param that accepts a
`MutableQuery`.
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 15, 2024
@gggritso gggritso marked this pull request as ready for review March 15, 2024 20:59
@gggritso gggritso requested review from a team and removed request for a team March 15, 2024 20:59
Copy link
Copy Markdown
Contributor

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

I like being opinionated with only allowing MutableSearch to be passed in especially because we don't have to worry about backwards compat here.

@gggritso gggritso merged commit d456c94 into master Mar 18, 2024
@gggritso gggritso deleted the ref/perf/accept-mutable-query-in-data-hooks branch March 18, 2024 18:13
@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants