Source File
spanbucket.go
Belonging Package
go.opencensus.io/trace
package trace
import (
)
const samplePeriod = time.Second
var defaultLatencies = [...]time.Duration{
10 * time.Microsecond,
100 * time.Microsecond,
time.Millisecond,
10 * time.Millisecond,
100 * time.Millisecond,
time.Second,
10 * time.Second,
time.Minute,
}
type bucket struct {
nextTime time.Time // next time we can accept a span
buffer []*SpanData // circular buffer of spans
nextIndex int // location next SpanData should be placed in buffer
overflow bool // whether the circular buffer has wrapped around
}
func ( int) bucket {
return bucket{
buffer: make([]*SpanData, ),
}
}
func ( time.Duration) int {
:= 0
for < len(defaultLatencies) && >= defaultLatencies[] {
++
}
return
}
func ( int) ( time.Duration, time.Duration) {
if == 0 {
return 0, defaultLatencies[]
}
if == len(defaultLatencies) {
return defaultLatencies[-1], 1<<63 - 1
}
return defaultLatencies[-1], defaultLatencies[]
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |