Tags: friendsofhyperf/sentry
Tags
fix(sentry): adjust event flush order in Integration (#1052) * fix(sentry): adjust event flush order in Integration Move SentrySdk client flush to after Logs and TraceMetrics flush to ensure proper event ordering during shutdown sequence. * fix(sentry): adjust event flush order for IntegrationRegistry in SingletonAspect * fix(sentry): disable IntegrationRegistry instance creation to prevent unexpected issues --------- Co-authored-by: Deeka Wong <[email protected]>
fix(sentry): correct singleton key generation logic in SingletonAspec… …t (#1051) The condition for appending argument-based suffix to the singleton key was inverted. Changed from `! array_key_exists(0, $arguments)` to `array_key_exists(0, $arguments)` to properly generate unique keys when getInstance is called with an argument. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Deeka Wong <[email protected]> Co-authored-by: Claude <[email protected]>
feat(sentry): add singleton support for Logs class (#1050) * feat(sentry): add singleton support for Logs class - Add \Sentry\Logs\Logs::getInstance to SingletonAspect whitelist - Move Logs::getInstance()->flush() outside client null check for proper cleanup - Ensure Logs singleton instances are properly isolated per coroutine context 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * fix(sentry): simplify flushEvents method by using nullsafe operator --------- Co-authored-by: Deeka Wong <[email protected]> Co-authored-by: Claude <[email protected]>
fix(sentry): remove duplicate code and improve singleton instance res… …et in SingletonAspect (#1048) * fix(sentry): remove duplicate code and improve singleton instance reset in SingletonAspect - Remove duplicate variable assignments in SingletonAspect::process() - Add proper singleton instance reset logic using Closure::bind - Support both 'instance' and 'instances' property patterns - Ensure clean singleton behavior when context already exists * 更新 SingletonAspect.php Co-authored-by: Copilot <[email protected]> * fix(sentry): refine singleton instance reset logic in SingletonAspect * fix(metrics): remove unused spawnDefaultMetrics function in MetricSetter trait * fix(metrics): 移除冗余的defer调用,直接在事件处理后刷新指标 * fix(metrics): 移除defer调用,直接在事件处理后刷新指标 * fix(coroutine): 替换defer调用为Coroutine::defer以统一协程处理方式 --------- Co-authored-by: Deeka Wong <[email protected]> Co-authored-by: Copilot <[email protected]>
Add Annotation for Sentry Safe Caller (#1047) * safe caller * Update SafeCaller.php * fix(sentry): add null check for SafeCallerAnnotation Add null check handling for SafeCallerAnnotation in SafeCallerAspect. If the annotation is not found, proceed with normal execution instead of throwing an error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * feat(sentry): 添加 Graceful 注解及其处理逻辑 * feat(sentry): 移除 SafeCallerAspect,添加 GracefulAspect * feat(sentry): 移除 SafeCallerAspect 和 SafeCaller 注解 * fix(sentry): 修正 Graceful 注解的类型提示为 null|Graceful * fix(sentry): 更新 Graceful 注解中的中文注释为英文 --------- Co-authored-by: 何泽宏 <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Deeka Wong <[email protected]>
fix: improve handling of binary responses in GuzzleHttpClientAspect (… …#1041) * fix: improve handling of binary responses in GuzzleHttpClientAspect - Check Content-Type header to determine if response is textual before reading - Return 'Binary Response' placeholder for non-textual content - Avoid unnecessary stream operations on binary responses - Maintain backward compatibility for textual responses This prevents attempting to read or process binary content as text, which could cause memory issues or corrupted logs when dealing with file downloads, images, or other binary API responses. * fix: 修复 GuzzleHttpClientAspect 中对响应有效负载的处理逻辑 * fix: 修复 GuzzleHttpClientAspect 中对流响应的处理逻辑 * fix: 修复 GuzzleHttpClientAspect 中对流响应的处理逻辑 * fix: 改进 GuzzleHttpClientAspect 中对二进制响应的处理逻辑 * fix: 简化 GuzzleHttpClientAspect 中对流响应的处理逻辑 * fix: 修复 GuzzleHttpClientAspect 中对二进制响应的处理逻辑 * fix: 修改 GuzzleHttpClientAspect 中对空字符串响应的处理逻辑 * fix: 修复 GuzzleHttpClientAspect 中对可回溯流的处理逻辑 * Add grpc to textual Content-Type detection Updated the regex in GuzzleHttpClientAspect to include 'application/grpc' as a textual Content-Type. This ensures that gRPC responses are correctly identified as textual for further processing. * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> * fix: 修复 GuzzleHttpClientAspect 中对 Content-Type 头的处理逻辑 * fix: 处理 GuzzleHttpClientAspect 中的空响应情况 * fix: 优化 GuzzleHttpClientAspect 中的响应类型声明 * fix: 修复 GuzzleHttpClientAspect 中的响应处理逻辑,确保不再接受空响应 * fix: 修复 GuzzleHttpClientAspect 中的响应内容检查逻辑,确保正确处理空字符串响应 * Apply suggestion from @Copilot Co-authored-by: Copilot <[email protected]> * fix: 优化 GuzzleHttpClientAspect 中的响应内容处理,增加响应内容截断逻辑 * fix: 优化 GuzzleHttpClientAspect 中的响应内容截断逻辑,改善代码可读性 * fix: 修正 GuzzleHttpClientAspect 中的常量注释格式,改善代码一致性 * fix: 优化 GuzzleHttpClientAspect 中的响应内容处理逻辑,确保在异常情况下不影响请求流程 * fix: 更新 GuzzleHttpClientAspect 中的内容类型匹配逻辑,支持 gRPC 响应类型 * fix: 简化 GuzzleHttpClientAspect 中的响应内容类型判断逻辑 * fix: 优化 GuzzleHttpClientAspect 中的响应内容处理逻辑,支持 gRPC 和纯文本响应 --------- Co-authored-by: Deeka Wong <[email protected]> Co-authored-by: Copilot <[email protected]>
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 <[email protected]> * 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 <[email protected]> Co-Authored-By: Copilot <[email protected]>
PreviousNext