Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add doc description for RocketMQ #686

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions docs/zh/05-features/01-l7-protocols/06-mq.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,44 @@ permalink: /features/l7-protocols/mq
| error_ratio | 异常比例 | -- | -- | 异常 / 响应 |
| client_error_ratio | 客户端异常比例 | -- | -- | 客户端异常 / 响应 |
| server_error_ratio | 服务端异常比例 | -- | -- | 服务端异常 / 响应 |

# RocketMQ

通过解析 [RocketMQ](https://rocketmq.apache.org/docs/4.x/) 协议,将 RocketMQ Request / Response 的字段映射到 l7_flow_log 对应字段中,映射关系如下表:

**Tag 字段映射表格,以下表格只包含存在映射关系的字段**

| 类别 | 名称 | 中文 | Request Header | Response Header | 描述 |
| ----- | ------------------ | ------------ | ---------------------------------------- | --------------- | --------------------------------------------------------------------------------- |
| Req. | version | 协议版本 | version | -- | -- |
| | request_type | 请求类型 | code | -- | -- |
| | request_domain | 请求域名 | extFields:producerGroup \| consumerGroup | -- | 主要针对 SEND 和 PULL ,其他消息暂未完整补充 |
| | request_resource | 请求资源 | extFields:topic | -- | 主要针对 SEND 和 PULL ,其他消息暂未完整补充 |
| | request_id | 请求 ID | opaque | -- | -- |
| | endpoint | 端点 | extFields:topic & queueId | -- | -- |
| Resp. | response_code | 响应码 | -- | code | -- |
| | response_status | 响应状态 | -- | code | 为 0 代表正常,非 0 代表各种异常 |
| | response_exception | 响应异常 | -- | remark | -- |
| | response_result | 响应结果 | -- | body | JSON 序列化格式时对应所有 JSON 字符串数据, ROCKETMQ 格式时对应其中的 body 字符串 |
| Trace | trace_id | TraceID | -- | -- | -- |
| | span_id | SpanID | -- | -- | -- |
| | x_request_id | X-Request-ID | opaque | opaque | -- |
| Misc. | -- | -- | -- | -- | -- |

- RocketMQ 协议中,flag 字段的 bit0 会标识是请求还是响应,而 bit1 会标识是否为单向请求(不需要响应)
- 对于 SEND_MESSAGE 、 PULL_MESSAGE 这类非单向请求和对应的响应会按照 opaque 一对一聚合为一个 Session
- 对于 UPDATE_CONSUMER_OFFSET 这类单向请求会单独置为 Session 类型,不需要聚合

**Metrics 字段映射表格,以下表格只包含存在映射关系的字段**

| 名称 | 中文 | Request | Response | 描述 |
| ------------------ | -------------- | ------- | -------- | ----------------------- |
| request | 请求 | -- | -- | Request 个数 |
| response | 响应 | -- | -- | Response 个数 |
| log_count | 日志总量 | -- | -- | -- |
| error | 异常 | -- | -- | 客户端异常 + 服务端异常 |
| client_error | 客户端异常 | -- | -- | -- |
| server_error | 服务端异常 | -- | -- | -- |
| error_ratio | 异常比例 | -- | -- | 异常 / 响应 |
| client_error_ratio | 客户端异常比例 | -- | -- | 客户端异常 / 响应 |
| server_error_ratio | 服务端异常比例 | -- | -- | 服务端异常 / 响应 |
Loading