VOOZH about

URL: https://deepwiki.com/hypervel/sentry/1.2-configuration

⇱ Configuration | hypervel/sentry | DeepWiki


Loading...
Menu

Configuration

Purpose and Scope

This document explains the configuration system for the hypervel/sentry package. It details all available configuration options in config/sentry.php and describes how the Switcher class provides runtime control over Sentry features, breadcrumbs, and tracing behavior.

For information about how features use these configuration settings, see Feature System Overview. For information about the service provider that initializes the configuration, see Service Provider.


Configuration File Structure

The package's configuration is defined in config/sentry.php1-135 This file serves two purposes: configuring the underlying Sentry PHP SDK and controlling package-specific features like breadcrumb capture and performance tracing.

Configuration File Organization


Sources: config/sentry.php1-135


Core SDK Settings

These settings configure the underlying Sentry PHP SDK and are passed directly to the SDK's Options object after specific keys are removed (see Hub and Factories for details on configuration merging).

Basic Configuration

Configuration KeyEnvironment VariableTypeDefaultDescription
dsnSENTRY_DSNstring''Sentry Data Source Name - the endpoint for sending events
releaseSENTRY_RELEASEstringnullRelease version identifier (e.g., git commit hash)
environmentAPP_ENVstring'production'Application environment name
default_integrationsSENTRY_DEFAULT_INTEGRATIONSboolfalseWhether to enable Sentry SDK's default integrations
send_default_piiSENTRY_SEND_DEFAULT_PIIboolfalseWhether to send personally identifiable information

Sources: config/sentry.php20-30 config/sentry.php54-55 config/sentry.php22-23

Sampling Configuration

Sampling controls what percentage of events and traces are sent to Sentry, allowing cost and performance optimization.

Configuration KeyEnvironment VariableTypeDefaultDescription
sample_rateSENTRY_SAMPLE_RATEfloat1.0Error event sampling rate (0.0-1.0)
traces_sample_rateSENTRY_TRACES_SAMPLE_RATEfloat1.0Transaction/trace sampling rate (0.0-1.0)
profiles_sample_rateSENTRY_PROFILES_SAMPLE_RATEfloatnullProfiling sampling rate (0.0-1.0)

Configuration Flow Diagram


Sources: config/sentry.php32-49

Logging Configuration

Configuration KeyEnvironment VariableTypeDefaultDescription
enable_logsSENTRY_ENABLE_LOGSboolfalseEnable log aggregation feature (requires Sentry plan support)

Sources: config/sentry.php51-52


Feature Control System

The enable configuration section provides high-level toggles for package features. Currently, only coroutine context propagation is configurable here.

Enable Configuration Structure





















Configuration KeyEnvironment VariableTypeDefaultDescription
enable.coroutineSENTRY_ENABLE_COROUTINEbooltrueEnable Sentry context propagation in coroutines

Sources: config/sentry.php57-59


Breadcrumb Configuration

Breadcrumbs are lightweight event logs that provide context for errors. The breadcrumbs configuration section controls which framework operations generate breadcrumbs.

Breadcrumb Configuration Mapping

Configuration KeyEnvironment VariableDefaultCaptured Operations
breadcrumbs.cacheSENTRY_BREADCRUMBS_CACHEtrueCache hits, misses, writes, deletes
breadcrumbs.sql_queriesSENTRY_BREADCRUMBS_SQL_QUERIEStrueSQL query execution
breadcrumbs.sql_bindingsSENTRY_BREADCRUMBS_SQL_BINDINGStrueSQL query parameter values
breadcrumbs.sql_transactionSENTRY_BREADCRUMBS_SQL_TRANSACTIONtrueTransaction begin, commit, rollback
breadcrumbs.queue_infoSENTRY_BREADCRUMBS_QUEUE_INFO_ENABLEDtrueQueue job dispatch and processing
breadcrumbs.notificationsSENTRY_BREADCRUMBS_NOTIFICATIONS_ENABLEDtrueNotification sending events
breadcrumbs.guzzleSENTRY_BREADCRUMBS_GUZZLEtrueGuzzle HTTP client requests

Sources: config/sentry.php61-76

Breadcrumb Flow Through Switcher


Sources: config/sentry.php61-76 src/Switcher.php20-23


Tracing Configuration

The tracing configuration section controls performance monitoring. Tracing captures operation duration as spans, allowing performance analysis in Sentry.

Global Tracing Toggle

Configuration KeyEnvironment VariableTypeDefaultDescription
enable_tracingSENTRY_ENABLE_TRACINGbooltrueMaster switch for all performance tracing

Per-Feature Tracing Configuration

Configuration KeyEnvironment VariableDefaultTraced Operations
tracing.queue_jobsSENTRY_TRACE_QUEUE_JOBS_ENABLEDtrueQueue jobs on sync driver
tracing.queue_job_transactionsSENTRY_TRACE_QUEUE_ENABLEDtrueQueue jobs as root transactions
tracing.cacheSENTRY_TRACE_CACHE_ENABLEDtrueCache operations (get, set, etc.)
tracing.notificationsSENTRY_TRACE_NOTIFICATIONS_ENABLEDtrueNotification sending
tracing.redis_commandsSENTRY_TRACE_REDIS_COMMANDStrueRedis command execution
tracing.redis_originSENTRY_TRACE_REDIS_ORIGIN_ENABLEDtrueSource code origin for Redis commands

Sources: config/sentry.php36 config/sentry.php111-124

Tracing Decision Logic


Sources: src/Switcher.php25-32


Integration and Feature Lists

The configuration defines which Sentry SDK integrations and package features are registered during service provider initialization.

Integrations Array

The integrations array lists Sentry SDK integration classes that enrich events with contextual information.



























Integration ClassPurpose
RequestIntegrationEnriches events with HTTP request data when PII sending is enabled
TransactionIntegrationManages transaction state in the SDK
FrameContextifierIntegrationAdds source code context to stack frames
EnvironmentIntegrationCaptures environment variables

For more details on RequestIntegration, see Request Integration.

Sources: config/sentry.php78-83

Features Array

The features array lists package feature classes that provide framework-specific monitoring capabilities.










































Feature ClassPurposeDocumentation
CacheFeatureCache operation monitoringCache Monitoring
QueueFeatureQueue job tracing and breadcrumbsQueue Monitoring
NotificationsFeatureNotification sending monitoringMonitoring Features
LogFeatureLog channel integrationLog Feature and Channels
ConsoleSchedulingFeatureScheduled task monitoringConsole Scheduling
DbQueryFeatureSQL query and Redis command tracingRedis Monitoring

Sources: config/sentry.php85-92

Feature Registration Flow


Sources: config/sentry.php85-92


Ignore Lists

Ignore lists allow filtering out specific exceptions, transactions, or commands from being reported to Sentry.

Ignore Exceptions

The ignore_exceptions array lists exception classes that should not be captured.


Sources: config/sentry.php94-96

Ignore Transactions

The ignore_transactions array lists transaction name patterns that should not be captured. This is useful for excluding health check endpoints or internal routes.

Sources: config/sentry.php98-99

Ignore Commands

The ignore_commands array lists console command patterns that should not create transactions. Wildcard patterns (*) are supported.


Sources: config/sentry.php101-108


HTTP and Transport Configuration

These settings control how the package communicates with the Sentry API.

HTTP Timeout

Configuration KeyEnvironment VariableTypeDefaultDescription
http_timeoutSENTRY_HTTP_TIMEOUTfloat2.0HTTP request timeout in seconds

Sources: config/sentry.php126

Connection Pool Configuration

The pool configuration controls the HTTP connection pool used by HttpPoolTransport for efficient connection reuse.





































Pool SettingTypeDefaultDescription
min_objectsint1Minimum number of pooled connections
max_objectsint10Maximum number of pooled connections
wait_timeoutfloat3.0Maximum seconds to wait for available connection
max_lifetimefloat60.0Maximum seconds a connection can live

Sources: config/sentry.php128-134

Connection Pool Architecture


Sources: config/sentry.php128-134


The Switcher Class

The Switcher class provides a centralized API for checking configuration state at runtime. Features use this class to determine whether to capture breadcrumbs or create spans.

Switcher Class Structure


Sources: src/Switcher.php1-33

Method Reference

isEnabled(string $key, bool $default = true): bool

Checks if a feature is enabled under the sentry.enable.* configuration namespace.

Configuration key: sentry.enable.{$key}
Returns: Boolean value from configuration, or $default if not set

Example Usage:


Sources: src/Switcher.php15-18

isBreadcrumbEnable(string $key): bool

Checks if breadcrumb capture is enabled for a specific operation type.

Configuration key: sentry.breadcrumbs.{$key}
Returns: Boolean value from configuration, defaults to true

Example Usage:


Sources: src/Switcher.php20-23

isTracingEnable(string $key): bool

Checks if tracing is enabled for a specific operation type. This method implements two-level checking:

  1. First checks the global sentry.enable_tracing flag
  2. If enabled, checks the specific sentry.tracing.{$key} flag
Configuration keys: 
 - sentry.enable_tracing (global)
 - sentry.tracing.{$key} (specific)
Returns: true only if both checks pass

Example Usage:


Sources: src/Switcher.php25-32

Configuration Key Resolution

The following diagram shows how Switcher method calls map to configuration keys:


Sources: src/Switcher.php15-32

Switcher Usage in Features

Features inject the Switcher class and use it to make runtime decisions about breadcrumb and span creation:


Sources: src/Switcher.php1-33


Configuration Best Practices

Environment-Specific Configuration

Use environment variables to manage configuration across development, staging, and production:


Sources: config/sentry.php1-135

Performance Optimization

Reduce overhead by disabling unnecessary breadcrumbs and tracing in high-traffic scenarios:


Sources: config/sentry.php32-49 config/sentry.php61-76

Privacy Considerations

When handling sensitive data, disable PII sending and SQL binding capture:


Sources: config/sentry.php54-55 config/sentry.php66-67