func NewMetricWithTimestamp(t time.Time, m Metric) Metric {
	return timestampedMetric{Metric: m, t: t}
}
NewMetricWithTimestamp returns a new Metric wrapping the provided Metric in a
way that it has an explicit timestamp set to the provided Time. This is only
useful in rare cases as the timestamp of a Prometheus metric should usually
be set by the Prometheus server during scraping. Exceptions include mirroring
metrics with given timestamps from other metric
sources.

NewMetricWithTimestamp works best with MustNewConstMetric,
MustNewConstHistogram, and MustNewConstSummary, see example.

Currently, the exposition formats used by Prometheus are limited to
millisecond resolution. Thus, the provided time will be rounded down to the
next full millisecond value.
package prometheus
import (
	"strings"
	"time"
	"github.com/golang/protobuf/proto"
	"github.com/prometheus/common/model"
	dto "github.com/prometheus/client_model/go"
)
var separatorByteSlice = []byte{model.SeparatorByte}  
type Metric interface {
	Desc() *Desc
	Write(*dto.Metric) error
}
type Opts struct {
	Namespace string
	Subsystem string
	Name      string
	Help string
	ConstLabels Labels
}
func BuildFQName(namespace, subsystem, name string) string {
	if name == "" {
		return ""
	}
	switch {
	case namespace != "" && subsystem != "":
		return strings.Join([]string{namespace, subsystem, name}, "_")
	case namespace != "":
		return strings.Join([]string{namespace, name}, "_")
	case subsystem != "":
		return strings.Join([]string{subsystem, name}, "_")
	}
	return name
}
type labelPairSorter []*dto.LabelPair
func (s labelPairSorter) Len() int {
	return len(s)
}
func (s labelPairSorter) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}
func (s labelPairSorter) Less(i, j int) bool {
	return s[i].GetName() < s[j].GetName()
}
type invalidMetric struct {
	desc *Desc
	err  error
}
func NewInvalidMetric(desc *Desc, err error) Metric {
	return &invalidMetric{desc, err}
}
func (m *invalidMetric) Desc() *Desc { return m.desc }
func (m *invalidMetric) Write(*dto.Metric) error { return m.err }
type timestampedMetric struct {
	Metric
	t time.Time
}
func (m timestampedMetric) Write(pb *dto.Metric) error {
	e := m.Metric.Write(pb)
	pb.TimestampMs = proto.Int64(m.t.Unix()*1000 + int64(m.t.Nanosecond()/1000000))
	return e
}