func (s *Set) WritePrometheus(w io.Writer) {
	var bb bytes.Buffer
	lessFunc := func(i, j int) bool {
		return s.a[i].name < s.a[j].name
	}
	s.mu.Lock()
	for _, sm := range s.summaries {
		sm.updateQuantiles()
	}
	if !sort.SliceIsSorted(s.a, lessFunc) {
		sort.Slice(s.a, lessFunc)
	}
	sa := append([]*namedMetric(nil), s.a...)
	s.mu.Unlock()
	for _, nm := range sa {
		nm.metric.marshalTo(nm.name, &bb)
	}
	w.Write(bb.Bytes())
}
WritePrometheus writes all the metrics from s to w in Prometheus format.
package metrics
import (
	"bytes"
	"fmt"
	"io"
	"sort"
	"sync"
	"time"
)
type Set struct {
	mu        sync.Mutex
	a         []*namedMetric
	m         map[string]*namedMetric
	summaries []*Summary
}
func NewSet() *Set {
	return &Set{
		m: make(map[string]*namedMetric),
	}
}