streaming: track time to first result
Created by: stefanhengl
This adds func WithTimer
which takes a Sender
and keeps track of "time to
first result".
Benchmarks show that the overhead is negligble compared to the overal latency of a search request which is in the order of miliseconds.
goos: darwin
goarch: amd64
pkg: github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend
cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
BenchmarkWithoutTimer-16 1000000000 0.2281 ns/op
BenchmarkWithTimer-16 153142389 7.901 ns/op
We log the new metric to honeycomb.