(b *testing.B)
| 156 | } |
| 157 | |
| 158 | func BenchmarkStackdriverLog(b *testing.B) { |
| 159 | ent := &Entry{ |
| 160 | ReceivedTime: time.Date(2017, time.October, 13, 17, 0, 0, 512, time.UTC), |
| 161 | RequestMethod: "POST", |
| 162 | RequestURL: "/foo/bar", |
| 163 | RequestHeaderSize: 456, |
| 164 | RequestBodySize: 123000, |
| 165 | UserAgent: "Chrome proxied through Firefox and Edge", |
| 166 | Referer: "http://www.example.com/", |
| 167 | Proto: "HTTP/1.1", |
| 168 | RemoteIP: "12.34.56.78", |
| 169 | ServerIP: "127.0.0.1", |
| 170 | Status: 404, |
| 171 | ResponseHeaderSize: 555, |
| 172 | ResponseBodySize: 789000, |
| 173 | Latency: 5 * time.Second, |
| 174 | } |
| 175 | var buf bytes.Buffer |
| 176 | l := NewStackdriverLogger(&buf, func(error) {}) |
| 177 | l.Log(ent) |
| 178 | b.ReportAllocs() |
| 179 | b.SetBytes(int64(buf.Len())) |
| 180 | buf.Reset() |
| 181 | b.ResetTimer() |
| 182 | |
| 183 | l = NewStackdriverLogger(io.Discard, func(error) {}) |
| 184 | for i := 0; i < b.N; i++ { |
| 185 | l.Log(ent) |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | func BenchmarkE2E(b *testing.B) { |
| 190 | run := func(b *testing.B, handler http.Handler) { |
nothing calls this directly
no test coverage detected