Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: friendsofhyperf/sentry
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 347d431
Choose a base ref
...
head repository: friendsofhyperf/sentry
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c9ae40d
Choose a head ref
  • 19 commits
  • 41 files changed
  • 3 contributors

Commits on Nov 21, 2025

  1. feat: add server address tracing for Redis connections (#1021)

    * feat: add server address tracing for Redis connections
    
    - Add server.address and server.port to Redis tracing data
    - Support cluster and sentinel configurations
    - Add ConnectionContainer utility for WeakMap-based connection tracking
    - Add RedisConnectionAspect for connection configuration capture (commented out in config)
    
    * feat: improve server address handling for Redis connections
    
    * feat: 添加 Redis 服务器地址和端口追踪常量,并更新相关逻辑
    
    * feat: 更新 Redis 连接追踪逻辑以直接获取服务器地址和端口
    
    * feat: 更新 Redis 连接追踪逻辑,添加注释以区分 Redis 和 RedisCluster
    
    * fix: 修正 RedisConnectionAspect 中的变量命名以提高代码可读性
    
    * feat: 启用 RedisConnectionAspect 以支持 Redis 连接追踪
    
    ---------
    
    Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
    huangdijia and huangdijia committed Nov 21, 2025
    Configuration menu
    Copy the full SHA
    26d3cf4 View commit details
    Browse the repository at this point in the history
  2. feat: add server address tracing for database connections (#1024)

    * feat: add server address tracing for database connections
    
    - Add DbConnectionAspect to capture database server address and port
    - Add TRACE_DB_SERVER_ADDRESS and TRACE_DB_SERVER_PORT constants
    - Register DbConnectionAspect in ConfigProvider
    - Update EventHandleListener to include server.address and server.port in tracing data
    
    This implements similar functionality to Redis server tracing for database connections.
    
    * feat: 优化 DbConnectionAspect 以简化数据库连接状态追踪逻辑
    
    ---------
    
    Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
    huangdijia and huangdijia committed Nov 21, 2025
    Configuration menu
    Copy the full SHA
    cbd4c80 View commit details
    Browse the repository at this point in the history
  3. fix: improve database read/write connection tracing (#1025)

    * fix: improve database read/write connection tracing
    
    - Add TRACE_DB_USE_READ_PDO constant to track read PDO usage
    - Enhance DbConnectionAspect to detect getPdoForSelect method calls
    - Improve EventHandleListener to properly determine server port based on
      read/write configuration and host matching
    - Fix port detection for read replicas in database tracing
    
    This ensures accurate server address and port tracing for both read
    and write database connections, especially in environments with
    separate read/write hosts and ports.
    
    * fix: 优化数据库连接主机和端口的选择逻辑
    
    * fix: 优化数据库配置获取逻辑以支持更灵活的连接设置
    
    * fix: 使用 array_search 优化数据库主机查找逻辑
    
    * fix: 修复数据库配置获取逻辑以使用正确的主机地址
    
    ---------
    
    Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
    huangdijia and huangdijia committed Nov 21, 2025
    Configuration menu
    Copy the full SHA
    2286722 View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2025

  1. feat: add server address tracing for RedisCluster connections (#1026)

    * feat: add server address tracing for RedisCluster connections
    
    This commit enhances the RedisConnectionAspect to support server address
    tracing for RedisCluster connections by implementing slot-based node
    resolution. The implementation includes:
    
    - Added WeakMap-based caching for cluster slot information to minimize
      redundant CLUSTER SLOTS commands
    - Implemented getSlotByKey() to determine the hash slot for a given key
    - Implemented findNodeBySlot() to locate the master node responsible
      for a specific slot range
    - Extracts and sets server address (host/port) in tracing context for
      RedisCluster operations
    
    This enables distributed tracing systems to accurately track which Redis
    cluster node handles each operation, improving observability for
    clustered Redis deployments.
    
    * feat: optimize RedisCluster node tracing by consolidating slot retrieval methods
    
    ---------
    
    Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
    huangdijia and huangdijia committed Nov 22, 2025
    Configuration menu
    Copy the full SHA
    c7ede62 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b1c9b11 View commit details
    Browse the repository at this point in the history
  3. refactor: optimize database server address tracing with WeakMap (#1027)

    This change improves the database server address tracing mechanism by:
    - Using WeakMap to cache server address and port information from DSN at PDO creation time
    - Extracting server information directly from DSN in createPdoConnection
    - Removing complex fallback logic from EventHandleListener that relied on config and read/write PDO detection
    - Simplifying server address/port retrieval to direct Context lookups
    
    The new approach is more efficient and reliable, capturing the actual connection details at the earliest point rather than inferring them later.
    
    Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
    huangdijia and huangdijia committed Nov 22, 2025
    Configuration menu
    Copy the full SHA
    a9d6e34 View commit details
    Browse the repository at this point in the history
  4. feat: enhance DB connection tracing with real-time server address det…

    …ection (#1028)
    
    * feat: enhance DB connection tracing with real-time server address detection
    
    This change improves database tracing by capturing and tracking the actual server
    addresses for database connections. Key improvements include:
    
    - Implement WeakMap-based caching to store connection configurations
    - Intercept reconnect and getConnection methods to capture server details
    - Track server host and port information in tracing context
    - Optimize aspect to capture connection details at the right lifecycle point
    
    This enables more accurate distributed tracing with actual database server
    addresses instead of placeholder values.
    
    * feat: improve server address tracing in DbAspect with default values
    
    * feat: improve driver detection logic in DbAspect for database connections
    
    ---------
    
    Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
    huangdijia and huangdijia committed Nov 22, 2025
    Configuration menu
    Copy the full SHA
    a9b65b1 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a7d59ff View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    613acea View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    a0a673c View commit details
    Browse the repository at this point in the history
  8. feat: add feature flag support for tracing aspects (#1029)

    Add Feature dependency injection to tracing aspects to allow conditional
    span creation based on feature flags. This enables fine-grained control
    over which types of operations are traced (db, redis, elasticsearch, rpc).
    
    Changes:
    - DbConnectionAspect: Check db tracing feature flag before caching server info
    - RedisConnectionAspect: Check redis tracing feature flag before caching slot info
    - ElasticsearchRequestAspect: Check elasticsearch tracing feature flag before processing
    - RpcEndpointAspect: Check rpc tracing feature flag before storing server address
    
    This allows users to selectively enable/disable tracing for specific
    operation types without modifying code.
    
    Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
    huangdijia and huangdijia committed Nov 22, 2025
    Configuration menu
    Copy the full SHA
    31e0baf View commit details
    Browse the repository at this point in the history

Commits on Nov 27, 2025

  1. Configuration menu
    Copy the full SHA
    48dce5e View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2025

  1. feat: Support Trace Metrics (#1032)

    * feat: add additional Sentry singleton classes to aspect configuration
    
    Add support for new Sentry singleton classes:
    - LogLevel::getInstance
    - Metrics::getInstance
    - MetricsUnit::getInstance
    - Unit::getInstance
    
    This ensures proper aspect-based handling for these Sentry components.
    
    * fix: reorder Sentry singleton classes in SingletonAspect
    
    * fix: update SingletonAspect to use TraceMetrics singleton instance
    
    * feat: add enable_metrics configuration option to Sentry settings
    
    * feat: add metrics tracking and related listeners for enhanced performance monitoring
    
    * feat: add new metrics listeners for enhanced monitoring capabilities
    
    * fix: remove PoolWatcher listener from ConfigProvider
    
    * feat: update event parameter types in metrics listeners for improved clarity
    
    * fix: optimize queue retrieval in QueueWatcher listener
    
    * feat: add metrics interval configuration and update timer intervals in listeners
    
    * feat: add metrics interval configuration to Sentry settings
    
    * feat: remove unnecessary comment and improve PoolWatcher with metric name prefix method
    
    * fix: add return type declaration to watch method in PoolWatcher class
    
    * fix: add missing newline for better code readability in PoolWatcher class
    
    * feat: enforce minimum metrics interval of 5 in getMetricsInterval method
    
    * refactor: simplify process method in RequestWatcher class by removing match expression
    
    * fix: add missing newline for improved readability in RedisPoolWatcher class
    
    * feat: add Counter and CounterAspect classes for metrics annotation and processing
    
    * feat: add CounterAspect to ConfigProvider for metrics tracking
    
    * feat: add HistogramAspect and Histogram annotation for enhanced metrics tracking
    
    * feat: add Unit::second() to HistogramAspect for improved metrics tracking
    
    * feat: enhance RequestWatcher to track HTTP request metrics with TraceMetrics
    
    * feat: add defer calls to flush TraceMetrics in various aspects and listeners
    
    ---------
    
    Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
    huangdijia and huangdijia committed Nov 28, 2025
    Configuration menu
    Copy the full SHA
    b211519 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3c17d28 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    86914f7 View commit details
    Browse the repository at this point in the history

Commits on Nov 29, 2025

  1. Update documentation links to docs.hdj.me

    Replaced all references to hyperf.fans with docs.hdj.me in documentation, configuration, and composer.json files to reflect the new official documentation site.
    huangdijia committed Nov 29, 2025
    Configuration menu
    Copy the full SHA
    fc7d641 View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2025

  1. feat: enhance Sentry metrics with configurable default metrics collec…

    …tion (#1034)
    
    * feat: enhance Sentry metrics with configurable default metrics collection
    
    - Add SENTRY_ENABLE_DEFAULT_METRICS configuration option
    - Implement isDefaultMetricsEnabled() method in Feature class
    - Extend OnBeforeHandle listener to collect command-line metrics
    - Add worker identification tags to memory metrics
    - Separate default metrics from custom metrics collection
    - Add Timer-based periodic metrics collection for commands
    - Include garbage collection and resource usage metrics
    
    This enhancement provides more granular control over metrics collection
    and extends monitoring capabilities to command-line operations.
    
    * feat: 添加命令指标启用选项并更新相关逻辑
    
    * feat: 使用静态变量替代上下文管理命令运行状态
    
    * feat: 移除AfterExecute事件监听并优化命令指标处理逻辑
    
    * fix: 更新注释以更清晰地说明命令自动退出的条件
    
    * fix: 修复命令指标处理逻辑,确保在适当条件下启用指标收集
    
    * fix: 优化命令指标启用逻辑,确保在适当条件下收集指标
    
    * fix: 修复命令指标启用逻辑,确保在适当条件下收集默认指标
    
    * fix: 更新指标收集逻辑,将工人标识从'N/A'更改为'0'
    
    * fix: 修复默认指标启用逻辑,确保在禁用时正确返回
    
    ---------
    
    Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
    huangdijia and huangdijia committed Dec 1, 2025
    Configuration menu
    Copy the full SHA
    c6d9df4 View commit details
    Browse the repository at this point in the history

Commits on Dec 3, 2025

  1. Configuration menu
    Copy the full SHA
    2768f9b View commit details
    Browse the repository at this point in the history
  2. refactor: centralize context management in Sentry integration (#1035)

    * refactor: centralize context management in Sentry integration
    
    - Add new Context class to replace Hyperf Context usage
    - Move all Sentry-specific context constants to Context class
    - Update all tracing aspects to use centralized context management
    - Deprecate old Feature class methods in favor of Context class
    - Standardize server address/port handling across all components
    - Improve code organization and maintainability
    
    This refactor centralizes all context management for Sentry integration,
    making it easier to maintain and understand the context flow.
    
    * refactor: 更新获取Carrier的方法以支持协程ID
    
    * refactor: 使用call_user_func获取消息ID以提高兼容性
    
    * refactor: 使用SentryContext替代Hyperf\Context以管理追踪载体
    
    * refactor: 更新SentryContext以支持Elasticsearch和RPC追踪数据管理
    
    * refactor: 优化RPC结果的服务器地址和端口数据设置逻辑
    
    * refactor: 确保服务器地址在缺失时默认为'unknown'
    
    * refactor: 替换Context为SentryContext以统一追踪管理
    
    * refactor: 更新SentryContext以使用数据库服务器地址和端口设置
    
    * refactor: 移除不必要的类型转换以简化ElasticsearchSpanData获取逻辑
    
    * refactor: 更新RpcEndpointAspect以使用SentryContext的RPC服务器地址和端口设置
    
    * Apply suggestion from @Copilot
    
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    
    * refactor: 修正TRACE_CARRIER常量的格式以统一命名约定
    
    * refactor: 统一使用Context类替代别名以提高代码可读性
    
    * refactor: 调整TRACE_CARRIER常量的位置以提高代码结构清晰度
    
    * refactor: 统一SentryContext常量命名约定以提高一致性
    
    * refactor: 添加destroyRpcSpanContext方法以简化RPC上下文销毁逻辑
    
    * refactor: 移除不必要的服务器地址和端口常量及相关方法以简化代码
    
    * refactor: 修正CTX_CARRIER常量的命名以提高一致性
    
    * refactor: 修正CTX_RPC_SPAN_CONTEXT常量的命名以提高一致性
    
    * refactor: 移除isTracingEnabled方法以简化代码
    
    * refactor: 强制转换isTracingDisabled方法的返回值为布尔类型
    
    ---------
    
    Co-Authored-By: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
    Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>
    huangdijia and Copilot committed Dec 3, 2025
    Configuration menu
    Copy the full SHA
    c9ae40d View commit details
    Browse the repository at this point in the history
Loading