Threads Interface

The Threads Interface specifies threads that were running at the time an event happened. These threads can also contain stack traces.

An event may contain one or more threads in an attribute named threads.

The threads attribute should be an object with the attribute values containing one or more values that are objects in the format described below. Alternatively, the threads attribute may be a flat list of objects in the format below.

As per Sentry policy, the thread that crashed with an exception should not have a stack trace, but instead, the thread_id attribute should be set on the exception and Sentry will connect the two.

Attributes

id
Required. The ID of the thread. Typically a number or numeric string. Needs to be unique among the threads. An exception can set the thread_id attribute to cross-reference this thread.

crashed
Optional. A flag indicating whether the thread crashed. Defaults to false.

current
Optional. A flag indicating whether the thread was in the foreground. Defaults to false.

name
Optional. The thread name.

stacktrace
Optional. A stack trace object corresponding to the Stack Trace Interface.

If this is an error event, the stack trace of the main exception should be declared in the Exception Interface instead. Sentry will automatically move the stack trace of the only crashed thread, if there is a single exception.

Examples

The following example illustrates the threads part of the event payload and omits other attributes for simplicity.

Copied
{
  "threads": {
    "values": [
      {
        "id": "0",
        "name": "main",
        "crashed": true,
        "stacktrace": {}
      }
    ]
  }
}

Or, alternatively:

Copied
{
  "threads": [
    {
      "id": "0",
      "name": "main",
      "crashed": true,
      "stacktrace": {}
    }
  ]
}
You can edit this page on GitHub.