Content is compiled from official development documentation

Event Payload

Events are the basic data that the client sends to the Sentry server, usually using the SDK. The maximum size of an Event payload is 200kb.

The API endpoint on the Sentry Server that receives the event payload is/API /{PROJECT_ID}/store/.

Required attribute

Properties are simple data understood by Sentry to provide the most basic information about the event. These are things like the unique ID of the event or the time the event happened.

All events require the following attributes.

event_id

  • RequiredSaid.uuid4Value is a hexadecimal string. The length is exactly32A character. Dashes are not allowed (-). It must be lowercase.
{
"event_id": "fc6d8c0c43fc4630ad850ee518f1b9d0"
}
Copy the code

timestamp

  • Instructions inSentry SDKThe time when the event was created in. The format is eitherRFC 3339A string defined in theThe number of seconds since the Unix eraThe numeric (integer or floating point) value of.
    • Tools.ietf.org/html/rfc333…
    • En.wikipedia.org/wiki/Unix_t…
{
  "timestamp": "2011-05-02T17:41:36Z"
}
Copy the code

Or:

{
  "timestamp": 1304358096.0
}
Copy the code

platform

  • saidSDKThe submitted platform string. This will beSentryInterfaces are used to customize the various components in the interface.
{
  "platform": "python"
}
Copy the code

Acceptable values are:

  • as3
  • c
  • cfml
  • cocoa
  • csharp
  • elixir
  • haskell
  • go
  • groovy
  • java
  • javascript
  • native
  • node
  • objc
  • other
  • perl
  • php
  • python
  • ruby

Optional attribute

In addition, Sentry recognizes and highly encourages the following optional values:

level

  • Record severity.

The default is error.

The value needs to be a supported level string value.

{
  "level": "warning"
}
Copy the code

Acceptable values are:

  • fatal
  • error
  • warning
  • info
  • debug

logger

  • That created the recordloggerThe name of the.
{
  "logger": "my.logger.name"
}
Copy the code

transaction

  • Result in thisexceptiontransactionThe name of the.

For example, in a Web application, this might be the route name.

{
  "transaction": "/users/<username>/"
}
Copy the code

server_name

  • Identifies a recording eventhost.
{
  "server_name": "foo.example.com"
}
Copy the code

release

  • The release version of the application.

A release must be unique across all projects in your organization. This value can be a Git SHA for a given project or a product identifier with a semantic version (the recommended format is [email protected]).

{
  "release": "[email protected]"
}
Copy the code
{
  "release": "721e41770371db95eee98ca2707686226b993eda"
}
Copy the code

dist

  • Distribution of the application (distribution).

A Distribution is used to disambiguate build or deployment variants of the same version of an application. For example, dist can be the build number for an XCode build or the Version code for an Android build.

{
  "release": "721e41770371db95eee98ca2707686226b993eda"."dist": "14G60"
}
Copy the code

tags

  • OptionalThe eventtagsmaplist, eachtagMust be less than200A character.
{
"tags": {
  "ios_version": "4.0"."context": "production"}}Copy the code

environment

  • Environment name, for exampleproductionstaging.
{
  "environment": "production"
}
Copy the code

modules

  • A list of related modules and their versions.
{
  "modules": {
    "my.module.name": "1.0"}}Copy the code

extra

  • Any mapping of the additional metadata stored with the event.
{
  "extra": {
    "my_key": 1."some_other_value": "foo bar"}}Copy the code

fingerprint

  • A list of strings used to indicate deduplication for this event.
{
  "fingerprint": ["myrpc"."POST"."/foo.bar"]}Copy the code
{
  "fingerprint": ["{{ default }}"."http://example.com/my.url"]}Copy the code

errors

: A list of errors that catch or process this event. This provides metadata about the event capture and processing itself, not about the error or transaction that the event represents.

This list is populated primarily by Sentries as they receive and process events. If there are serious cases that Sentry cannot detect by examining the remaining load, the SDK is only encouraged to add entries here.

Errors must contain the required Type field, which can be one of the types declared in the Sentry EventError model. If there is no applicable type variant, consider opening an issue to suggest an addition.

Any attribute except type is valid. If you include semantics for common error attributes, there is a convention:

  • Name: string that declares the path of the payload field that causes or displays an error. Such as modules [0]. Name.

  • Value: The original value of the field that causes or displays error.

{
  "errors": [{"type": "unknown_error"."path": "/var/logs/errors.log.1"."details": "Failed to read attachment"}}]Copy the code

The core interface

All values in the Event Payload that are not basic attributes are data interfaces. Key is the short name of the normalized interface, and the value is the data (usually a dictionary) expected by the interface.

For the most part, interfaces are an evolving part of Sentry. As with properties, the SDK expects to add more interfaces at any time in the future.

The core data interface is:

  • Exception Interface
  • Message Interface
  • Stack Trace Interface
  • Template Interface

Scope interface

  • Breadcrumbs Interface
  • User Interface
  • Request Interface
  • Contexts Interface
  • Threads Interface

Other interfaces

  • Debug Meta Interface
  • SDK Interface

The type definition

  • Event Type Definitions

Span Interface

The Span interface specifies a series of _timed _ application events with start and end times.

A Transaction can have zero or more spans in an array property called SPANS. The spans in the list do not have to be sorted; they are sorted by the start/end time on the server.

Although the Span attribute will be normalized on the server, it is most useful when the Span contains at least one OP and description.

attribute

span_id:

  • Required. The value is a random hexadecimal string of 16 characters.
{
"span_id": "99659d76b7cdae94"
}
Copy the code

parent_span_id:

  • Optional. If this Span should be rendered as a child of another Span, set this property to the ID of the parent.
{
"parent_span_id": "b0e6f15b45c36b12"
}
Copy the code

trace_id:

  • Required. DeterminingSpanBelong to whichtrace. The value should be encoded as a hexadecimal string (32Two characters long16A random byte.
{
"trace_id": "1e57b752bc6e4544bbaa246cd1d05dee"
}
Copy the code

op

  • Recommended. A short code that identifies the type of operation that span is measuring.
{
"op": "db.query"
}
Copy the code

description

  • OptionalforspanA longer description of the operation, which is uniquely identifiedspanBut acrossspanThe instances are consistent.
{
"description": "SELECT * FROM users WHERE last_active < DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR)`"
}
Copy the code

start_timestamp

  • Required. Indicates the timestamp of the measurement start time. The format is eitherRFC 3339A string defined in theThe Unix epochThe numeric (integer or floating point) value of the number of seconds that have elapsed since.start_timestampThe value must be greater than or equal to the timestamp value, otherwiseSpanWill be considered invalid and discarded.
{
"start_timestamp": "The 2011-05-02 T17:41:36. 242 z"
}
Copy the code

Or:

{
"start_timestamp": 1304358096.242
}
Copy the code

timestamp

  • Required. Represents the timestamp when the measurement is completed. The format is eitherRFC 3339A string defined in theThe Unix epochThe numeric (integer or floating point) value of the number of seconds that have elapsed since.
{
"timestamp": "The 2011-05-02 T17:41:36. 955 z"
}
Copy the code

Or:

{
"timestamp": 1304358096.955
}
Copy the code

status

  • OptionalDescription.Span/Transactionstate.
State Description HTTP status code equivalent
ok Not error, return on success 200 and 2XX HTTP statuses
cancelled The operation is cancelled, usually by the caller 499
unknown or unknown_error Unknown error caused by an API that does not return sufficient error information 500
invalid_argument The client specified an invalid parameter 400
deadline_exceeded The deadline has passed before the operation succeeds 504
not_found The entire category of users whose content was not found or whose request was rejected 404
already_exists The entity you are trying to create already exists 409
permission_denied The caller has no right to perform the specified operation 403
resource_exhausted Resources have been used up. For example, the quota of each user has been used up. The file system space is insufficient 429
failed_precondition The client should not retry until the system state is explicitly handled 400
aborted Operation aborted 409
out_of_range Try to operate beyond the valid range, such as looking past the end of a file 400
unimplemented This operation is not implemented or not supported/enabled 501
internal_error Some of the invariants expected by the underlying system have been broken. This code is reserved for critical errors 500
unavailable The service is currently available, for example, as a transitional condition 503
data_loss Unrecoverable data is lost or damaged 500
unauthenticated The requester does not have valid authentication credentials for the operation 401
{
  "status": "ok"
}
Copy the code

tags

  • OptionalThe eventtagsmaplist, eachtagMust be less than200A character.
{
"tags": {
  "ios_version": "4.0"."context": "production"}}Copy the code

data

  • Optional. Arbitrary data associated with this Span.
{
  "data": {
    "url": "http://localhost:8080/sockjs-node/info? t=1588601703755"."status_code": 200."type": "xhr"."method": "GET"}}Copy the code

The sample

The following example illustrates Span as part of a Transaction and omits other attributes for simplicity.

{
  "spans": [{"trace_id": "1e57b752bc6e4544bbaa246cd1d05dee"."span_id": "b01b9f6349558cd1"."parent_span_id": "b0e6f15b45c36b12"."op": "http"."description": "GET /sockjs-node/info"."status": "ok"."start_timestamp": 1588601261.481961."timestamp": 1588601261.488901."tags": {
        "http.status_code": "200"
      },
      "data": {
        "url": "http://localhost:8080/sockjs-node/info? t=1588601703755"."status_code": 200."type": "xhr"."method": "GET"}}, {"trace_id": "1e57b752bc6e4544bbaa246cd1d05dee"."span_id": "b980d4dec78d7344"."parent_span_id": "9312d0d18bf51736"."op": "update"."description": "Vue <App>"."start_timestamp": 1588601261.535386."timestamp": 1588601261.544196}}]Copy the code

Transaction Payloads

Transactions are used to send trace events to Sentry.

Transactions must be wrapped in the Envelope and therefore must also be sent to the Envelope endpoint.

Analyze the

Transaction is basically a Span combined with an Event. When using tracing in our SDK, you typically create a Span tree where the root node and the entire tree are treated as transactions. So Transaction is technically just a Span. Transaction must also have a context.trace (which contains some data for Span) and some other properties, which are covered in the next section.

Transaction is a Span data-rich event. We will only list here what is important to Transaction.

type

  • Required. Transactions must set this value totransaction.
{
"type": "transaction"
}
Copy the code

start_timestamp

  • Required. Indicates the timestamp of the measurement start time. The format is eitherRFC 3339A string defined in theThe Unix epochThe numeric (integer or floating point) value of the number of seconds that have elapsed since.start_timestampThe value must be greater than or equal to the timestamp value, otherwiseSpanWill be considered invalid and discarded.
{
"start_timestamp": "The 2011-05-02 T17:41:36. 242 z"
}
Copy the code

Or:

{
"start_timestamp": 1304358096.242
}
Copy the code

timestamp

  • Required. Represents the timestamp when the measurement is completed. The format is eitherRFC 3339A string defined in theThe Unix epochThe numeric (integer or floating point) value of the number of seconds that have elapsed since.
{
"timestamp": "The 2011-05-02 T17:41:36. 955 z"
}
Copy the code

Or:

{
"timestamp": 1304358096.955
}
Copy the code

contexts.trace

Transaction must have a context. Trace entry that contains data from Span.

span_id:

  • Required. The value is a random hexadecimal string of 16 characters.
{
"span_id": "99659d76b7cdae94"
}
Copy the code

parent_span_id:

  • Optional. If this Span should be rendered as a child of another Span, set this property to the ID of the parent.
{
"parent_span_id": "b0e6f15b45c36b12"
}
Copy the code

trace_id:

  • Required. DeterminingSpanBelong to whichtrace. The value should be encoded as a hexadecimal string (32Two characters long16A random byte.
{
"trace_id": "1e57b752bc6e4544bbaa246cd1d05dee"
}
Copy the code

op

  • Recommended. A short code that identifies the type of operation that span is measuring.
{
"op": "db.query"
}
Copy the code

description

  • OptionalforspanA longer description of the operation, which is uniquely identifiedspanBut acrossspanThe instances are consistent.
{
"description": "SELECT * FROM users WHERE last_active < DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR)`"
}
Copy the code

status

  • OptionalDescription.Span/Transactionstate.
State Description HTTP status code equivalent
ok Not error, return on success 200 and 2XX HTTP statuses
cancelled The operation is cancelled, usually by the caller 499
unknown or unknown_error Unknown error caused by an API that does not return sufficient error information 500
invalid_argument The client specified an invalid parameter 400
deadline_exceeded The deadline has passed before the operation succeeds 504
not_found The entire category of users whose content was not found or whose request was rejected 404
already_exists The entity you are trying to create already exists 409
permission_denied The caller has no right to perform the specified operation 403
resource_exhausted Resources have been used up. For example, the quota of each user has been used up. The file system space is insufficient 429
failed_precondition The client should not retry until the system state is explicitly handled 400
aborted Operation aborted 409
out_of_range Try to operate beyond the valid range, such as looking past the end of a file 400
unimplemented This operation is not implemented or not supported/enabled 501
internal_error Some of the invariants expected by the underlying system have been broken. This code is reserved for critical errors 500
unavailable The service is currently available, for example, as a transitional condition 503
data_loss Unrecoverable data is lost or damaged 500
unauthenticated The requester does not have valid authentication credentials for the operation 401
{
  "status": "ok"
}
Copy the code

The sample

{
  "contexts": {
    "trace": {
      "op": "navigation"."description": "User clicked on <Link />"."trace_id": "743ad8bbfdd84e99bc38b4729e2864de"."span_id": "a0cfbde2bdff3adc"."status": "ok"."parent_span_id": "99659d76b7cdae94"}}}Copy the code

spans

  • Recommended. SpanList.
{
  "spans": [{"start_timestamp": 1588601261.481961."description": "GET /sockjs-node/info"."tags": {
        "http.status_code": "200"
      },
      "timestamp": 1588601261.488901."parent_span_id": "b0e6f15b45c36b12"."trace_id": "1e57b752bc6e4544bbaa246cd1d05dee"."op": "http"."data": {
        "url": "http://localhost:8080/sockjs-node/info? t=1588601703755"."status_code": 200."type": "xhr"."method": "GET"
      },
      "span_id": "b01b9f6349558cd1"
    },
    {
      "start_timestamp": 1588601261.535386."description": "Vue <App>"."timestamp": 1588601261.544196."parent_span_id": "9312d0d18bf51736"."trace_id": "1e57b752bc6e4544bbaa246cd1d05dee"."op": "update"."span_id": "b980d4dec78d7344"}}]Copy the code

Breadcrumbs Interface

Sentry uses breadcrumbs to create a trace of events that occurred before the problem. These events are very similar to traditional logging, but can record richer structured data.

This page provides technical information on breadcrumb structure. You can read an overview of manual Breadcrumbs logging and customization on our Breadcrumbs Sentry documentation page.

  • Docs. Sentry. IO/platform – re…

An event may contain a breadcrumbs property with an entry values, which is an array of breadcrumbs objects. Entries are arranged in order from oldest to newest. Therefore, the last entry in the list should be the most recent entry before the event occurred.

The following example illustrates the breadcrumb portion of the Event Payload, omitting the other attributes for simplicity.

{
  "breadcrumbs": {
    "values": [{"timestamp": "The 2016-04-20 T20:55:53. 845 z"."message": "Something happened"."category": "log"."data": {
          "foo": "bar"."blub": "blah"}}, {"timestamp": "The 2016-04-20 T20:55:53. 847 z"."type": "navigation"."data": {
          "from": "/login"."to": "/dashboard"}}]}}Copy the code

The breadcrumb object contains the attribute Values, which is an array of objects with the following properties:

type (optional)

  • The type of bread crumbs. By default, all breadcrumbs are logged asdefault, which makes them appear asDebugEntries, butSentryAdditional types are provided that influence the way crumbs are presented.

category (optional)

  • A dotted string indicating what the crumbs are or where they came from. Usually it is a module name or a descriptive string. For example,ui.clickCan be used to indicate inUIA click occurred in, orflaskCan be used to indicate that events originate fromFlaskFramework.

message (optional)

  • Crumbs of human readable message.

If message is provided, it is rendered as text with all whitespace reserved.

data (optional)

  • Any data associated with this bread crumb.

Contains a dictionary whose content depends on the breadcrumb type. Other parameters that are not supported by the type are rendered as key/value tables.

level (optional)

  • This defines the severity level of breadcrumbs. The allowed values from highest to lowest are:fatal,error,warning,infodebug. inUIThe use oflevelTo accentuate and tone down the crumbs. The default value isinfo.

timestamp (recommended)

  • A timestamp indicating when the breadcrumb appeared. The format is either a string defined in RFC 3339 or a numeric (integer or floating point) value representing the number of seconds that have passed since the Epoch.

The breadcrumb is most useful when it contains a timestamp, because it creates a timeline that causes the event expection/error.

Crumbs are not sorted by timestamp, they are kept in order by the way they were added.

Breadcrumb Types

Below is a description of each breadcrumb type and what their data attribute looks like.

default

  • Describe universal bread crumbs. This is usually log messages or user-generated breadcrumbs.dataSections are completely undefined and therefore completely rendered askey/valueTable.
{
  "type": "default"."category": "started"."data": undefined,
  "level": "info"."message": "this is a message"."timestamp": 1596814007.035
}
Copy the code

debug

  • This is usually a log message.dataSections are completely undefined and therefore completely rendered askey/valueTable.

On the inside, we showdefaultType of breadcrumb, which contains the categoryconsoleAs adebugType of bread crumbs.

{
  "type": "debug"."category": "started"."data": null."level": "info"."message": "this is a message"."timestamp": 1596814007.035
}
Copy the code

error

  • The error that occurred before the exception.
{
  "type": "error"."category": "error"."level": "error"."message": "this is a message"."timestamp": 1596814007.035
}
Copy the code

navigation

  • Navigation events can beWebIn the applicationURLChange, ormobiledesktopIn the applicationUIConversion, etc.

On the inside, we showdefaultType of breadcrumb, which contains the categorynavigationAs anavigationType of bread crumbs.

Its data attribute has the following subattributes:

from (Required)

A string representing the original application state/location.

to (Required)

A string representing the state/location of the new application.

{
  "type": "navigation"."category": "navigation"."timestamp": "The 2016-04-20 T20:55:53. 845 z"."data": {
    "from": "/login"."to": "/dashboard"}}Copy the code

http

  • This represents the transfer from your applicationHTTPThe request. This could be fromWebapplication-specificAJAXRequest, or yesAPI service providerserver-to-serverHTTPRequest, etc.

Its data attribute has the following subattributes:

url (optional)

The requested URL.

method (optional)

HTTP request method.

status_code (optional)

The HTTP status code of the response.

reason (optional)

Text describing the status code.

{
  "type": "http"."category": "xhr"."data": {
    "url": "http://example.com/api/1.0/users"."method": "GET"."status_code": 200."reason": "OK"
  },
  "timestamp": "The 2016-04-20 T20:55:53. 845 z"
}
Copy the code

info

  • Information that can help determine the root cause of the problem or the person who made the mistake.
{
  "type": "info"."category": "started"."level": "info"."message": "this is a message"."timestamp": 1596813998.386
}
Copy the code

query

  • This represents the query being made in your application.
{
  "type": "query"."category": "started"."level": "info"."message": "this is a message"."timestamp": 1596813998.386
}
Copy the code

transaction

  • Describes trace events.

Internally, we display type asdefaultBreadcrumbs, which contain categoriessentry.transactionsentry.eventAs atransactionType of bread crumbs.

{
  "type": "default"."category": "sentry.transaction"."level": "info"."message": "this is a message"."timestamp": 1596813997.646
}
Copy the code

ui

  • User interaction with the application UI.

Internally, we will include categoriesui.*defaultType of bread crumbs shown asuiType of bread crumbs.

{
  "type": "default"."category": "ui.click"."message": "div.css-bsbdc4-TextOverflow.e1kpcezi0"."level": "info"."timestamp": 1598613151.875368
}
Copy the code

user

  • User interaction with the application UI.
{
  "type": "user"."category": "click"."message": "div.css-bsbdc4-TextOverflow.e1kpcezi0"."level": "info"."timestamp": 1598613151.875368
}
Copy the code

Contexts Interface

Context interfaces provide additional context data. Typically, this is data related to the current user and environment. For example, device or Application Version. Its canonical name is Contexts.

The Contexts type can be used to define any context data for events. It accepts the object of a key/value pair. Key is the “alias” of the context and is optional. However, according to the policy, it should match the type of the context unless a type has two values. If the key name is a type, you can omit type.

When adding additional data to the Event Data Model, the context is great if you have all the data available ata single point in time. Context is not a good fit for data collected over time because the SDK interface for context cannot merge the data.

The context’s Unknown data is rendered as a key/value list.

Device Context

Device context describes the device that caused the event. This is best suited for mobile applications.

The type and default key are “device”.

name

  • Required. Device name. This is usually hostname.

family

  • Optional. Equipment series. This is usually a common part of model names across generations. For example,iPhoneWould be a reasonable series,Samsung GalaxyWill also be a reasonable series.

model

  • Optional. Model name. For example, this could beSamsung Galaxy S3.

model_id

  • Optional. Internal hardware revisions for accurate identification of devices.

arch

  • Optional. CPU architecture.

battery_level

  • OptionalIf the device has a battery, this can be a floating point value (in the 0-100 range) that defines the battery power.

orientation

  • Optional. This can be a string that defines the direction of the devicePortrait (vertical)Landscape (horizontal).

manufacturer

  • Optional. Manufacturer of equipment.

brand

  • Optional. Brand of equipment.

screen_resolution

  • OptionalScreen resolution (for example, 800×600, 3040×1444).

screen_height_pixels

  • OptionalThe height of the screen.

screen_width_pixels

  • OptionalThe width of the screen.

screen_density

  • Optional. Floating point number representing screen density.

screen_dpi

  • OptionalThe reflectionDPIDecimal value of density (points per inch).

online

  • Optional. Whether the device is online.

charging

  • Optional. The device is being charged.

low_memory

  • Optional. Whether the memory of the device is insufficient.

simulator

  • OptionalIndicates whether the device is a simulator or a real deviceflag.

memory_size

  • Optional. Total system memory available, in bytes.

free_memory

  • OptionalFree system memory (in bytes).

usable_memory

  • Optional. The memory (in bytes) available for the application.

storage_size

  • Optional. Total storage capacity of the device (in bytes).

free_storage

  • Optional. Free storage of the device (in bytes).

external_storage_size

  • Optional. Total size (in bytes) of attached external storage (for example,android SDK card).

external_free_storage

  • Optional. The free size (in bytes) of additional external storage (for example,android SDK card).

boot_time

  • Optional.formatted when the system startsUTCThe time stamp. For example,"2018-02-08T12:52:12Z".

timezone

  • Optional. Time zone of the device. For example,Europe/Vienna.

language

  • Optional. Device language. For example,en-US.

processor_count

  • Optional. Logic processorThe number of. For example,8.

cpu_description

  • Optional. CPU description. For example,Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz.

processor_frequency

  • Optional. OnMHzIs the processor frequency in units. Please note that the actual CPU frequency may vary depending on current load and power conditions, especially on low-power devices such as mobile phones and laptops.

device_type

  • Optional. Type of device on which the application is running. For example,Unknown, Handheld, Console, Desktop.

battery_status

  • Optional. Device battery status. For example,Unknown, Charging, Discharging, NotCharging, Full.

device_unique_identifier

  • Optional. Unique device identifier. Only when enabledsendDefaultPiiYou can use this value only when.

supports_vibration

  • OptionalIs there vibration on the equipment?

supports_accelerometer

  • OptionalIs there an accelerometer on the device?

supports_gyroscope

  • OptionalIs there a gyroscope on the equipment?

supports_audio

  • OptionalIs there audio on the device?

supports_location_service

  • OptionalIs the device able to report its location?

OS Context

OS Context describes the operating system on which events are created. In a Web context, this is the browser’s operating system (typically extracted from the User-Agent string).

The type and default key are “OS”.

name

  • Recommended. Operating system name. It probably comes fromraw_description. If not providedraw_description,required.

version

  • Optional. Operating system version.

build

  • OptionalInternal builds of the operating system.

kernel_version

  • Optional. A separate kernel version string. This is usuallyunameThe entire output of the system call.

rooted

  • OptionalIndicates whether the operating system has been jailbroken orrootedLogo.

theme

  • Optional. lightdark. Describes whether the operating system is running in dark mode.

raw_description

  • Optional. Unprocessed description string obtained by the operating system. For some well-known runtimes, if not explicitly given,SentryParsing will be attempted from this stringnameversion.

The sample

The OS context of the three major operating systems should be as follows:

{
  "windows": {
    "type": "os"."name": "Windows"."version": "10.0.19041"."build": "662",},"mac": {
    "type": "os"."name": "macOS"."version": "11.1.0"."build": "20C69"."kernel_version": "20.2.0"
  },
  "linux": {
    "type": "os"."name": "Linux"."version": "5.10.6"."build": "arch1-1"}}Copy the code

Runtime Context

The Runtime Context describes the Runtime in more detail. Typically, this context is used multiple times if multiple runtimes are involved (for example, if you have a JavaScript application running on a JVM).

Type and default key are “Runtime”.

name

  • Recommended. The name of the runtime. It probably comes fromraw_description. If not providedraw_description,required.

version

  • Optional. Runtime version identifier.

raw_description

  • Optional. Unprocessed description string retrieved at runtime. For some well-known runtimes, if not explicitly given,SentryParsing will be attempted from this stringnameversion.

App Context

App Context describes the application. In contrast to the runtime, this is the actual application that is running and carrying metadata about the current session.

The type and default key are “app”.

app_start_time

  • Optional. Formatted UTC timestamp when the user starts the application.

device_app_hash

  • Optional. Application-specific device identifier.

build_type

  • Optional. String that identifies the build type. For example,testflight.

app_identifier

  • Optional. A version-independent application identifier, usually a dotted onebundle ID.

app_name

  • Optional. Human-readable application name as it appears inplatformOn.

app_version

  • Optional. Human-readable version of the application as it appears inplatformOn.

app_build

  • OptionalShow inplatformInternal build identifier on.

Browser Context

The Browser Context carries Web-related error information about the Browser or user Agent. This can be either the browser where the event occurred or the User Agent of the Web request that triggered the event.

The type and default key are “browser”.

name

  • Required. Display name of the browser application.

version

  • Optional. Browser version character string.

GPU Context(GPU Context)

GPU Context Describes the GPU of a device.

name

  • Required. The name of the graphics device.

version

  • Optional. Version of the graphics device.

id

  • Optional. PCI identifier of graphics device.

vendor_id

  • Optional. PCI vendor identifier for graphics devices.

vendor_name

  • Optional. Vendor name of graphic device report.

memory_size

  • Optional. Total AVAILABLE GPU memory in megabytes.

api_type

  • Optional. Device underlying API type.

    Example: “Apple Metal” or “Direct3D11”

multi_threaded_rendering

  • Optional. GPUWhether you have multithreaded rendering.

npot_support

  • OptionalNon-power-of-two-support (non-quadratic Support).

max_texture_size

  • Optional. Maximum texture size supported by graphics hardware. For example,16384.

graphics_shader_level

  • Optional. Graphics equipment approximationShader CapabilityLevel. For example,Shader Model 2.0, OpenGL ES 3.0, Metal/OpenGL ES 3.1, 27 (unknown).

supports_draw_call_instancing

  • Optional. Does GPU drawing call instance support?

supports_ray_tracing

  • OptionalIs ray tracing available on the device?

supports_compute_shaders

  • OptionalIs computational shader available on the device?

supports_geometry_shaders

  • Optional. Can I use geometry shaders on the device?

Example:

"gpu": {
  "name": "AMD Radeon Pro 560"."vendor_name": "Apple"."memory_size": 4096."api_type": "Metal"."multi_threaded_rendering": true."version": "Metal"."npot_support": "Full"
}
Copy the code

State Context

The State Context describes the State of the application (for example, the Redux Store object).

The type and default key are “state”.

state

  • Required. There are twokeyObject for naming state libraries (e.g., Redux, MobX, Vuex)optional typeAnd savestateThe object’snecessary value.

Example:

"state": {
  "state": {
    "type": "MobX"."value": {
      "flights": []."airports": []."showModal": false}}},Copy the code

Culture Context

The Culture Context describes certain attributes of the Culture that uses the software.

The type and default key are “culture”.

calendar

  • Optional. For exampleGregorianCalendar. A free-form string.

display_name

  • OptionalHuman-readable names of cultures. For example,English (United States)

locale

  • Optional. Name identifier, usually followedRFC 4646. For example,en-USpt-BR.

is_24_hour_format

  • Optional. Boolean value,truefalse.

timezone

  • Optional. Time zone of the region. For example,Europe/Vienna.

The sample

The following example illustrates the context portion of the Event Payload, omitting the other attributes for simplicity.

{
  "contexts": {
    "os": {
      "name": "Windows"
    },
    "electron": {
      "type": "runtime"."name": "Electron"."version": "4.0"}}}Copy the code

Debug Meta Interface

The debug meta-interface carries debugging information for handling error and crash reports. Sentry Modifies the information in this interface.

The Attributes (properties)

sdk_info

  • Objects describing the system SDK:sdk_name,version_major,version_minorversion_patchlevel. This will helpSentrypositioningiOSsystemsymbols, otherSDKDon’t need.
{
  "sdk_name": "iOS"."version_major": 10."version_minor": 3."version_patchlevel": 0
}
Copy the code

images

  • A list of dynamic libraries loaded into the process (see below).

Debug Images

The debug image list contains all the dynamic libraries loaded into the process and their memory addresses. The instruction addresses in the Stack Trace are mapped to a list of debug images to retrieve debug files for symbolization.

There are two types of debug images:

  • withmacho,elfpeType of native debug image
  • A type ofproguardAndroidThe debug image

MachO image

MachO images are used for the Apple platform. Their structure is the same as other native images.

Properties:

type

  • Required. Debug the image type. It must be"macho".

image_addr

  • RequiredMemory address, the location in the virtual address space of the process where the image is installed. Should be based on"0x"The hexadecimal representation of the prefix is a string.

image_size

  • The size of the image in virtual memory. If lost,SentryThe mirror will be assumed to span to the next mirror, which may result in an invalid stack trace.

debug_id

  • Required. Identifier of a dynamic library or executable. It is aMachIn the headLC_UUIDThe value of the load command in the format ofUUID.

debug_file

  • Optional: contains debugging information about the imagedSYMThe optional name or absolute path of the file. In somesymbolThe server may need this value to retrieve debug files.

code_id

  • Optional. Identifier of a dynamic library or executable. It is aMachIn the headLC_UUIDThe value of the load command in the format ofUUID.MachThe image can be empty because it is equivalent to a debug identifier.

code_file

  • Optional. The absolute path to a dynamic library or executable. If the file is inSentryThis helps locate the file.

image_vmaddr

  • Optional. The preferred loading address of the image in virtual memory, as declared in the image header. When loading the image, the operating system may still choose to place it at a different address.

If this value is non-zero, all symbols and addresses declared in the native image start at this address, not 0. In contrast, Sentry handles the address relative to the start of the mirror. For example, for image_VMADDR: 0x40000, the symbol at 0x401000 has a relative address of 0x1000.

Relative addresses used in Apple Crash Reports and Addr2line are typically in the preferred address space, not the relative address space.

arch

  • Optional. Module architecture. If lost, this will be backfilled by Sentry.

Example:

{
  "type": "macho"."debug_id": "84a04d24-0e60-3810-a8c0-90a65e2df61a"."debug_file": "libDiagnosticMessagesClient.dylib"."code_file": "/usr/lib/libDiagnosticMessagesClient.dylib"."image_addr": "0x7fffe668e000"."image_size": 8192."image_vmaddr": "0x40000"."arch": "x86_64"
}
Copy the code

The ELF mirror

ELF images are used on Linux platforms. Their structure is the same as other native images.

Properties:

type

  • Required. Debug the image type. It must be"elf".

image_addr

  • RequiredMemory address, the location in the virtual address space of the process where the image is installed. Should be based on"0x"The hexadecimal representation of the prefix is a string.

image_size

  • Required. The size of the image in virtual memory. If lost,SentryThe mirror will be assumed to span to the next mirror, which may result in an invalid stack trace.

debug_id

  • Required. Debug identifier for a dynamic library or executable. If a code identifier is available, the debug identifier is preceded by that identifier16Bytes ofLittle-endian UUIDSaid. Insert Spaces for readability, note the byte order of the first field:
code id:  f1c3bcc0 2798 65fe 3058 404b2831d9e6 4135386c
debug id: c0bcc3f1-9827-fe65-3058-404b2831d9e6
Copy the code

If no code ID is available, the debug ID should be computed by XORing the first 4096 bytes of the.text part of the 16-byte block and representing it as little-endian UUID (again swapping byte order).

debug_file

  • Optional. Of the file that contains the stripping debugging information for this imageThe name of theorAn absolute path. In somesymbolThe server may need this value to retrieve debug files.

code_id

  • Optional. Identifier of a dynamic library or executable. If the program was compiled with a relatively new compiler,

This should be the hexadecimal representation of the NT_GNU_BUILD_ID program header (type PT_NOTE), or the value of the.note.gnu. Build-id comment section (type SHT_NOTE). Otherwise, leave this value blank.

Some Symbol servers use code identifiers to locate debugging information for ELF images, in which case this field should be included if possible.

code_file

  • Optional. The absolute path to a dynamic library or executable. If the file is inSentryThis helps locate the file.

image_vmaddr

  • Optional. The preferred loading address of the image in virtual memory, as declared in the image header. When loading the image, the operating system may still choose to place it at a different address.

If this value is non-zero, all symbols and addresses declared in the native image start at this address, not 0. In contrast, Sentry handles the address relative to the start of the mirror. For example, for image_VMADDR: 0x40000, the relative address of the symbol at 0x401000 is 0x1000.

The relative addresses used in adDR2line are usually in the preferred address space, not the relative address space.

arch

  • Optional. Module architecture. If lost, this will be backfilled by Sentry.

Example:

{
  "type": "elf"."code_id": "68220ae2c65d65c1b6aaa12fa6765a6ec2f5f434"."code_file": "/lib/x86_64-linux-gnu/libgcc_s.so.1"."debug_id": "e20a2268-5dc6-c165-b6aa-a12fa6765a6e"."image_addr": "0x7f5140527000"."image_size": 90112."image_vmaddr": "0x40000"."arch": "x86_64"
}
Copy the code

PE mirror (PDBs)

The PE image is used for The Windows platform and is attached with a PDB file for debugging. Their structure is the same as other native images.

type

  • Required. Debug the image type. It must be"pe".

image_addr

  • RequiredMemory address, the location in the virtual address space of the process where the image is installed. Should be based on"0x"The hexadecimal representation of the prefix is a string.

image_size

  • Required. The actual size of the image in virtual memory. If lost,SentryThe mirror will be assumed to span to the next mirror, which may result in an invalid stack trace.

debug_id

  • Required. PDBOf the filesignatureage. Both of these values can be taken fromPEIn theCodeView PDB70Read from the debug message header.

This value should be represented as little-endian UUID with age appended to the end. Note that the byte order of the UUID field must be swapped (Spaces inserted for readability) :

signature: f1c3bcc0 2798 65fe 3058 404b2831d9e6
age:                                            1
debug_id:  c0bcc3f1-9827-fe65-3058-404b2831d9e6-1
Copy the code

debug_file

  • Required. Contains debugging information about this imagePDBName of the file. From a specificsymbolThis value is typically required by the server to retrieve debug files.

code_id

  • Optional.executable file orDLLIdentifier of. It contains information fromCOFFThe head of thetime_date_stampAnd from the optional headsize_of_imageThe values of these values are used%08x%XFormatted as a hexadecimal string together (note that the second value is not populated) :
time_date_stamp: 0x5ab38077
size_of_image:           0x9000
code_id:           5ab380779000
Copy the code

Code identifiers should be provided to allow server-side stack traversal of binary crash reports, such as Minidumps.

code_file

  • Optional. DLLOr the absolute path to the executable. If the file is inSentryThis helps locate the file. Code files should be provided to allow server-side stack traversal of binary crash reporting, for exampleMinidumps.

image_vmaddr

  • Optional. The preferred loading address of the image in virtual memory, as declared in the image header. When loading the image, the operating system may still choose to place it at a different address.

Symbols and addresses in the native image are always relative to the beginning of the image, regardless of the preferred loading address. This is just a hint to the loader.

arch

  • Optional. Module architecture. If lost, this will be backfilled by Sentry.

Example:

{
  "type": "pe"."code_id": "57898e12145000"."code_file": "C:\\Windows\\System32\\dbghelp.dll"."debug_id": "9c2a902b-6fdf-40ad-8308-588a41d572a0-1"."debug_file": "dbghelp.pdb"."image_addr": "0x70850000"."image_size": "1331200"."image_vmaddr": "0x40000"."arch": "x86"
}
Copy the code

WASM mirror

WASM images are used for WebAssembly. Their structure is the same as other native images.

Properties:

type

  • Required. Debug the image type. It must be"wasm".

debug_id

  • Required. Identifier of a dynamic library or executable. It is abuild_idThe value of the custom part must be formatted to truncate to the lead16Bytes ofUUID.

debug_file

  • Optional. Contains debugging information about this imageWASMOf the fileThe name of theorAbsolute URL.

This value may be required to retrieve debug files from some SYMBOL servers. This should correspond to the externalized URL extracted from the external_debug_info custom section.

code_id

  • Optional. WASMThe file identifier. It is formatted asHEXA string ofbuild_idThe value of the custom section. If the section containsUUID(16Byte), it can be omitted.

code_file

  • Required. wasmAbsolute of documentURL. If the file is inSentryThis helps locate the file.

Example:

{
  "type": "wasm"."debug_id": "84a04d24-0e60-3810-a8c0-90a65e2df61a"."debug_file": "sample.wasm"
}
Copy the code

Proguard mirror

The Proguard image is a mapping.txt file generated when Proguard confuses function names. The Java SDK integration assigns a unique identifier to this file, which must be included in the list of images.

uuid

  • Required. Unique identifier assigned by the Java SDK.

Example:

{
  "uuid": "395835f4-03e0-4436-80d3-136f0749a893"
}
Copy the code

The sample

See the example of debugging mirror types above.

{
  "debug_meta": {
    "images": []."sdk_info": {
      "sdk_name": "iOS"."version_major": 10."version_minor": 3."version_patchlevel": 0}}}Copy the code

Exception Interface

The exception interface specifies exceptions or errors that occur in a program.

An event may contain one or more exceptions in a property named Exception.

The Exception attribute should be an object whose attribute Values contains a list of one or more values that are objects in the format described below.

Multiple values represent chained exceptions and should be sorted from oldest to latest. For example, consider this Python snippet:

try:
    raise Exception
except Exception as e:
    raise ValueError from e
Copy the code

Exception will be described first in the Values List, followed by the description of ValueError.

attribute

type

  • The type of exception, for exampleValueError.

value

  • Exception value (string).

module

  • Optional module or package in which the exception type resides.

thread_id

  • An optional value that refers to a thread in the thread interface.

mechanism

  • Optional object that describes the mechanism for creating this exception.

stacktrace

  • An optional stack trace object corresponding to the stack trace interface.

Exception Mechanism

The exception mechanism is an optional field that resides in the exception interface. It carries additional information about how exceptions are created on the target system. This includes general outliers from the operating system or runtime apis, as well as mechanism-specific values.

attribute

type

  • The Required themechanismThe unique identifier of themechanismPresentation and processing of data.

description

  • Optional Error mechanismA human-readable description of the error and possible hints on how to resolve it.

help_link

  • Optional online help resources are fully limitedURL, may be insertederrorParameters.

handled

  • Optional indicates whether the user has handled the exception flag (for example, passedtry ... catch).

synthetic

  • Optional indicating thiserrorIt’s a sign of compositing error. Compositing errors are errors that have no meaning in themselves.

This is probably because they are created in a central location (such as crash Handler) and are all called the same: Error, Segfault, etc. When flag is set, Sentry tries to use other information (the Top-In-App Frame Function) than the exception types and values in the UI displayed by the main event. For example, this flag should be set for all “Segfaults”, otherwise each error group will look very similar.

meta

  • Optional comes from the operating system or runtime aboutexception mechanismThe information.

data

  • Any additional data that may help the user understand the error raised by this mechanism.

Sending any exception mechanism attribute requires the Type attribute, even if the SDK cannot determine the exact mechanism.

In this case, set Type to generic. See the example below.

Meta Information

Mechanism metadata typically carries error codes reported by the runtime or operating system, along with platform-specific explanations of these codes. The SDK can safely omit the code names and descriptions of well-known Error code because they will be filled in by Sentry. For proprietary or vendor-specific Error codes, adding these values will provide additional information to the user.

Meta Key may contain one or more of the following attributes:

signal

Information about POSIX Signal. On Apple systems, signals carry code in addition to a more detailed description of a signal’s signal number. On Linux, this code does not exist.

number

  • POSIX Signal number.

code

  • Optional Apple Signal code.

name

  • Optional based onsignalNumber ofsignalThe name.

code_name

  • Optional signal codeThe name of the.
mach_exception

Mach exceptions on Apple systems, including code triple and optional descriptions.

exception

  • Required Indicates the number of an exception.

code

  • Required numeric exception code.

subcode

  • Required numeric exception subroutine.

name

  • Optional iOS / macOSThe name of the exception constant in.
ns_error

NSError on Apple systems, consisting of domain and code.

code

  • Required numeric error code.

domain

  • Required NSErrordomainAs a string.
errno

Error codes set by Linux system calls and some library functions specified in ISO C99, POSIX.1-2001, and POSIX.1-2008. For more information, see errno(3).

  • Man7.org/linux/man-p…

number

  • Wrong number

name

  • Optional error name

The sample

The following example illustrates the various ways in which exceptions can be sent. Each example contains the exception portion of the Event Payload, with other attributes omitted for simplicity.

Single exception:

{
  "exception": {
    "values": [{"type": "ValueError"."value": "my exception value"."module": "__builtins__"."stacktrace": {}}]}}Copy the code

Chain exception:

{
  "exception": {
    "values": [{"type": "Exception"."value": "initial exception"."module": "__builtins__"
      },
      {
        "type": "ValueError"."value": "chained exception"."module": "__builtins__"}}}]Copy the code

IOS Native Mach exceptions and mechanisms:

{
  "exception": {
    "values": [{"type": "EXC_BAD_ACCESS"."value": "Attempted to dereference a null pointer"."mechanism": {
          "type": "mach"."handled": false."data": {
            "relevant_address": "0x1"
          },
          "meta": {
            "signal": {
              "number": 10."code": 0."name": "SIGBUS"."code_name": "BUS_NOOP"
            },
            "mach_exception": {
              "code": 0."subcode": 8."exception": 1."name": "EXC_BAD_ACCESS"}}}}]}}Copy the code

JavaScript unprocessed Promise Rejection:

{
  "exception": {
    "values": [{"type": "TypeError"."value": "Object [object Object] has no method 'foo'"."mechanism": {
          "type": "promise"."description": "This error originated either by throwing inside of an ..."."handled": false."data": {
            "polyfill": "bluebird"}}}]}}Copy the code

General unhandled crashes:

{
  "exception": {
    "values": [{"type": "Error"."value": "An error occurred"."mechanism": {
          "type": "generic"."handled": false}}]}}Copy the code

Message Interface

The message interface carries log messages describing events or errors. Optionally, it can carry format strings and structured parameters. This helps to group similar messages into the same problem.

attribute

formatted

  • Required. Fully formatted message. If lost, Sentry will attempt to insert the message.

    It must not exceed 8192 characters. Longer messages will be truncated. Sentry also accepts messages that are not set to support older SDKS.

message

  • Optional. Original message string (uninserted).

    It must not exceed 8192 characters. Longer messages will be truncated.

params

  • OptionalFormat the argument list, preferably a string. Non-strings are forced to be strings.

The sample

{
  "message": {
    "message": "My raw message with interpreted strings like %s"."params": ["this"]}}Copy the code

Request Interface

The request interface contains information about event-related HTTP requests. In the client SDK, this can be an outgoing request or a request to render the current web page. On the Server SDK, this could be an incoming Web request being processed.

The data variable should contain only the request body (not the Query String). It can be a dictionary (for standard HTTP requests) or the original request body.

Orderly Map

In the request interface, several properties can be declared as strings, objects, or lists of tuples. In this case, Sentry tries to parse structured information from a string representation.

Sometimes the key can be declared more than once, or the order of the elements is important. In this case, use a tuple representation on a normal object.

An example of a request header as an object:

{
  "content-type": "application/json"."accept": "application/json, application/xml"
}
Copy the code

Examples of headers that are identical to a tuple list:

[["content-type"."application/json"],
  ["accept"."application/json"],
  ["accept"."application/xml"]]Copy the code

attribute

method

  • Optional. HTTP method of the request.

url

  • OptionalOf the requestURL(if available). The query string can be used asurlPart of the statement is also available inquery_stringIs declared separately in.

query_string

  • The query string component of Optional. URL. Can be given as an unparsed string, dictionary, or tuple list.

    If the query string is undeclared and is part of the URL parameter, Sentry moves it to the query string.

data

  • Optional. Submit data in the most meaningful format. By default, the SDK should discard large bodies. Can be given as string or structured data in any format.

    Always trim and truncate the request data before attaching it to the event. If this is not possible, add a note in the API documentation that the user should truncate the request data. Although Sentry will try to trim this field when ingested, a large body may cause the entire event payload to exceed its maximum size limit, in which case the event will be discarded.

cookies

  • Optional. The value of cookie. An unparsed string can be given as a list of strings, dictionaries, or tuples.

headers

  • OptionalThe submittedheaderIn the dictionary. If aheaderIf multiple occurrences occur, perform the following operationsHTTP headerMerge criteria for merging.SentryCase insensitive processingHeaderThe name.

env

  • Optional. Dictionary containing environment information passed from the server. This is where non-HTTP header information such as CGI/WSGI/Rack key is located.

    Sentry will explicitly look for REMOTE_ADDR to extract the IP address.

The sample

A fully populated request interface:

{
  "request": {
    "method": "POST"."url": "http://absolute.uri/foo"."query_string": "query=foobar&page=2"."data": {
      "foo": "bar"
    },
    "cookies": "PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1;"."headers": {
      "content-type": "text/html"
    },
    "env": {
      "REMOTE_ADDR": "192.168.0.1"}}}Copy the code

SDK Interface

The SDK interface describes the Sentry SDK and its configuration for capturing and transferring events.

attribute

name

  • The name of Required. SDK. The format is entity.ecosystem[. Flavor] Entity identifies the DEVELOPER of the SDK. Ecosystem refers to the programming language or platform that uses the SDK.

    The official Sentry SDK uses entity Sentry. Example:

    • sentry.python
    • sentry.javascript.react-native

version

  • Required. SDK version. It should haveSemantic VersioningformatMAJOR.MINOR.PATCH, without any prefix (not before the major version numbervOr any other content). Example:
    • 0.1.0 from
    • 1.0.0
    • 4.3.12

integrations

  • Optional. Identifies the list of names for enabled integrations. This list should contain all enabled integrations, including the default integrations.

The default integration is included because different SDK versions may contain different default integrations.

packages

  • OptionalList of packages installed as part of this SDK or active integration. Each package contains the formatsource:identifierversionname. If the source isGitRepository, the source should begit.identifierIt should becheckoutLinks,versionIt should beGit reference(branch,tagSHA).

The sample

The following example illustrates the SDK portion of event Payload and omits the other attributes for simplicity.

{
  "sdk": {
    "name": "sentry.javascript.react-native"."version": "1.0.0"."integrations": [
      "redux"]."packages": [{"name": "npm:@sentry/react-native"."version": "0.39.0"
      },
      {
        "name": "git:https://github.com/getsentry/sentry-cocoa.git"."version": "4.1.0."}}}]Copy the code

Stack Trace Interface

The stack trace contains a list of frames, each with various bits (mostly optional) describing the context of that frame. Frames should be sorted from oldest to latest.

The stack trace is always part of an exception or thread. They cannot be declared as top-level event attributes. Follow these rules of thumb when adding stack traces to events:

  • If the stack trace isError (error),Abnormal (exception)orCrash (crash)Please add it to the exception interface.
  • Otherwise, add it as a thread in the thread interface.

attribute

frames

A non-empty list of stack frames Required (see below). The list runs from caller to callee, or from oldest to youngest. The last frame is the one that creates the exception.

registers

: Optional. Mapping of register names and their values. These values should contain the actual register values of the thread, thus mapping to the last frame in the list.

The frame properties

Each object should have at least one filename, function, or instruction_ADDR property. All values are optional, but recommended.

filename

: The path of the source file relative to the project root directory.

This value should not make file names indistinguishable and should only change between versions of the actual renamed file.

In some SDKS, this is implemented as a path relative to some entry point related to the language/platform. For example, in Python, filename is related to PYTHONPATH or site-packages.

function

: Specifies the name of the function being called.

This function name may be shortened or cancelled. If not, Sentry will decompose and shorten it. The original function name will be stored in raw_function.

raw_function

: The original function name, if the function name is shortened or corrupted. When you click the shortened function in the UI, Sentry displays the original function.

module

Path: the platform-specific module (such as sentry. Interfaces. Stacktrace).

lineno

: The line number of the call, starting with 1

colno

: Column number of the call, starting from 1.

abs_path

: Indicates the absolute path of the source file.

context_line

Source code in lineno file name.

pre_context

: context_line The list of source lines before it (in order) – usually [lineno-5 :lineno].

post_context

The list of source lines after: context_line (in order) – usually [lineno + 1:lineno + 5].

in_app

: indicates whether this frame is associated with the execution of the relevant code in this stack trace. For example, this frame may not be relevant to the Web server of the frame powering your app. However, once you start working with the code, the calls to the framework library may be relevant.

stack_start

: marks this frame as the bottom of the chain stack trace. A stack trace from asynchronous code consists of several child traces that are linked together into a large list. This flag indicates the root function of the chained stack trace. Depending on the runtime and thread, this can be either the main function or the thread base stub. This field should only be specified when true.

vars

: Mapping of variables (usually context local variables) available within this frame.

The following attributes are mainly used for C-based languages:

instruction_addr

: Address of the optional instruction used for symbolization. This should be a string with a hexadecimal number prefixed with 0x. If this is set and a known image is defined in the debug meta-interface, it can be symbolized. Note that the addr_mode property controls the behavior of this address.

addr_mode

: Optionally change the addressing mode. The default value is the same as “abs” for absolute reference. This can also be set to “rel:DEBUG_ID” or “rel:IMAGE_INDEX” to make the address relevant to the object referenced by the DEBUG ID or index. This is necessary for WASM processing, for example, because WASM does not use a uniform address space.

symbol_addr

: points to the optional address of symbol. We use instruction addresses for symbolization, but this can be used to calculate instruction offsets automatically. Note that the addr_mode property controls the behavior of this address.

image_addr

: (Optional) Address of the debug mirror to be referenced.

package

: contains the framework’s “package”. Depending on the platform, this could be something different. For C#, it can be the name of an assembly. For native code, this can be the path to a dynamic library, etc.

platform

This can override the platform of a single frame. Otherwise, the platform of the event is assumed. This can be used for multi-platform stack tracing, for example in React Native.

The sample

For a given sample program written in Python:

def foo() :
  my_var = 'foo'
  raise ValueError()

def main() :
  foo()
Copy the code

Do the minimum stack trace for the above programs in the correct order:

{
  "frames": [{ "function": "main" }, { "function": "foo"}}]Copy the code

The top frame is completely filled with five lines of source context:

{
  "frames": [{"in_app": true."function": "myfunction"."abs_path": "/real/file/name.py"."filename": "file/name.py"."lineno": 3."vars": {
        "my_var": "'value'"
      },
      "pre_context": ["def foo():"." my_var = 'foo'"]."context_line": " raise ValueError()"."post_context": [""."def main():"]]}}Copy the code

Minimum native stack trace with register values. Note that the package event attribute must be “native” for these frames to be symbolized.

{
  "frames": [{"instruction_addr": "0x7fff5bf3456c" },
    { "instruction_addr": "0x7fff5bf346c0"}]."registers": {
    "rip": "0x00007ff6eef54be2"."rsp": "0x0000003b710cd9e0"}}Copy the code

Template Interface

The template interface is useful for template-engine-specific reporting when regular stack traces do not contain template data. For example, this is required in the Django framework, where templates are not integrated into the Python stack trace.

Render the template. This is typically used as a single frame in a stack trace, and should only be used if the templating system does not provide an appropriate stack trace.

attribute

The attributes filename, context_line, and lineno are required.

lineno

  • The line number of the call.

abs_path

  • The absolute path of the template on the file system.

filename

  • The file name passed to the template loader.

context_line

  • Source code in lineno file name.

pre_context

  • context_linePrevious source code row list (in order) – usually[lineno - 5:lineno].

post_context

  • context_lineSubsequent source code row list (in order) – usually[lineno + 1:lineno + 5].

The sample

{
  "template": {
    "abs_path": "/real/file/name.html"."filename": "file/name.html"."lineno": 3."pre_context": [
      "line1"."line2"]."context_line": "line3"."post_context": [
      "line4"."line5"].}}Copy the code

Threads Interface

The thread interface specifies the thread that is running at the time of the event. These threads can also contain stack traces.

An Event may contain one or more threads in a property called Threads.

The Threads attribute should be an object with the values attribute that contains one or more values, which are objects in the following format.

According to the Sentry policy, a thread that crashes due to exception should not have a stack trace. Instead, the thread_ID attribute should be set on Exception, and Sentry will connect the two.

attribute

id

  • RequiredID of the thread. Usually numbers or numeric strings. Needs to be unique in the thread.exceptionYou can set thethread_idProperty to cross-reference this thread.

crashed

  • Optional. Flag indicating whether a thread has crashed. The default isfalse.

current

  • Optional. Flag indicating whether a thread is in the foreground. The default isfalse.

name

  • Optional. Thread name.

stacktrace

  • Optional. Stack trace object corresponding to the stack trace interface.

If this is an error event, the stack trace for the main exception should be declared in the exception interface. If there is a single exception, Sentry automatically moves the stack trace of the only crashed thread.

The sample

The following example illustrates the threaded portion of the Event Payload, omitting the other attributes for simplicity.

{
  "threads": {
    "values": [{"id": "0"."name": "main"."crashed": true."stacktrace": {}}]}}Copy the code

User Interface

The interface that describes the authenticated user requesting it.

For example, you should provide Sentry with at least one of ID, email, IP_address, username to be able to tell you how many users are affected by a problem. Sending users with only custom attributes without these attributes is efficient, but not as useful.

attribute

id

  • The user’s application-specific internal identifier.

username

  • The user name. Usually used as compared to the interioridBetter labels.

email

  • An alternative or supplement to the user name.SentryKnow the email address, can display such asGravatarsAnd unlock the messaging function.

ip_address

  • The user’sIPAddress. If the user is not authenticated,SentryuseIPAddress as the unique identifier of the user. Set to"{{auto}}"To makeSentryInfer from the joinIPAddress.

All other keys are stored as extra information, but are not handled specifically by Sentry.

Automatic IP address

SDKS running on client platforms, such as browsers and mobile applications, should default to ip_address = “{{auto}}”. Instead, the server-side SDK should populate the request interface. Sentry backfills the IP address using several types of fallback:

  1. If directly set, useuser.ip_address.
  2. If available, go back tohttp.env.REMOTE_ADDR.
  3. SentrySee the connectionIPAddress, if used{{auto}}.

The sample

{
  "user": {
    "id": "unique_id"."username": "my_user"."email": "[email protected]"."ip_address": "127.0.0.1"."subscription": "basic"}}Copy the code