func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec {
	desc := NewDesc(
		BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
		opts.Help,
		labelNames,
		opts.ConstLabels,
	)
	return &CounterVec{
		metricVec: newMetricVec(desc, func(lvs ...string) Metric {
			if len(lvs) != len(desc.variableLabels) {
				panic(errInconsistentCardinality)
			}
			result := &counter{desc: desc, labelPairs: makeLabelPairs(desc, lvs)}
			result.init(result)  
			return result
		}),
	}
}
NewCounterVec creates a new CounterVec based on the provided CounterOpts and
partitioned by the given label names.
package prometheus
import (
	"errors"
	"math"
	"sync/atomic"
	dto "github.com/prometheus/client_model/go"
)
type Counter interface {
	Metric
	Collector
	Inc()
	Add(float64)
}
type CounterOpts Opts
func NewCounter(opts CounterOpts) Counter {
	desc := NewDesc(
		BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
		opts.Help,
		nil,
		opts.ConstLabels,
	)
	result := &counter{desc: desc, labelPairs: desc.constLabelPairs}
	result.init(result)  
	return result
}
type counter struct {
	valBits uint64
	valInt  uint64
	selfCollector
	desc *Desc
	labelPairs []*dto.LabelPair
}
func (c *counter) Desc() *Desc {
	return c.desc
}
func (c *counter) Add(v float64) {
	if v < 0 {
		panic(errors.New("counter cannot decrease in value"))
	}
	ival := uint64(v)
	if float64(ival) == v {
		atomic.AddUint64(&c.valInt, ival)
		return
	}
	for {
		oldBits := atomic.LoadUint64(&c.valBits)
		newBits := math.Float64bits(math.Float64frombits(oldBits) + v)
		if atomic.CompareAndSwapUint64(&c.valBits, oldBits, newBits) {
			return
		}
	}
}
func (c *counter) Inc() {
	atomic.AddUint64(&c.valInt, 1)
}
func (c *counter) Write(out *dto.Metric) error {
	fval := math.Float64frombits(atomic.LoadUint64(&c.valBits))
	ival := atomic.LoadUint64(&c.valInt)
	val := fval + float64(ival)
	return populateMetric(CounterValue, val, c.labelPairs, out)
}
type CounterVec struct {
	*metricVec
}