Skip to content

Tutorial 3: Analyze the uploaded trace

Launch the analysis

To launch an analysis of the uploaded trace, use the following command:

GraphQL
mutation {
  analyze(input: { traceId: "<trace_id>", profileId: "<profile_id>" }) {
    report {
      id
    }
  }
}

This will return a response of the form:

JSON
{
  "data": {
    "report": {
      "id": "<report_id>"
    }
  }
}

Check the state of the report

Once the analysis has been launched, you can check the status of the report the same way as you did for the initial processing of the trace:

GraphQL
query {
  node(id: "<report_id>") {
    __typename

    ... on ReportFailed {
      reason
    }
  }
}

In the spirit of GraphQL, you can also request more attributes from the report.

Below is a query that will list the first 10 instances of the report, and the first two stack trace frames for each call in each instance:

GraphQL
query {
  node(id: "<report_id>") {
    __typename
    ... on ReportFailed {
      reason
    }
    ... on ReportDone {
      instances(first: 10) {
        pageInfo {
          hasNextPage
          endCursor
        }
        edges {
          node {
            id
            data
            severity
            calls {
              edges {
                node {
                  # The second frame is the call site.
                  stackTrace(first: 2) {
                    edges {
                      node {
                        class
                        method
                        file
                        line
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}