View Source Sentry.CheckIn (Sentry v10.5.0)

This module represents the struct for a "check-in".

Check-ins are used to report the status of a monitor to Sentry. This is used to track the health and progress of cron jobs. This module is somewhat low level, and mostly useful when you want to report the status of a cron but you are not using any common library to manage your cron jobs.

Using capture_check_in/1

Instead of using this module directly, you'll probably want to use Sentry.capture_check_in/1 to manually report the status of your cron jobs.

See https://develop.sentry.dev/sdk/check-ins/. This struct is available since v10.2.0.

Link to this section Summary

Types

The possible values for the :schedule option under :monitor_config.

The possible status of the check-in.

t()

The type for the check-in struct.

Functions

Creates a new check-in struct with the given options.

Link to this section Types

Link to this type

monitor_config_schedule()

View Source (since 10.2.0)
@type monitor_config_schedule() ::
  %{type: :crontab, value: String.t()}
  | %{
      type: :interval,
      value: number(),
      unit: :year | :month | :week | :day | :hour | :minute
    }

The possible values for the :schedule option under :monitor_config.

If the :type is :crontab, then the :value must be a string representing a crontab expression. If the :type is :interval, then the :value must be a number representing the interval and the :unit must be present and be one of :year, :month, :week, :day, :hour, or :minute.

Link to this type

status()

View Source (since 10.2.0)
@type status() :: :in_progress | :ok | :error

The possible status of the check-in.

@type t() :: %Sentry.CheckIn{
  check_in_id: String.t(),
  contexts: Sentry.Interfaces.context(),
  duration: float() | nil,
  environment: String.t() | nil,
  monitor_config:
    nil
    | %{
        :schedule => monitor_config_schedule(),
        optional(:checkin_margin) => number(),
        optional(:max_runtime) => number(),
        optional(:failure_issue_threshold) => number(),
        optional(:recovery_threshold) => number(),
        optional(:timezone) => String.t()
      },
  monitor_slug: String.t(),
  release: String.t() | nil,
  status: status()
}

The type for the check-in struct.

Link to this section Functions

Link to this function

new(opts)

View Source (since 10.2.0)
@spec new(keyword()) :: t()

Creates a new check-in struct with the given options.

options

Options

The options you can pass match a subset of the fields of the t/0 struct. You can pass:

examples

Examples

iex> check_in = CheckIn.new(status: :ok, monitor_slug: "my-slug")
iex> check_in.status
:ok
iex> check_in.monitor_slug
"my-slug"