Skip to content

Commit

Permalink
typo: fix some typo
Browse files Browse the repository at this point in the history
  • Loading branch information
googs1025 committed Feb 14, 2024
1 parent 4da3a5b commit 7b07557
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions pkg/fallback/fallback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ var _ = Describe("fallback", func() {
})

It("should propagate the error when fallback is disabled", func() {
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error"))
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error"))

so := buildScaledObject(nil, nil)
metricSpec := createMetricSpec(3)
Expand All @@ -124,7 +124,7 @@ var _ = Describe("fallback", func() {
})

It("should bump the number of failures when metrics call fails", func() {
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error"))
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error"))
startingNumberOfFailures := int32(0)

so := buildScaledObject(
Expand Down Expand Up @@ -154,7 +154,7 @@ var _ = Describe("fallback", func() {
})

It("should return a normalised metric when number of failures are beyond threshold", func() {
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error"))
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error"))
startingNumberOfFailures := int32(3)
expectedMetricValue := float64(100)

Expand Down Expand Up @@ -207,7 +207,7 @@ var _ = Describe("fallback", func() {
})

It("should ignore error if we fail to update kubernetes status", func() {
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error"))
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error"))
startingNumberOfFailures := int32(3)
expectedMetricValue := float64(100)

Expand All @@ -228,7 +228,7 @@ var _ = Describe("fallback", func() {
metricSpec := createMetricSpec(10)

statusWriter := mock_client.NewMockStatusWriter(ctrl)
statusWriter.EXPECT().Patch(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("Some error"))
statusWriter.EXPECT().Patch(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.New("some error"))
client.EXPECT().Status().Return(statusWriter)

metrics, _, err := scaler.GetMetricsAndActivity(context.Background(), metricName)
Expand All @@ -241,7 +241,7 @@ var _ = Describe("fallback", func() {
})

It("should return error when fallback is enabled but scaledobject has invalid parameter", func() {
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error"))
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error"))
startingNumberOfFailures := int32(3)

so := buildScaledObject(
Expand Down Expand Up @@ -269,7 +269,7 @@ var _ = Describe("fallback", func() {
})

It("should set the fallback condition when a fallback exists in the scaled object", func() {
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error"))
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error"))
startingNumberOfFailures := int32(3)
failingNumberOfFailures := int32(6)
anotherMetricName := "another metric name"
Expand Down Expand Up @@ -303,7 +303,7 @@ var _ = Describe("fallback", func() {
})

It("should set the fallback condition to false if the config is invalid", func() {
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("Some error"))
scaler.EXPECT().GetMetricsAndActivity(gomock.Any(), gomock.Eq(metricName)).Return(nil, false, errors.New("some error"))
startingNumberOfFailures := int32(3)
failingNumberOfFailures := int32(6)
anotherMetricName := "another metric name"
Expand Down
4 changes: 2 additions & 2 deletions pkg/metricscollector/opentelemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (o *OtelMetrics) RecordCloudEventEmitted(namespace string, cloudeventsource
otCloudEventEmittedCounter.Add(context.Background(), 1, opt)
}

// RecordCloudEventEmitted counts the number of errors occurred in trying emit cloudevent
// RecordCloudEventEmittedError counts the number of errors occurred in trying emit cloudevent
func (o *OtelMetrics) RecordCloudEventEmittedError(namespace string, cloudeventsource string, eventsink string) {
opt := api.WithAttributes(
attribute.Key("namespace").String(namespace),
Expand All @@ -398,7 +398,7 @@ func CloudeventQueueStatusCallback(_ context.Context, obsrv api.Float64Observer)
return nil
}

// RecordCloudEventSourceQueueStatus record the number of cloudevents that are waiting for emitting
// RecordCloudEventQueueStatus record the number of cloudevents that are waiting for emitting
func (o *OtelMetrics) RecordCloudEventQueueStatus(namespace string, value int) {
opt := api.WithAttributes(
attribute.Key("namespace").String(namespace),
Expand Down
2 changes: 1 addition & 1 deletion pkg/metricscollector/prommetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func (p *PromMetrics) RecordCloudEventEmittedError(namespace string, cloudevents
cloudeventEmitted.With(labels).Inc()
}

// RecordCloudEventSourceQueueStatus record the number of cloudevents that are waiting for emitting
// RecordCloudEventQueueStatus record the number of cloudevents that are waiting for emitting
func (p *PromMetrics) RecordCloudEventQueueStatus(namespace string, value int) {
cloudeventQueueStatus.With(prometheus.Labels{"namespace": namespace}).Set(float64(value))
}

0 comments on commit 7b07557

Please sign in to comment.