feat(设备网关): 增加连接与消息链路监控能力 - #788
Merged
Merged
Conversation
扩展 DeviceGatewayMonitor 的连接、解码、上行和下行钩子。 接入 TCP、MQTT、HTTP 网络组件并补齐指标查询和回归测试。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目的
DeviceGatewayMonitor的连接、报文解码和消息上下行扩展能力迁移到社区版。FromDeviceMessageContext.handleMessage手动上报时未进入监控链的问题,同时保留beforeSendToPlatform既有语义。核心变动
gateway-component的监控 SPI、组合与延迟代理、监控供应商和 Dashboard measurement;适配 TCP、MQTT、HTTP 与 WebSocket 网关。handleUpstream统一入口;每个网关只构造一个platformHandler,协议返回流和手动输出分别复用并各自进入发送前监控。decode仍只包装一次原始报文生命周期;MQTT ACK 仍为一次;不新增其他 SPI 方法或全局 messageId 去重。db894b841、5293d482e、545666949。设计与测试目标
DeviceGatewayMonitor社区版迁移,以及所有协议返回值和手动context.handleMessage输出进入现有监控链。DeviceGatewayMonitor等源码 Javadoc;不新增任务型仓库文档。@since与关键@see;网关手动输出边界保留短注释。DeviceTracer、MonoTracer、FluxTracer,未重复增加 span 或敏感属性。测试结果
env JAVA_HOME=/Users/zhouhao/Library/Java/JavaVirtualMachines/temurin-17.0.18/Contents/Home ./mvnw -pl jetlinks-components/gateway-component,jetlinks-components/network-component/tcp-component,jetlinks-components/network-component/mqtt-component,jetlinks-components/network-component/http-component -am -DskipITs test545666949、tree76a20e3c49dd3abe15f8422ad3d76e979e98482c。提交只写入 Git 元数据,被测生产代码、测试、配置和依赖未变化。DeviceGatewayMonitorTest、GatewayMonitorsTest、DeviceGatewayMeasurementProviderTest、MqttClientDeviceGatewayTest、MqttConnectionSessionTest、TcpDeviceSessionTest、HttpServerDeviceGatewayTest、WebSocketDeviceSessionTest。DeviceGatewayMonitorTest6/6、HTTP 1/1、MQTT Client 1/1、TCP 会话 2/2。DeviceGatewayMonitor.handleUpstreamJaCoCo 行覆盖 2/2、指令覆盖 12/12、方法覆盖 1/1,均为 100%;该方法无分支计数。文档同步情况
DeviceGatewayMonitor、DeviceGatewayMonitorSupplier、GatewayMonitors、GatewayTimeSeriesMetric等公共源码契约注释。风险与说明
beforeSendToPlatform现有语义;新增钩子默认透明,本次收敛同 PR 未发布实现。@since/@see和手动输出边界说明。DeviceTracer、MonoTracer、FluxTracer覆盖,本次不新增 span。545666949可撤销本轮手动上报修复;需要完全回退迁移时再依次回退前两个阶段提交。