Skip to content

Conversation

@nsdeschenes
Copy link
Contributor

@nsdeschenes nsdeschenes commented Dec 2, 2025

This pull request introduces support for cross-event querying in several hooks and components, enabling the ability to filter and query across logs, metrics, and spans. The main changes include the addition of a new hook for handling cross-event queries, updates to options and query parameter interfaces to accept new query types, and propagation of these queries throughout the codebase.

Ticket: EXP-621

  • Cross-event querying support:
    • Added the useCrossEventQueries hook along with tests, enabling extraction and organization of queries for logs, metrics, and spans from context, with safeguards for maximum query limits and type validation.
  • Interface and options updates:
    • Extended options interfaces for time series, traces, and table hooks to accept logQuery, metricQuery, and spanQuery arrays, ensuring these queries can be propagated to API requests.
  • Query propagation and API integration:
    • Updated query construction logic in hooks and helper functions to include the new cross-event query parameters when present, ensuring these filters are sent to the backend.

@linear
Copy link

linear bot commented Dec 2, 2025

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Dec 2, 2025
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #104233      +/-   ##
===========================================
- Coverage   80.52%    80.52%   -0.01%     
===========================================
  Files        9345      9345              
  Lines      399870    399867       -3     
  Branches    25644     25643       -1     
===========================================
- Hits       321999    321996       -3     
  Misses      77423     77423              
  Partials      448       448              

@nsdeschenes
Copy link
Contributor Author

@sentry review

@nsdeschenes
Copy link
Contributor Author

@sentry review

@nsdeschenes
Copy link
Contributor Author

@sentry review

@nsdeschenes nsdeschenes marked this pull request as ready for review December 3, 2025 14:42
@nsdeschenes nsdeschenes requested review from a team as code owners December 3, 2025 14:42
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.

👀 the change to useFetchEventsTimeSeries is pretty confusing, I don't think it fits well with how the hook operates. Is it possible to clarify? I left a specific comment on the file. No feelings one way or the other about the rest of it!

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.

Makes sense, I think! I bet that someone who knows this feature better would have better comments, but there are a few things that stuck out to me

Comment on lines +22 to +40
const logQuery: string[] = [];
const metricQuery: string[] = [];
const spanQuery: string[] = [];

for (const crossEvent of slicedCrossEvents) {
switch (crossEvent.type) {
case 'spans':
spanQuery.push(crossEvent.query);
break;
case 'logs':
logQuery.push(crossEvent.query);
break;
case 'metrics':
metricQuery.push(crossEvent.query);
break;
default:
break;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This is kind of a bummer, IMO having to massage parameters that we control is an anti-pattern. Cross event info is stored as JSON in the URL, is it not? if yes, can it be stored in the safe format that it's passed around the codebase?

Copy link
Member

Choose a reason for hiding this comment

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

As an aside this seems like it'd work great with Nuqs parsers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you use the useQueryParamsCrossEvents() it returns an array of cross event objects, this is just a util hook to tidy up things for passing down to data fetching hooks.

useQueryParamsCrossEvents is built into the wider explore query params context setup, so I don't know how easy/hard it would be to convert that over to nuqs.

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.

One nit, otherwise LGTM 👍🏻

@nsdeschenes nsdeschenes force-pushed the nd/exp-621/feat-explore-wire-up-data-fetching-hooks-for-cross-event-queries branch from 899d596 to 9c50fc4 Compare December 5, 2025 12:18
@nsdeschenes nsdeschenes merged commit e75b85d into master Dec 5, 2025
49 checks passed
@nsdeschenes nsdeschenes deleted the nd/exp-621/feat-explore-wire-up-data-fetching-hooks-for-cross-event-queries branch December 5, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

3 participants