Переглянути джерело

fix golint issues in core/metric (#499)

Kevin Wan 4 роки тому
батько
коміт
e7c9ef16fe
4 змінених файлів з 18 додано та 3 видалено
  1. 5 0
      core/metric/counter.go
  2. 8 2
      core/metric/gauge.go
  3. 4 0
      core/metric/histogram.go
  4. 1 1
      core/metric/metric.go

+ 5 - 0
core/metric/counter.go

@@ -6,10 +6,14 @@ import (
 )
 
 type (
+	// A CounterVecOpts is an alias of VectorOpts.
 	CounterVecOpts VectorOpts
 
+	// CounterVec interface represents a counter vector.
 	CounterVec interface {
+		// Inc increments labels.
 		Inc(lables ...string)
+		// Add adds labels with v.
 		Add(v float64, labels ...string)
 		close() bool
 	}
@@ -19,6 +23,7 @@ type (
 	}
 )
 
+// NewCounterVec returns a CounterVec.
 func NewCounterVec(cfg *CounterVecOpts) CounterVec {
 	if cfg == nil {
 		return nil

+ 8 - 2
core/metric/gauge.go

@@ -6,11 +6,16 @@ import (
 )
 
 type (
+	// GaugeVecOpts is an alias of VectorOpts.
 	GaugeVecOpts VectorOpts
 
-	GuageVec interface {
+	// GaugeVec represents a guage vector.
+	GaugeVec interface {
+		// Set sets v to labels.
 		Set(v float64, labels ...string)
+		// Inc increments labels.
 		Inc(labels ...string)
+		// Add adds v to labels.
 		Add(v float64, labels ...string)
 		close() bool
 	}
@@ -20,7 +25,8 @@ type (
 	}
 )
 
-func NewGaugeVec(cfg *GaugeVecOpts) GuageVec {
+// NewGaugeVec returns a GaugeVec.
+func NewGaugeVec(cfg *GaugeVecOpts) GaugeVec {
 	if cfg == nil {
 		return nil
 	}

+ 4 - 0
core/metric/histogram.go

@@ -6,6 +6,7 @@ import (
 )
 
 type (
+	// A HistogramVecOpts is a histogram vector options.
 	HistogramVecOpts struct {
 		Namespace string
 		Subsystem string
@@ -15,7 +16,9 @@ type (
 		Buckets   []float64
 	}
 
+	// A HistogramVec interface represents a histogram vector.
 	HistogramVec interface {
+		// Observe adds observation v to labels.
 		Observe(v int64, lables ...string)
 		close() bool
 	}
@@ -25,6 +28,7 @@ type (
 	}
 )
 
+// NewHistogramVec returns a HistogramVec.
 func NewHistogramVec(cfg *HistogramVecOpts) HistogramVec {
 	if cfg == nil {
 		return nil

+ 1 - 1
core/metric/metric.go

@@ -1,6 +1,6 @@
 package metric
 
-// VectorOpts general configuration
+// A VectorOpts is a general configuration.
 type VectorOpts struct {
 	Namespace string
 	Subsystem string