Skip to content

Commit

Permalink
fix: pass by reference
Browse files Browse the repository at this point in the history
Signed-off-by: Soumya Ghosh Dastidar <[email protected]>
  • Loading branch information
gdsoumya committed Nov 9, 2024
1 parent ef96407 commit 7f66f49
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.22.0
go-version: 1.20.0

# Checkout to the latest commit
# On specific directory/path
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.22.0
go-version: 1.20.0

# Checkout to the latest commit
# On specific directory/path
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.22.0
go-version: 1.20.0

# Checkout to the latest commit
# On specific directory/path
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
# Install golang
- uses: actions/setup-go@v2
with:
go-version: 1.22.0
go-version: 1.20.0

# Checkout to the latest commit
# On specific directory/path
Expand Down
2 changes: 1 addition & 1 deletion controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func Exporter(clientSet clients.ClientSets, wq workqueue.RateLimitingInterface)
// refresh metrics whenever there's a change in chaosengine or chaosresult
// or every informer resync duration, whichever is earlier
for _, done := wq.Get(); !done; _, done = wq.Get() {
needRequeue, err := r.GetLitmusChaosMetrics(clientSet, overallChaosResults, &monitoringEnabled)
needRequeue, err := r.GetLitmusChaosMetrics(clientSet, &overallChaosResults, &monitoringEnabled)
if err != nil {
log.Errorf("err: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion controller/scrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestGetLitmusChaosMetrics(t *testing.T) {
tt.execFunc()

client := CreateFakeClient(t)
_, err := r.GetLitmusChaosMetrics(client, tt.overallChaosResult, tt.monitoring)
_, err := r.GetLitmusChaosMetrics(client, &tt.overallChaosResult, tt.monitoring)
if tt.isErr {
require.Error(t, err)
return
Expand Down
6 changes: 3 additions & 3 deletions controller/scrape.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
var err error

// GetLitmusChaosMetrics derive and send the chaos metrics
func (m *MetricesCollecter) GetLitmusChaosMetrics(clients clients.ClientSets, overallChaosResults []*litmuschaosv1alpha1.ChaosResult, monitoringEnabled *MonitoringEnabled) (*time.Duration, error) {
func (m *MetricesCollecter) GetLitmusChaosMetrics(clients clients.ClientSets, overallChaosResults *[]*litmuschaosv1alpha1.ChaosResult, monitoringEnabled *MonitoringEnabled) (*time.Duration, error) {
engineCount := 0

// initialising the parameters for the namespaced scope metrics
Expand All @@ -59,9 +59,9 @@ func (m *MetricesCollecter) GetLitmusChaosMetrics(clients clients.ClientSets, ov
return nil, err
}
// unset the metrics correspond to deleted chaosresults
m.GaugeMetrics.unsetDeletedChaosResults(overallChaosResults, resultList)
m.GaugeMetrics.unsetDeletedChaosResults(*overallChaosResults, resultList)
// updating the overall chaosresults items to latest
overallChaosResults = resultList
*overallChaosResults = resultList

var needRequeue *time.Duration

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/litmuschaos/chaos-exporter

go 1.22
go 1.20

require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4er
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
Expand Down Expand Up @@ -834,7 +833,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
Expand Down

0 comments on commit 7f66f49

Please sign in to comment.