Source File
record.go
Belonging Package
go.opencensus.io/stats
Record(*tag.Map, interface{}, map[string]interface{})
}
type recordOptions struct {
attachments metricdata.Attachments
mutators []tag.Mutator
measurements []Measurement
recorder Recorder
}
func ( metricdata.Attachments) Options {
return func( *recordOptions) {
.attachments =
}
}
func ( ...tag.Mutator) Options {
return func( *recordOptions) {
.mutators =
}
}
func ( ...Measurement) Options {
return func( *recordOptions) {
.measurements =
}
}
func ( Recorder) Options {
return func( *recordOptions) {
.recorder =
}
}
type Options func(*recordOptions)
func ( ...Options) *recordOptions {
:= &recordOptions{}
for , := range {
()
}
return
}
func ( context.Context, ...Measurement) {
RecordWithOptions(, WithMeasurements(...))
}
func ( context.Context, []tag.Mutator, ...Measurement) error {
return RecordWithOptions(, WithTags(...), WithMeasurements(...))
}
func ( context.Context, ...Options) error {
:= createRecordOption(...)
if len(.measurements) == 0 {
return nil
}
:= internal.DefaultRecorder
if .recorder != nil {
= .recorder.Record
}
if == nil {
return nil
}
:= false
for , := range .measurements {
if .desc.subscribed() {
= true
break
}
}
if ! {
return nil
}
if len(.mutators) > 0 {
var error
if , = tag.New(, .mutators...); != nil {
return
}
}
(tag.FromContext(), .measurements, .attachments)
return nil
![]() |
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. |