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

Redo traces to use the traces page #8612

Open
Vadman97 opened this issue May 17, 2024 — with Linear · 2 comments
Open

Redo traces to use the traces page #8612

Vadman97 opened this issue May 17, 2024 — with Linear · 2 comments

Comments

Copy link
Member

query the traces endpoint to get network request payloads

@Vadman97 Vadman97 self-assigned this May 17, 2024
Copy link

linear bot commented May 17, 2024

Copy link

greptile-apps bot commented May 17, 2024

To redo traces to use the traces page and query the traces endpoint for network request payloads, follow these steps:

  1. Update TracesPage.tsx:

    • Modify the useGetTraces hook to include network request payloads in the query.
    const { traceEdges, moreTraces, clearMoreTraces, loading, loadingAfter, fetchMoreForward } = useGetTraces({
      query,
      projectId,
      traceCursor,
      startDate,
      endDate,
      skipPolling: !selectedPreset,
      sortColumn,
      sortDirection: sortDirection as SortDirection,
      includePayloads: true, // Add this line to include payloads
    });
  2. Update useGetTraces.ts:

    • Modify the GraphQL query to fetch network request payloads.
    const GET_TRACES_QUERY = gql`
      query GetTraces($projectId: ID!, $query: String, $traceCursor: String, $startDate: String, $endDate: String, $sortColumn: String, $sortDirection: String, $includePayloads: Boolean) {
        traces(projectId: $projectId, query: $query, traceCursor: $traceCursor, startDate: $startDate, endDate: $endDate, sortColumn: $sortColumn, sortDirection: $sortDirection, includePayloads: $includePayloads) {
          edges {
            node {
              traceID
              spanID
              payloads @include(if: $includePayloads) // Add this line to include payloads
            }
          }
        }
      }
    `;
  3. Update TracePage.tsx, TraceLogs.tsx, TraceHeader.tsx, and TracePanel.tsx:

    • Ensure these components handle and display the network request payloads as needed.
    // Example in TracePage.tsx
    const { trace } = useTrace();
    return (
      <div>
        <h1>{trace.traceName}</h1>
        <pre>{JSON.stringify(trace.payloads, null, 2)}</pre> // Display payloads
      </div>
    );
  4. Update TraceProvider.tsx:

    • Ensure the context provides the payloads to the components.
    const TraceProvider = ({ children }) => {
      const { data } = useGetTracesQuery({
        variables: { projectId, includePayloads: true }, // Add includePayloads variable
      });
      return (
        <TraceContext.Provider value={data?.traces}>{children}</TraceContext.Provider>
      );
    };

References

/frontend/src/pages/Traces/TracesPage.tsx
/frontend/src/pages/Traces/TracePage.tsx
/frontend/src/pages/Traces/TraceLogs.tsx
/frontend/src/pages/Traces/TraceHeader.tsx
/frontend/src/pages/Traces/TracePanel.tsx
/frontend/src/pages/Traces

Ask Greptile

@Vadman97 Vadman97 removed their assignment May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant