7.03 Middleware-OpenTelemetry测试
(base) yanglei@yuanhong 03-tracingTest % tree ./
./
├── context.go
├── context_test.go
├── go.mod
├── go.sum
├── handleFunc.go
├── httpServer.go
├── httpServer_test.go
├── matchNode.go
├── middleware.go
├── middleware_test.go
├── middlewares
│ ├── access_log
│ │ ├── accessLog.go
│ │ ├── accessLog_test.go
│ │ └── middlewareBuilder.go
│ └── open_telemetry
│ └── middlewareBuilder.go
├── node.go
├── option.go
├── router.go
├── router_test.go
├── safeContext.go
├── serverInterface.go
└── stringValue.go
3 directories, 21 filesPART1. 编写测试用例
1.1 创建Middleware和Server
1.2 初始化Tracing
1.2.1 初始化zipkin
1.2.2 初始化jeager
1.3 设置OpenTelemetry的Tracer Provider
PART2. 启动zipkin
PART3. 测试


PART4. 修Bug
4.1 修复层级关系不正确的问题
4.1.1 原因

4.1.2 修复
4.1.3 修复结果


PART5. 缺陷

5.1 记录响应码的代码在哪里加?

5.2 Context中记录响应码
5.2.1 实现思路

5.2.2 实现
PART6. 修改测试用例


附录
Last updated