View Source Sentry.Telemetry.Category (Sentry v12.0.3)
Defines telemetry categories for the Sentry SDK with their priorities and default configurations.
The TelemetryProcessor uses categories to classify different types of telemetry data and prioritize their sending based on a weighted round-robin scheduler.
Categories
:error- Error events (critical priority):check_in- Cron check-ins (high priority):transaction- Performance transactions (medium priority):log- Log entries (low priority)
Priorities and Weights
:critical- weight 5 (errors):high- weight 4 (check-ins):medium- weight 3 (transactions):low- weight 2 (logs)
Summary
Types
Buffer configuration for a category.
Priority levels for categories.
Telemetry category types.
Functions
Returns all telemetry categories.
Returns the Sentry data category string for a given telemetry category.
Returns the default buffer configuration for a given category.
Returns all priority levels in descending order (highest to lowest).
Returns the priority level for a given category.
Returns the weight for a given priority level.
Types
@type config() :: %{ capacity: pos_integer(), batch_size: pos_integer(), timeout: pos_integer() | nil }
Buffer configuration for a category.
@type priority() :: :critical | :high | :medium | :low
Priority levels for categories.
@type t() :: :error | :check_in | :transaction | :log
Telemetry category types.
Functions
@spec all() :: [t()]
Returns all telemetry categories.
Examples
iex> Sentry.Telemetry.Category.all()
[:error, :check_in, :transaction, :log]
Returns the Sentry data category string for a given telemetry category.
These strings are used in client reports and rate limiting.
Examples
iex> Sentry.Telemetry.Category.data_category(:error)
"error"
iex> Sentry.Telemetry.Category.data_category(:check_in)
"monitor"
iex> Sentry.Telemetry.Category.data_category(:log)
"log_item"
Returns the default buffer configuration for a given category.
Configuration keys
:capacity- Maximum items the buffer can hold:batch_size- Number of items to send per batch:timeout- Flush timeout in milliseconds (nil for immediate)
Examples
iex> Sentry.Telemetry.Category.default_config(:error)
%{capacity: 100, batch_size: 1, timeout: nil}
iex> Sentry.Telemetry.Category.default_config(:check_in)
%{capacity: 100, batch_size: 1, timeout: nil}
iex> Sentry.Telemetry.Category.default_config(:transaction)
%{capacity: 1000, batch_size: 1, timeout: nil}
iex> Sentry.Telemetry.Category.default_config(:log)
%{capacity: 1000, batch_size: 100, timeout: 5000}
@spec priorities() :: [priority()]
Returns all priority levels in descending order (highest to lowest).
Examples
iex> Sentry.Telemetry.Category.priorities()
[:critical, :high, :medium, :low]
Returns the priority level for a given category.
Examples
iex> Sentry.Telemetry.Category.priority(:error)
:critical
iex> Sentry.Telemetry.Category.priority(:check_in)
:high
iex> Sentry.Telemetry.Category.priority(:transaction)
:medium
iex> Sentry.Telemetry.Category.priority(:log)
:low
@spec weight(priority()) :: pos_integer()
Returns the weight for a given priority level.
Weights determine how many slots each priority gets in the round-robin cycle.
Examples
iex> Sentry.Telemetry.Category.weight(:high)
4
iex> Sentry.Telemetry.Category.weight(:medium)
3
iex> Sentry.Telemetry.Category.weight(:low)
2