func (c *Cacher) Collect(ch chan<- prometheus.Metric) {
	c.samplesTotal.Collect(ch)
}
Collect implements prometheus.Collector.
package cacher
import (
	"context"
	"fmt"
	"math"
	"sync"
	"time"
	netctx "golang.org/x/net/context"
	"github.com/Shopify/sarama"
	"github.com/Sirupsen/logrus"
	"github.com/digitalocean/vulcan/kafka"
	"github.com/digitalocean/vulcan/model"
	"github.com/golang/protobuf/proto"
	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/prometheus/storage/remote"
	cg "github.com/supershabam/sarama-cg"
	cgconsumer "github.com/supershabam/sarama-cg/consumer"
)
type Config struct {
	Cleanup     time.Duration
	Client      sarama.Client
	Coordinator *cg.Coordinator
	MaxAge      time.Duration
	Topic       string
}
type consumer struct {
	Accs map[string]*Accumulator
	M    sync.RWMutex
}
type Cacher struct {
	cfg           *Config
	consumers     map[int32]*consumer
	m             sync.RWMutex
	numPartitions int
	samplesTotal  *prometheus.CounterVec
}
func NewCacher(cfg *Config) (*Cacher, error) {
	partitions, err := cfg.Client.Partitions(cfg.Topic)
	if err != nil {
		return nil, err
	}
	return &Cacher{
		cfg:           cfg,
		consumers:     map[int32]*consumer{},
		numPartitions: len(partitions),
		samplesTotal: prometheus.NewCounterVec(prometheus.CounterOpts{
			Namespace: "vulcan",
			Subsystem: "cacher",
			Name:      "samples_total",
			Help:      "count of samples ingested into cacher",
		}, []string{"topic", "partition"}),
	}, nil
}
func (c *Cacher) Describe(ch chan<- *prometheus.Desc) {
	c.samplesTotal.Describe(ch)
}