@@ -69,12 +69,13 @@ func TestServer_LogRequest(t *testing.T) {
69
69
}` , buf .String ())
70
70
}
71
71
72
- func TestServer_LogRequest_WithTraceID (t * testing.T ) {
72
+ func TestServer_LogRequest_WithTrace (t * testing.T ) {
73
73
s := & Server {}
74
74
75
75
extra := new (ExtraLogFields )
76
76
ctx := context .WithValue (context .Background (), ExtraLogFieldsCtxKey , extra )
77
77
extra .Add (zap .String ("traceID" , "1234567890abcdef" ))
78
+ extra .Add (zap .String ("spanID" , "12345678" ))
78
79
79
80
req := httptest .NewRequest (http .MethodGet , "/" , nil ).WithContext (ctx )
80
81
rec := httptest .NewRecorder ()
@@ -93,7 +94,8 @@ func TestServer_LogRequest_WithTraceID(t *testing.T) {
93
94
"msg":"handled request", "level":"info", "bytes_read":0,
94
95
"duration":"50ms", "resp_headers": {}, "size":0,
95
96
"status":0, "user_id":"",
96
- "traceID":"1234567890abcdef"
97
+ "traceID":"1234567890abcdef",
98
+ "spanID":"12345678"
97
99
}` , buf .String ())
98
100
}
99
101
@@ -144,12 +146,13 @@ func BenchmarkServer_LogRequest_NopLogger(b *testing.B) {
144
146
}
145
147
}
146
148
147
- func BenchmarkServer_LogRequest_WithTraceID (b * testing.B ) {
149
+ func BenchmarkServer_LogRequest_WithTrace (b * testing.B ) {
148
150
s := & Server {}
149
151
150
152
extra := new (ExtraLogFields )
151
153
ctx := context .WithValue (context .Background (), ExtraLogFieldsCtxKey , extra )
152
154
extra .Add (zap .String ("traceID" , "1234567890abcdef" ))
155
+ extra .Add (zap .String ("spanID" , "12345678" ))
153
156
154
157
req := httptest .NewRequest (http .MethodGet , "/" , nil ).WithContext (ctx )
155
158
rec := httptest .NewRecorder ()
0 commit comments