func (s *Writer) Add(ctx context.Context, metric string,
	value float64, id []byte) {
	if math.IsInf(value, 0) || math.IsNaN(value) {
		return
	}
	var pi unsafe.Pointer
	for {
		pi = atomic.LoadPointer(&s.page)
		if pi != nil {
			break
		}
		pi = unsafe.Pointer(newPage(time.Now()))
		if atomic.CompareAndSwapPointer(&s.page, nil, pi) {
			break
		}
	}
	p := (*page)(pi)
	ai, ok := p.m.Load(metric)
	if !ok {
		ai, _ = p.m.LoadOrStore(metric, newAgg(s.params, p.now))
	}
	a := ai.(*agg)
	a.Observe(value, id)
}
Add adds the metric value to the current set of records. It will be
reflected in the distribution of the records returned by Capture. WARNING:
under some concurrent scenarios, this can lose updates.
package data
import (
	"context"
	"math"
	"sync"
	"sync/atomic"
	"time"
	"unsafe"
	"github.com/vivint/rothko/dist"
)
type page struct {
	m   sync.Map  
	now time.Time
}
func newPage(now time.Time) *page {
	return &page{
		now: now,
	}
}
type Writer struct {
	page   unsafe.Pointer  
	params dist.Params
}
func NewWriter(params dist.Params) *Writer {
	return &Writer{
		params: params,
	}
}