Skip to content

feat: ws reconnect report connection info#3030

Merged
pipiiiiii merged 4 commits intomainfrom
feat/ws-reconnect-report
Aug 31, 2023
Merged

feat: ws reconnect report connection info#3030
pipiiiiii merged 4 commits intomainfrom
feat/ws-reconnect-report

Conversation

@pipiiiiii
Copy link
Copy Markdown
Contributor

@pipiiiiii pipiiiiii commented Aug 30, 2023

Types

  • 🎉 New Features
  • 🐛 Bug Fixes
  • 📚 Documentation Changes
  • 💄 Code Style Changes
  • 💄 Style Changes
  • 🪚 Refactors
  • 🚀 Performance Improvements
  • 🏗️ Build System
  • ⏱ Tests
  • 🧹 Chores
  • Other Changes

Background or solution

🤖 Generated by Copilot at fd10c2a

  • Add a property to store the close event information for each channel (link)
  • Report the channel reconnect event with additional data to the reporter service (link)
  • Close all the channels with the same code and reason as the connection close event (link)
  • Set and log the close event information for each channel (link)

issue: #3018

断连的时候上报一些额外的信息,

Changelog

🤖 Generated by Copilot at fd10c2a

Enhance WSChannelHandler to track and report close events for channels and connection. This helps to monitor and optimize the reconnection logic.

@pipiiiiii pipiiiiii requested review from Ricbet and hacke2 August 30, 2023 06:55
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Aug 30, 2023

CLA assistant check
All committers have signed the CLA.

@opensumi opensumi Bot added the 🎨 feature feature required label Aug 30, 2023
@opensumi
Copy link
Copy Markdown
Contributor

opensumi Bot commented Aug 30, 2023

ChatGPT Code Review:

  1. 代码检查和修改建议:

    • 第6行,"import { uuid } from '@opensumi/ide-core-common';" 似乎没有被使用到,可以考虑删除该导入。
    • 第7行,"import { IReporterService, REPORT_NAME, UrlProvider } from '@opensumi/ide-core-common';" 似乎没有被使用到,可以考虑删除该导入。
    • 第10行,"import { stringify, parse } from '../common/utils';" 导入的 stringifyparse 可能来自于 utils 文件,可以确认一下是否在该文件中提供了这两个函数。
    • in line 14, export class WSChannelHandler {: 此类是导出的,但是没有明确的导入。
  2. 代码功能描述:

    • 这段代码是一个WebSocket连接管理的类 WSChannelHandler
    • WSChannelHandler 维护了一个连接对象 connection 和一个通道映射表 channelMap,用于管理和追踪WebSocket通道。
    • 当通道打开时,WSChannelHandler 会将通道添加到 channelMap 中,并在连接断开时将通道从 channelMap 中移除。
    • WSChannelHandler 还提供了一些方法来打开和关闭通道,并向通道发送消息。
    • 在连接断开时,WSChannelHandler 会关闭所有的通道,并记录关闭事件的详细信息,包括通道路径、关闭代码、关闭原因和连接信息。
    • 在通道重新连接时,WSChannelHandler 会通过 reporterService 报告通道重新连接事件和关闭事件的详细信息。
    • WSChannelHandler 还提供了一些其他辅助方法用于处理通道消息和心跳消息等。

注意:以上只是根据diff部分的代码进行的分析和描述,如果完整的代码提供了更多的功能,请提供完整的代码进行进一步分析和描述。

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 30, 2023

Codecov Report

Patch coverage is 75.00% of modified lines.

Files Changed Coverage
packages/connection/src/common/utils.ts ø
...kages/connection/src/browser/ws-channel-handler.ts 75.00%

📢 Thoughts on this report? Let us know!.

@pipiiiiii pipiiiiii merged commit 673082c into main Aug 31, 2023
@pipiiiiii pipiiiiii deleted the feat/ws-reconnect-report branch August 31, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎨 feature feature required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants