Skip to content

ref(insights): Improve useSpanSamples hooks #89253

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

gggritso
Copy link
Member

There are two useSpanSamples hooks. One from the HTTP panel, and one "generic" one, used for Queries, Assets, Mobile, etc. The second "generic" one is more fancy, since it calculates its own bounds. I'm going to combine the two hooks soon to eliminate the duplication, but this is a first step to unblock some other work.

  • add types to additionalFields. This also improves type safety of the responses
  • align the parameters passed to useApiQuery from the two hooks. They used to have different stale time and behaviour for some reason
  • have both the useSpanSamples hooks return data and meta. Without meta, I can't plot these samples on new charts, so this unlocks that behaviour
  • remove manual sorting from the hook. One of the hooks manually sorted the samples by duration. This is not necessary as of feat(insights): Add sort parameter to support to span samples endpoint #89230 (so, I need to wait for that PR before I deploy this)

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 10, 2025
@gggritso gggritso marked this pull request as ready for review April 10, 2025 02:16
@gggritso gggritso requested a review from a team as a code owner April 10, 2025 02:16
@gggritso gggritso requested a review from markushi April 10, 2025 02:16
Copy link
Contributor

@DominikB2014 DominikB2014 left a comment

Choose a reason for hiding this comment

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

Nice!

@gggritso gggritso merged commit c05a82a into master Apr 11, 2025
43 checks passed
@gggritso gggritso deleted the georgegritsouk/dain-173-improve-usespanssamples-hook branch April 11, 2025 12:59
Copy link

sentry-io bot commented Apr 15, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ Error: �[2mexpect(�[22m�[31mreceived�[39m�[2m).�[22mtoEqual�[2m(�[22m�[32mexpected�[39m�[2m) // deep equality�[22m Object.?(useSpanSamples.spec.tsx) View Issue

Did you find this useful? React with a 👍 or 👎

andrewshie-sentry pushed a commit that referenced this pull request Apr 22, 2025
There are two `useSpanSamples` hooks. One from the HTTP panel, and one
"generic" one, used for Queries, Assets, Mobile, etc. The second
"generic" one is more fancy, since it calculates its own bounds. I'm
going to combine the two hooks soon to eliminate the duplication, but
this is a first step to unblock some other work.

- add types to `additionalFields`. This also improves type safety of the
responses
- align the parameters passed to `useApiQuery` from the two hooks. They
used to have different stale time and behaviour for some reason
- have both the `useSpanSamples` hooks return data _and_ meta. Without
meta, I can't plot these samples on new charts, so this unlocks that
behaviour
- remove manual sorting from the hook. One of the hooks manually sorted
the samples by duration. This is not necessary as of
#89230 (so, I need to wait for
that PR before I deploy this)
# for free to join this conversation on GitHub. Already have an account? # to comment
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