Skip to content

Commit

Permalink
upgrade dependencies (#37)
Browse files Browse the repository at this point in the history
* upgrade to go 1.17

* upgrade giantswarm/micro*

* upgrade giantswarm/architect 0.7.0 to 4.8.1

* fix linter: Error return value of `hv.Add` is not checked (errcheck)

* fix linter: unnecessary assignment to the blank identifier (gosimple)

* fix linter: redundant `return` statement (gosimple)

* fix linter: os.Kill cannot be trapped (did you mean syscall.SIGTERM?) (staticcheck)
  • Loading branch information
TheoBrigitte authored Dec 16, 2021
1 parent 8371883 commit f4cd16b
Show file tree
Hide file tree
Showing 8 changed files with 725 additions and 242 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1

orbs:
architect: giantswarm/architect@0.7.0
architect: giantswarm/architect@4.8.1

workflows:
test:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Replace SIGKILL with SIGTERM signal
- Upgrade to Go 1.17
- Upgrade github.com/giantswarm/microendpoint v0.2.0 to v1.0.0
- Upgrade github.com/giantswarm/microerror v0.3.0 to v0.4.0
- Upgrade github.com/giantswarm/microkit v0.2.2 to v1.0.0
- Upgrade github.com/giantswarm/micrologger v0.5.0 to v0.6.0
- Upgrade github.com/prometheus/client_golang v1.9.0 to v1.11.0
- Upgrade golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e to v0.0.0-20210220032951-036812b2e83c
- Upgrade github.com/giantswarm/architect-orb v0.7.0 to v4.8.1

## [0.2.1] 2021-02-08

### Added
Expand Down
2 changes: 0 additions & 2 deletions collector/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ func (s *Set) Stop(ctx context.Context) {
}

s.logger.LogCtx(ctx, "level", "debug", "message", "stopped collector")

return
}

func (s *Set) Collect(ch chan<- prometheus.Metric) {
Expand Down
3 changes: 2 additions & 1 deletion exporterkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/signal"
"sync"
"syscall"

"github.com/giantswarm/microendpoint/endpoint/healthz"
"github.com/giantswarm/microerror"
Expand Down Expand Up @@ -89,7 +90,7 @@ func (e *Exporter) Run() {
go newServer.Boot()

listener := make(chan os.Signal, 2)
signal.Notify(listener, os.Interrupt, os.Kill)
signal.Notify(listener, os.Interrupt, syscall.SIGTERM)

<-listener

Expand Down
45 changes: 38 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
module github.com/giantswarm/exporterkit

go 1.13
go 1.17

require (
github.com/giantswarm/microendpoint v0.2.0
github.com/giantswarm/microerror v0.3.0
github.com/giantswarm/microkit v0.2.2
github.com/giantswarm/micrologger v0.5.0
github.com/prometheus/client_golang v1.9.0
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
github.com/giantswarm/microendpoint v1.0.0
github.com/giantswarm/microerror v0.4.0
github.com/giantswarm/microkit v1.0.0
github.com/giantswarm/micrologger v0.6.0
github.com/prometheus/client_golang v1.11.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.30.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.10.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
golang.org/x/sys v0.0.0-20211214170744-3b038e5940ed // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
856 changes: 633 additions & 223 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion histogram/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (h *Histogram) Add(x float64) {
h.count++
h.sum += x

for bucket, _ := range h.buckets {
for bucket := range h.buckets {
if x <= bucket {
h.buckets[bucket]++
}
Expand Down
45 changes: 38 additions & 7 deletions histogramvec/histogramvec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func Example() {

// Add the samples to the HistogramVec.
for _, s := range firstSamples {
hv.Add(s.StoreName, s.Temperature)
_ = hv.Add(s.StoreName, s.Temperature)
}

// Emit each metric, such as in a Prometheus Collector.
Expand Down Expand Up @@ -74,7 +74,7 @@ func Example() {

// Add the second set of sample to the HistogramVec.
for _, s := range secondSamples {
hv.Add(s.StoreName, s.Temperature)
_ = hv.Add(s.StoreName, s.Temperature)
}

// Ensure that any stores that have shut down are removed from the HistogramVec.
Expand Down Expand Up @@ -320,7 +320,7 @@ func Test_Ensure(t *testing.T) {
hs := hv.Histograms()

returnedLabels := []string{}
for label, _ := range hs {
for label := range hs {
returnedLabels = append(returnedLabels, label)
}

Expand All @@ -341,17 +341,32 @@ func Test_Concurrency(t *testing.T) {
t.Fatalf("expected nil, got %v", err)
}

var done = make(chan bool)
var errors = make(chan error)
var wg sync.WaitGroup
for i := 0; i < 1000; i++ {
wg.Add(1)
go func() {
defer wg.Done()
hv.Add("foo", 1)
err := hv.Add("foo", 1)
if err != nil {
errors <- err
}
hv.Ensure([]string{})
}()
}

wg.Wait()
go func() {
wg.Wait()
close(done)
}()

select {
case <-done:
break
case err := <-errors:
t.Fatalf("goroutine error : %v", err)
}
}

// Test_Multi_Write_Iteration_Concurrency tests that concurrent reading and
Expand All @@ -365,14 +380,19 @@ func Test_Multi_Write_Iteration_Concurrency(t *testing.T) {
t.Fatalf("expected nil, got %v", err)
}

var done = make(chan bool)
var errors = make(chan error)
var writeWaitGroup sync.WaitGroup
for i := 0; i < 1000; i++ {
writeWaitGroup.Add(1)

go func(i int) {
defer writeWaitGroup.Done()

hv.Add(fmt.Sprintf("%v", i), float64(i))
err := hv.Add(fmt.Sprintf("%v", i), float64(i))
if err != nil {
errors <- err
}
}(i)
}

Expand All @@ -388,6 +408,17 @@ func Test_Multi_Write_Iteration_Concurrency(t *testing.T) {
}()
}

writeWaitGroup.Wait()
go func() {
writeWaitGroup.Wait()
close(done)
}()

select {
case <-done:
break
case err := <-errors:
t.Fatalf("goroutine error : %v", err)
}

iterateWaitGroup.Wait()
}

0 comments on commit f4cd16b

Please sign in to comment.