Skip to content

Commit

Permalink
Fork github.com/asecurityteam/loadshed
Browse files Browse the repository at this point in the history
This matches the latest release of github.com/asecurityteam/loadshed
except that the imports for github.com/asecurityteam/rolling are
replaced with a fork of that library.
  • Loading branch information
kevinconway committed Jan 12, 2024
1 parent ce5293b commit 04ddacc
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ var transport = loadshedtransport.New(

### Aggregator

The Aggregator enables injection of custom metrics that are not already included in this package. The option relies on the Aggregator interface provided by github.com/asecurityteam/rolling and the given aggregator must return a value that is a percentage of requests to reject between 0.0 and 1.0.
The Aggregator enables injection of custom metrics that are not already included in this package. The option relies on the Aggregator interface provided by github.com/kevinconway/rolling and the given aggregator must return a value that is a percentage of requests to reject between 0.0 and 1.0.

```golang
// Inject a random amount of chaos when the system is not under load.
Expand Down
4 changes: 2 additions & 2 deletions concurrency.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync"
"sync/atomic"

"github.com/asecurityteam/rolling"
"github.com/kevinconway/rolling"
)

// WaitGroup wraps a sync.WaitGroup to make it usable as a load shedding tool.
Expand All @@ -15,7 +15,7 @@ type WaitGroup struct {

// NewWaitGroup generates a specialised WaitGroup that tracks the number of
// concurrent operations. This implementation also satisfies the Aggregator
// interface from github.com/asecurityteam/rolling so that this can be fed into
// interface from github.com/kevinconway/rolling so that this can be fed into
// a calculation of system health.
func NewWaitGroup() *WaitGroup {
var w = &WaitGroup{
Expand Down
2 changes: 1 addition & 1 deletion cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package loadshed
import (
"time"

"github.com/asecurityteam/rolling"
"github.com/kevinconway/rolling"
pscpu "github.com/shirou/gopsutil/cpu"
)

Expand Down
2 changes: 1 addition & 1 deletion cpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/asecurityteam/rolling"
"github.com/kevinconway/rolling"
)

func TestCPU(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion errorrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package loadshed
import (
"fmt"

"github.com/asecurityteam/rolling"
"github.com/kevinconway/rolling"
)

// errRate is a struct representing the different feeders and aggregators to calculate error rate
Expand Down
2 changes: 1 addition & 1 deletion errorrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/asecurityteam/rolling"
"github.com/kevinconway/rolling"
)

func TestErrorRateNoError(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package loadshed
import (
"fmt"

"github.com/asecurityteam/rolling"
"github.com/kevinconway/rolling"
)

// Rejected is error returned when a request is rejected because of load shedding
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/asecurityteam/loadshed
module github.com/kevinconway/loadshed

go 1.12

require (
github.com/asecurityteam/rolling v0.0.0-20171031124617-6011875bcfaf
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/kevinconway/rolling v1.0.0
github.com/shirou/gopsutil v0.0.0-20190731134726-d80c43f9c984
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 // indirect
)
7 changes: 5 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8=
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/asecurityteam/rolling v0.0.0-20171031124617-6011875bcfaf h1:PxQPQyJ+I7UzghgRC8TlRGldFGRgJ/NB4DAoQF0Cs8U=
github.com/asecurityteam/rolling v0.0.0-20171031124617-6011875bcfaf/go.mod h1:2D4ba5ZfYCWrIMleUgTvc8pmLExEuvu3PDwl+vnG58Q=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/kevinconway/rolling v1.0.0 h1:B+m6I03UDYe3Efu30PJufjCOr8065BRwCMAZg6BHwvc=
github.com/kevinconway/rolling v1.0.0/go.mod h1:44JA4JzBoc06020WuNUK/NTjNWqaAc6B8ZoBJuM8LN4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/shirou/gopsutil v0.0.0-20190731134726-d80c43f9c984 h1:wsZAb4P8F7uQSwsnxE1gk9AHCcc5U0wvyDzcLwFY0Eo=
github.com/shirou/gopsutil v0.0.0-20190731134726-d80c43f9c984/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc=
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0=
Expand Down
2 changes: 1 addition & 1 deletion latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package loadshed
import (
"time"

"github.com/asecurityteam/rolling"
"github.com/kevinconway/rolling"
)

type latencyDecorator struct {
Expand Down
2 changes: 1 addition & 1 deletion latency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/asecurityteam/rolling"
"github.com/kevinconway/rolling"
)

func TestLatencyDecorator(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion loadshed.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"math/rand"
"time"

"github.com/asecurityteam/rolling"
"github.com/kevinconway/rolling"
)

// Doer is an interface representing load shedding interface with Do method
Expand Down
2 changes: 1 addition & 1 deletion loadshed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/asecurityteam/rolling"
"github.com/kevinconway/rolling"
)

func TestCPUOption(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions wrappers/middleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"net/http"

"github.com/asecurityteam/loadshed"
"github.com/asecurityteam/rolling"
"github.com/kevinconway/loadshed"
"github.com/kevinconway/rolling"
)

// Option is a wrapper for middleware
Expand Down
2 changes: 1 addition & 1 deletion wrappers/middleware/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sync/atomic"
"testing"

"github.com/asecurityteam/loadshed"
"github.com/kevinconway/loadshed"
)

func TestMiddleware(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions wrappers/transport/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"net/http"

"github.com/asecurityteam/loadshed"
"github.com/asecurityteam/rolling"
"github.com/kevinconway/loadshed"
"github.com/kevinconway/rolling"
)

// Option is a wrapper around the transport modifying its behavior
Expand Down
2 changes: 1 addition & 1 deletion wrappers/transport/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"
"time"

"github.com/asecurityteam/loadshed"
"github.com/kevinconway/loadshed"
)

type fixtureTransport struct {
Expand Down

0 comments on commit 04ddacc

Please sign in to comment.