Source File
measure.go
Belonging Package
go.opencensus.io/stats
package stats
import (
)
Name() string
Description() string
Unit() string
}
type measureDescriptor struct {
subs int32 // access atomically
name string
description string
unit string
}
func ( *measureDescriptor) () {
atomic.StoreInt32(&.subs, 1)
}
func ( *measureDescriptor) () bool {
return atomic.LoadInt32(&.subs) == 1
}
var (
mu sync.RWMutex
measures = make(map[string]*measureDescriptor)
)
func (, , string) *measureDescriptor {
mu.Lock()
defer mu.Unlock()
if , := measures[]; {
return
}
:= &measureDescriptor{
name: ,
description: ,
unit: ,
}
measures[] =
return
}
type Measurement struct {
v float64
m Measure
desc *measureDescriptor
}
func ( Measurement) () float64 {
return .v
}
func ( Measurement) () Measure {
return .m
![]() |
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. |