Skip to content

Commit

Permalink
run linter
Browse files Browse the repository at this point in the history
Signed-off-by: Roy Chiang <[email protected]>
  • Loading branch information
roystchiang committed Aug 4, 2022
1 parent ca8cb9c commit 148c1e7
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions pkg/util/metrics_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"bytes"
"errors"
"fmt"
"github.com/golang/protobuf/proto"
"math"
"strings"
"sync"

"github.com/gogo/protobuf/proto"

"github.com/go-kit/log/level"
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
Expand Down Expand Up @@ -564,8 +565,8 @@ type UserRegistry struct {
// UserRegistries holds Prometheus registries for multiple users, guaranteeing
// multi-thread safety and stable ordering.
type UserRegistries struct {
regsMu sync.Mutex
regs []UserRegistry
regsMu sync.Mutex
regs []UserRegistry
removedMetrics MetricFamilyMap
}

Expand Down Expand Up @@ -714,7 +715,7 @@ func (r *UserRegistries) BuildMetricFamiliesPerUser() MetricFamiliesPerUser {
}
}
data = append(data, struct {
user string
user string
metrics MetricFamilyMap
}{
user: "", metrics: r.removedMetrics})
Expand Down Expand Up @@ -821,8 +822,8 @@ type CollectorVec interface {
}

type MergedMetricFamily struct {
metricFamily *dto.MetricFamily
metricMap MetricMap
metricFamily *dto.MetricFamily
metricMap MetricMap
}

func (m *MergedMetricFamily) CreateMetricFamily() *dto.MetricFamily {
Expand Down Expand Up @@ -877,7 +878,7 @@ func getMergeFunc(metricType dto.MetricType) (func(existing *dto.Metric, new *dt
case dto.MetricType_HISTOGRAM:
return mergeHistogram, nil
default:
return nil, errors.New(fmt.Sprintf("unknown metric type: %v", metricType))
return nil, fmt.Errorf("unknown metric type: %v", metricType)
}
}

Expand Down Expand Up @@ -919,12 +920,12 @@ func mergeSummary(mf1 *dto.Metric, mf2 *dto.Metric) {

type MetricMap struct {
metrics map[string][]*Metric
lock sync.Mutex
lock sync.Mutex
}

type Metric struct {
metric dto.Metric
lock sync.Mutex
metric dto.Metric
lock sync.Mutex
}

func NewMetricMap() MetricMap {
Expand Down

0 comments on commit 148c1e7

Please sign in to comment.