Skip to content

feat(ourlogs): Show all log details when expanding a row - #86240

Merged
k-fish merged 5 commits into
masterfrom
feat/ourlogs/log-detail-row
Mar 4, 2025
Merged

k-fish merged 5 commits into
masterfrom
feat/ourlogs/log-detail-row

Conversation

@k-fish

@k-fish k-fish commented Mar 3, 2025

Copy link
Copy Markdown
Member

Summary

This adds the EventsTagTree like behaviour that queries and shows all log details when opening a row. Once we figure out the rest of the EAP items tables / detail views we can make a generic component.

Blocked on #86235 to replace the mock data in the hook with an actual backend call.

Screenshots

Screenshot 2025-03-03 at 5 16 46 PM

This adds the EventsTagTree like behaviour that queries and shows all log details when opening a row.
@k-fish k-fish self-assigned this Mar 3, 2025
@k-fish
k-fish requested a review from a team as a code owner March 3, 2025 22:22
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 3, 2025
@codecov

codecov Bot commented Mar 3, 2025 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 42.3MB (100.0%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
app-webpack-bundle-array-push 42.3MB 42.3MB (100%) ⬆️⚠️

@k-fish k-fish changed the title rfeat(ourlogs): Show all log details when expanding a row feat(ourlogs): Show all log details when expanding a row Mar 3, 2025
@k-fish
k-fish enabled auto-merge (squash) March 4, 2025 20:14
@k-fish
k-fish merged commit f7bd2b8 into master Mar 4, 2025
@k-fish
k-fish deleted the feat/ourlogs/log-detail-row branch March 4, 2025 20:15
Comment on lines +51 to +74
export function useExploreLogsTableRow(_props: {
log_id: string | number;
project_id: string;
enabled?: boolean;
}) {
const organization = useOrganization();
const {projects} = useProjects();
const _project = projects.find(p => p.id === _props.project_id);

const {data, isError, isPending} = useQuery<OurLogsTableRowDetails>({
queryKey: ['logs-table-row', _props.log_id, _props.project_id],
queryFn: async () => {
if (!_project) {
throw new Error('Project not found');
}
const res = await fetch(
`/api/0/projects/${organization.slug}/${_project?.slug}/trace-items/${_props.log_id}/?dataset=ourlogs`
);
if (!res.ok) {
throw new Error('Failed to fetch log details');
}
return await res.json();
},
});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hey @k-fish @colin-sentry 👋

I’m currently in the process of turning on the eslint-plugin-query, which contains lint rules for using react query.

I got some violations reported here because not everything that we use inside the queryFn is also part of the query key. It’s essential to keep those “dependencies” in sync with the query key, which is why the rule exists.

I don’t know enough about how this specific query is used, so I’ve just disabled the linter for now (see here), but I would appreciate a follow-up here.

Specifically, I’ve noticed a couple of things:

  1. enabled can be passed as an option (which is also done at one call-side), but it’s not forwarded to useQuery.
  2. the check for !_project seems to be a “this should never happen case”, so maybe, we should rather disable the query too if that’s the case?
  3. for a type-safe way to do disabling, react-query offers a skipToken that can be used instead of the queryFn.
  4. I think this is the only place that uses fetch directly rather than our apiClient. Not sure if this is on purpose, but I think the best way to use react-query with our apiClient is either via useApiQuery directly, or by using fetchDataQuery as the queryFn.

I’m happy to contribute here or jump on a quick sync to discuss this if you want.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah that's all fine, I'm replacing this anyway, just wrote it quickly for log details. I'll address these comments then.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thank you 👍

@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2025

This branch was successfully deployed

1 active deployment
Preview — e3ba2489 Deployed Mar 4, 2025 by vercel[bot]
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.

3 participants