Prevent lock malfunction

literal copies lock value from metrics
This commit is contained in:
oliverpool 2017-02-23 16:29:01 +01:00
parent 1ce196ed35
commit 647f7390c6
2 changed files with 3 additions and 3 deletions

View File

@ -16,7 +16,7 @@ var MetricsOpenConnections = prometheus.NewGauge(prometheus.GaugeOpts{
func SetupMetrics(handler *tusd.Handler) {
prometheus.MustRegister(MetricsOpenConnections)
prometheus.MustRegister(prometheuscollector.New(handler.Metrics))
prometheus.MustRegister(prometheuscollector.New(&handler.Metrics))
stdout.Printf("Using %s as the metrics path.\n", Flags.MetricsPath)
http.Handle(Flags.MetricsPath, prometheus.Handler())

View File

@ -46,11 +46,11 @@ var (
)
type Collector struct {
metrics tusd.Metrics
metrics *tusd.Metrics
}
// New creates a new collector which read froms the provided Metrics struct.
func New(metrics tusd.Metrics) Collector {
func New(metrics *tusd.Metrics) Collector {
return Collector{
metrics: metrics,
}