Skip to content

Commit d82be73

Browse files
authored
Merge pull request #137 from googs1025/fix_typo
fix some typo and variable name
2 parents 7a27bc5 + 312ff4c commit d82be73

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

pkg/collector/labels.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (l Labeler) SetLabelsForQuota(labels *LabelsValues,
6868
l.Extension.SetLabelsForQuota(&labels.Extension, quota, rqd, namespace)
6969
}
7070

71-
// SetLabelsForNamespace parses metric labels from a namespace
71+
// SetLabelsForNamespaces parses metric labels from a namespace
7272
func (l Labeler) SetLabelsForNamespaces(labels *LabelsValues, namespace *corev1.Namespace) {
7373
l.BuiltIn.SetLabelsForNamespace(&labels.BuiltIn, namespace)
7474
l.Extension.SetLabelsForNamespace(&labels.Extension, namespace)

pkg/collector/utilization/sampler_collector.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func init() {
8585
}
8686

8787
type Server struct {
88-
ResponseMutext sync.RWMutex
88+
ResponseMutex sync.RWMutex
8989

9090
// Responses has the last response for each node keyed by the node name
9191
Responses map[string]*api.ListMetricsResponse `json:"responses" yaml:"responses"`
@@ -106,7 +106,7 @@ type Server struct {
106106
grpcServer *grpc.Server
107107
}
108108

109-
func (c *Server) Collect(ch chan<- prometheus.Metric, metrics map[string]*api.ListMetricsResponse) {
109+
func (s *Server) Collect(ch chan<- prometheus.Metric, metrics map[string]*api.ListMetricsResponse) {
110110
responseAgeSeconds.Reset()
111111
for _, v := range metrics {
112112
responseAgeSeconds.WithLabelValues(v.NodeName, v.PodName, v.Reason).Set(
@@ -246,7 +246,7 @@ func (s *Server) Check(ctx context.Context, _ *grpc_health_v1.HealthCheckRequest
246246
return &grpc_health_v1.HealthCheckResponse{Status: grpc_health_v1.HealthCheckResponse_SERVING}, nil
247247
}
248248

249-
// Ready returns success if the service should be accepting traffic
249+
// IsReady returns success if the service should be accepting traffic
250250
func (s *Server) IsReady(context.Context, *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error) {
251251
if !s.IsReadyResult.Load() {
252252
return &grpc_health_v1.HealthCheckResponse{Status: grpc_health_v1.HealthCheckResponse_NOT_SERVING}, fmt.Errorf("not-ready")
@@ -317,7 +317,7 @@ func (s *Server) PushMetrics(req api.MetricsCollector_PushMetricsServer) error {
317317

318318
// GetContainerUsageSummary maps containers to their cached metric values. metrics are passed as an argument to
319319
// reduce lock contention.
320-
func (c *Server) GetContainerUsageSummary(metrics map[string]*api.ListMetricsResponse) map[sampler.ContainerKey]*api.ContainerMetrics {
320+
func (s *Server) GetContainerUsageSummary(metrics map[string]*api.ListMetricsResponse) map[sampler.ContainerKey]*api.ContainerMetrics {
321321
// Transform map of node -> utilization to map of container -> utilization by pulling the containers
322322
// out of each node response
323323
var values = map[sampler.ContainerKey]*api.ContainerMetrics{}
@@ -373,8 +373,8 @@ func (s *Server) GetMetrics() map[string]*api.ListMetricsResponse {
373373
func (s *Server) GetNodeNames() sets.String {
374374
nodes := sets.NewString()
375375
func() {
376-
s.ResponseMutext.Lock()
377-
defer s.ResponseMutext.Unlock()
376+
s.ResponseMutex.Lock()
377+
defer s.ResponseMutex.Unlock()
378378
for k, v := range s.Responses {
379379
if time.Since(v.Timestamp.AsTime()) > s.ttl {
380380
continue
@@ -389,8 +389,8 @@ func (s *Server) GetNodeNames() sets.String {
389389
func (s *Server) getMetrics(filterExpired bool) map[string]*api.ListMetricsResponse {
390390
values := make(map[string]*api.ListMetricsResponse, len(s.Responses))
391391
func() {
392-
s.ResponseMutext.Lock()
393-
defer s.ResponseMutext.Unlock()
392+
s.ResponseMutex.Lock()
393+
defer s.ResponseMutex.Unlock()
394394
for k, v := range s.Responses {
395395
values[k] = v
396396
}
@@ -411,14 +411,14 @@ func (s *Server) getMetrics(filterExpired bool) map[string]*api.ListMetricsRespo
411411

412412
// ClearMetrics deletes the metrics with the given key from the cache
413413
func (s *Server) ClearMetrics(key string) {
414-
s.ResponseMutext.Lock()
415-
defer s.ResponseMutext.Unlock()
414+
s.ResponseMutex.Lock()
415+
defer s.ResponseMutex.Unlock()
416416
delete(s.Responses, key)
417417
}
418418

419419
// CacheMetrics caches msg
420420
func (s *Server) CacheMetrics(msg *api.ListMetricsResponse) {
421-
s.ResponseMutext.Lock()
422-
defer s.ResponseMutext.Unlock()
421+
s.ResponseMutex.Lock()
422+
defer s.ResponseMutex.Unlock()
423423
s.Responses[msg.NodeName] = msg
424424
}

pkg/testutil/fakeclient.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (fc FakeContainer) Info(context.Context, ...containerd.InfoOpts) (container
148148
return fc.UnderlyingContainer, nil
149149
}
150150

151-
// Task() returns the fake container task
151+
// Task returns the fake container task
152152
func (fc FakeContainer) Task(context.Context, cio.Attach) (containerd.Task, error) {
153153
return &fc.FakeTask, nil
154154
}

pkg/testutil/testutil.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ func (tc TestCase) GetObjects(s *runtime.Scheme) ([]client.Object, []client.Obje
549549
return objs, objList, nil
550550
}
551551

552-
// GetObjects parses the input objects from the test case
552+
// GetObjectsFromFile parses the input objects from the test case
553553
func (tc TestCase) GetObjectsFromFile(js *sjson.Serializer, s *runtime.Scheme, filename, data string) ([]client.Object, []client.ObjectList, error) {
554554
var objs []client.Object
555555
var objLists []client.ObjectList

0 commit comments

Comments
 (0)