sentry_capture

Captures log events from messages and submits them to Sentry.

Introduced in version 4.16.0.

# Config fields, showing default values
label: ""
sentry_capture:
  dsn: ""
  message: webhook event received # No default (required)
  context: 'root = {"order": {"product_id": "P93174", "quantity": 5}}' # No default (optional)
  tags: {} # No default (optional)
  environment: ""
  release: ""
  level: INFO
  transport_mode: async
  flush_timeout: 5s
  sampling_rate: 1

Fields

context

A mapping that must evaluate to an object-of-objects or deleted(). If this mapping produces a value, then it is set on a sentry event as additional context.

Type: string

# Examples:
context: root = {"order": {"product_id": "P93174", "quantity": 5}}
context: root = deleted()

dsn

The DSN address to send sentry events to. If left empty, then SENTRY_DSN is used.

Type: string

Default: ""

environment

The environment to be sent with events. If left empty, then SENTRY_ENVIRONMENT is used.

Type: string

Default: ""

extras

A mapping that must evaluate to an object. If this mapping produces a value, then it is set on a sentry event as extras.

Type: string

# Examples:
extras: root.foo = "bar"
extras: root = this.without("password")

flush_timeout

The duration to wait when closing the processor to flush any remaining enqueued events.

Type: string

Default: 5s

level

Sets the level on sentry events similar to logging levels.

Type: string

Default: INFO

Options: DEBUG, INFO, WARN, ERROR, FATAL

message

A message to set on the sentry event This field supports interpolation functions.

Type: string

# Examples:
message: webhook event received
message: failed to find product in database: ${! error() }

release

The version of the code deployed to an environment. If left empty, then the Sentry client will attempt to detect the release from the environment.

Type: string

Default: ""

sampling_rate

The rate at which events are sent to the server. A value of 0 disables capturing sentry events entirely. A value of 1 results in sending all events to Sentry. Any value in between results sending some percentage of events.

Type: float

Default: 1

tags

Sets key/value string tags on an event. Unlike context, these are indexed and searchable on Sentry but have length limitations. This field supports interpolation functions.

Type: string

transport_mode

Determines how events are sent. A sync transport will block when sending each event until a response is received from the Sentry server. The recommended async transport will enqueue events in a buffer and send them in the background.

Type: string

Default: async

Options: async, sync