type latencyKey … var latencyBuckets … var latencyCounterMu … var latencyCounters … // ForEachLatencyCounter runs the provided function for each current latency // counter measuring the given operation. // // Exported for testing. func ForEachLatencyCounter(operation string, isError bool, f func(*counter.Counter)) { … } // getLatencyCounter returns the counter used to record latency of the given // operation in the given bucket. func getLatencyCounter(operation, bucket string, isError bool) *counter.Counter { … } // StartLatencyTimer starts a timer for the gopls operation with the given // name, and returns a func to stop the timer and record the latency sample. // // If the context provided to the resulting func is done, no observation is // recorded. func StartLatencyTimer(operation string) func(context.Context, error) { … }