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 was the cause for the event being sent, e.g. due to a crash. Defaults to false.

current
Optional. A flag indicating whether the thread was in the foreground. A thread is in foreground when it's executing. Defaults to false.

main
Optional. If applicable, a flag indicating whether the thread was responsible for rendering the user interface. On mobile platforms this is oftentimes referred to as the "main thread" or "ui thread".

name
Optional. The thread name.

state
Optional. State of the thread at the time of the event.

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.