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

feat(performance): Updates useIndexedSpans to accept an optional fields array #66275

Merged

Conversation

edwardgou-sentry
Copy link
Contributor

Updates useIndexedSpans to accept an optional fields array to allow selecting specific fields.
Refactors existing call to use new function signature.

@edwardgou-sentry edwardgou-sentry requested review from a team March 4, 2024 23:41
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 4, 2024
@edwardgou-sentry
Copy link
Contributor Author

edwardgou-sentry commented Mar 4, 2024

Reusing this hook for INP span samples and I want to be able to selectively choose fields.

Copy link
Member

@gggritso gggritso left a comment

Choose a reason for hiding this comment

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

Very nice! I know this hook doesn't have any existing specs, but right now is a really great time to add some 🙏🏻

static/app/views/starfish/queries/useIndexedSpans.tsx Outdated Show resolved Hide resolved
static/app/views/starfish/queries/useIndexedSpans.tsx Outdated Show resolved Hide resolved
static/app/views/starfish/queries/useIndexedSpans.tsx Outdated Show resolved Hide resolved
Comment on lines +25 to +27
// TODO: we're using all SpanIndexedFields here, but maybe we should only use what we need?
// Truncate to 20 fields otherwise discover will complain.
const fields = Object.values(SpanIndexedField).slice(0, 20);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a todo note here. We need to update this because SpanIndexedField is eventually going to grow beyond 20 elements and Discover doesn't support querying more than 20.

Copy link
Member

Choose a reason for hiding this comment

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

Up to you, but IMO it's fine to let Discover complain, rather than truncating the fields, since that's a silent failure! Anyone who doesn't know about the limit would be really confused why fields they're asking for aren't coming back, and everyone should provide the list of fields they want, rather than defaulting to all fields coming back

Copy link
Member

@gggritso gggritso left a comment

Choose a reason for hiding this comment

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

Wouldn't be mad about a spec here, but doesn't have to be this PR 👍🏻

@edwardgou-sentry edwardgou-sentry merged commit 8594fa7 into master Mar 5, 2024
39 checks passed
@edwardgou-sentry edwardgou-sentry deleted the egou/feat/allow-field-selection-on-indexed-spans branch March 5, 2024 18:41
aliu3ntry pushed a commit that referenced this pull request Mar 6, 2024
…ds array (#66275)

Updates useIndexedSpans to accept an optional fields array to allow
selecting specific fields.
Refactors existing call to use new function signature.
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 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.

None yet

2 participants