Copyright 2018, OpenCensus Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

package stats

import (
	

	
	
	
)

func () {
	internal.SubscriptionReporter = func( string) {
		mu.Lock()
		measures[].subscribe()
		mu.Unlock()
	}
}
Recorder provides an interface for exporting measurement information from the static Record method by using the WithRecorder option.
Record records a set of measurements associated with the given tags and attachments. The second argument is a `[]Measurement`.
	Record(*tag.Map, interface{}, map[string]interface{})
}

type recordOptions struct {
	attachments  metricdata.Attachments
	mutators     []tag.Mutator
	measurements []Measurement
	recorder     Recorder
}
WithAttachments applies provided exemplar attachments.
func ( metricdata.Attachments) Options {
	return func( *recordOptions) {
		.attachments = 
	}
}
WithTags applies provided tag mutators.
func ( ...tag.Mutator) Options {
	return func( *recordOptions) {
		.mutators = 
	}
}
WithMeasurements applies provided measurements.
func ( ...Measurement) Options {
	return func( *recordOptions) {
		.measurements = 
	}
}
WithRecorder records the measurements to the specified `Recorder`, rather than to the global metrics recorder.
func ( Recorder) Options {
	return func( *recordOptions) {
		.recorder = 
	}
}
Options apply changes to recordOptions.
type Options func(*recordOptions)

func ( ...Options) *recordOptions {
	 := &recordOptions{}
	for ,  := range  {
		()
	}
	return 
}
Record records one or multiple measurements with the same context at once. If there are any tags in the context, measurements will be tagged with them.
RecordWithTags records one or multiple measurements at once. Measurements will be tagged with the tags in the context mutated by the mutators. RecordWithTags is useful if you want to record with tag mutations but don't want to propagate the mutations in the context.
func ( context.Context,  []tag.Mutator,  ...Measurement) error {
	return RecordWithOptions(, WithTags(...), WithMeasurements(...))
}
RecordWithOptions records measurements from the given options (if any) against context and tags and attachments in the options (if any). If there are any tags in the context, measurements will be tagged with them.
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