Skip to content

Commit

Permalink
Merge pull request #402 from DataDog/jamie/kafka-kit-v4
Browse files Browse the repository at this point in the history
jamie/kafka-kit-v4
  • Loading branch information
jamiealquiza committed May 17, 2022
2 parents 0acb4f8 + 1d2f764 commit b096c6f
Show file tree
Hide file tree
Showing 82 changed files with 935 additions and 909 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ COPY cluster cluster
COPY kafkaadmin kafkaadmin
COPY kafkametrics kafkametrics
COPY kafkazk kafkazk
COPY mapper mapper
COPY registry registry

# Codegen
Expand Down
2 changes: 1 addition & 1 deletion cluster/zookeeper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"syscall"
"time"

zklocking "github.com/DataDog/kafka-kit/v3/cluster/zookeeper"
zklocking "github.com/DataDog/kafka-kit/v4/cluster/zookeeper"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion cluster/zookeeper/zookeeper-example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"syscall"
"time"

zklocking "github.com/DataDog/kafka-kit/v3/cluster/zookeeper"
zklocking "github.com/DataDog/kafka-kit/v4/cluster/zookeeper"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/autothrottle/brokers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"sort"
"strconv"

"github.com/DataDog/kafka-kit/v3/kafkametrics"
"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/kafkametrics"
"github.com/DataDog/kafka-kit/v4/kafkazk"
)

// reassigningBrokers holds several sets of brokers participating
Expand Down
4 changes: 2 additions & 2 deletions cmd/autothrottle/brokers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"sort"
"testing"

"github.com/DataDog/kafka-kit/v3/kafkametrics"
"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/kafkametrics"
"github.com/DataDog/kafka-kit/v4/kafkazk"
)

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

"github.com/DataDog/kafka-kit/v3/kafkametrics"
"github.com/DataDog/kafka-kit/v4/kafkametrics"
)

// replicationCapacityByBroker is a mapping of broker ID to capacity.
Expand Down
2 changes: 1 addition & 1 deletion cmd/autothrottle/capacities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"testing"

"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/kafkazk"
)

func TestBrokerReplicationCapacities(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/autothrottle/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/DataDog/kafka-kit/v3/kafkametrics"
"github.com/DataDog/kafka-kit/v4/kafkametrics"
)

// Events configs.
Expand Down
4 changes: 2 additions & 2 deletions cmd/autothrottle/internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"sort"
"strconv"

"github.com/DataDog/kafka-kit/v3/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v4/kafkazk"
)

// APIConfig holds configuration params for the admin API.
Expand Down
2 changes: 1 addition & 1 deletion cmd/autothrottle/internal/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http/httptest"
"testing"

"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/kafkazk"
)

func TestSetThrottle(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/autothrottle/internal/throttlestore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"strconv"

"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/kafkazk"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/autothrottle/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"math"

"github.com/DataDog/kafka-kit/v3/kafkametrics"
"github.com/DataDog/kafka-kit/v4/kafkametrics"
)

// Limits is a map of instance-type to network bandwidth limits.
Expand Down
2 changes: 1 addition & 1 deletion cmd/autothrottle/limits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"testing"

"github.com/DataDog/kafka-kit/v3/kafkametrics"
"github.com/DataDog/kafka-kit/v4/kafkametrics"
)

func TestNewLimits(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions cmd/autothrottle/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"strings"
"time"

"github.com/DataDog/kafka-kit/v3/cmd/autothrottle/internal/api"
"github.com/DataDog/kafka-kit/v3/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v3/kafkametrics"
"github.com/DataDog/kafka-kit/v3/kafkametrics/datadog"
"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/cmd/autothrottle/internal/api"
"github.com/DataDog/kafka-kit/v4/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v4/kafkametrics"
"github.com/DataDog/kafka-kit/v4/kafkametrics/datadog"
"github.com/DataDog/kafka-kit/v4/kafkazk"

"github.com/jamiealquiza/envy"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/autothrottle/throttle_update_legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"
"time"

"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/kafkazk"
)

func (tm *ThrottleManager) legacyApplyBrokerThrottles(configs map[int]kafkazk.KafkaConfig, capacities replicationCapacityByBroker) (chan brokerChangeEvent, []error) {
Expand Down
8 changes: 4 additions & 4 deletions cmd/autothrottle/throttles.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"time"

"github.com/DataDog/kafka-kit/v3/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v3/kafkaadmin"
"github.com/DataDog/kafka-kit/v3/kafkametrics"
"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v4/kafkaadmin"
"github.com/DataDog/kafka-kit/v4/kafkametrics"
"github.com/DataDog/kafka-kit/v4/kafkazk"
)

// ThrottleManager manages Kafka throttle rates.
Expand Down
10 changes: 5 additions & 5 deletions cmd/autothrottle/throttles_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
"strconv"
"strings"

"github.com/DataDog/kafka-kit/v3/cmd/autothrottle/internal/api"
"github.com/DataDog/kafka-kit/v3/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v3/kafkaadmin"
"github.com/DataDog/kafka-kit/v3/kafkametrics"
"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/cmd/autothrottle/internal/api"
"github.com/DataDog/kafka-kit/v4/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v4/kafkaadmin"
"github.com/DataDog/kafka-kit/v4/kafkametrics"
"github.com/DataDog/kafka-kit/v4/kafkazk"
)

// brokerChangeEvent is the message type returned in the events channel from the
Expand Down
6 changes: 3 additions & 3 deletions cmd/autothrottle/topics_legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package main
import (
"strconv"

"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/mapper"
)

// TopicStates is a map of topic names to kafakzk.TopicState.
type TopicStates map[string]kafkazk.TopicState
type TopicStates map[string]mapper.TopicState

// legacyGetTopicsWithThrottledBrokers returns a topicThrottledReplicas that
// includes any topics that have partitions assigned to brokers with a static
Expand Down Expand Up @@ -81,7 +81,7 @@ func (tm *ThrottleManager) legacyGetAllTopicStates() (TopicStates, error) {
remove all the deprecated bits.
// TopicStatesFilterFn specifies a filter function.
type TopicStatesFilterFn func(kafkazk.TopicState) bool
type TopicStatesFilterFn func(mapper.TopicState) bool
// Filter takes a TopicStatesFilterFn and returns a TopicStates where
// all elements return true as an input to the filter func.
Expand Down
6 changes: 3 additions & 3 deletions cmd/autothrottle/topics_legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"testing"

"github.com/DataDog/kafka-kit/v3/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v4/kafkazk"
)

func TestLegacyGetTopicsWithThrottledBrokers(t *testing.T) {
Expand Down Expand Up @@ -71,7 +71,7 @@ func TestFilter(t *testing.T) {
matchID := 1000
// Our filter func. returns any topic that includes matchID as a replica.
fn := func(ts kafkazk.TopicState) bool {
fn := func(ts mapper.TopicState) bool {
// The stub partition state here is []int{1000,1001}.
for _, id := range ts.Partitions["0"] {
if id == matchID {
Expand Down
4 changes: 2 additions & 2 deletions cmd/autothrottle/topics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"testing"

"github.com/DataDog/kafka-kit/v3/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v3/kafkaadmin/stub"
"github.com/DataDog/kafka-kit/v4/cmd/autothrottle/internal/throttlestore"
"github.com/DataDog/kafka-kit/v4/kafkaadmin/stub"
)

func TestAddReplica(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/metricsfetcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"fmt"
"os"

"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v4/kafkazk"

"github.com/jamiealquiza/envy"
dd "github.com/zorkian/go-datadog-api"
Expand Down
6 changes: 3 additions & 3 deletions cmd/registry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"syscall"
"time"

"github.com/DataDog/kafka-kit/v3/kafkaadmin"
"github.com/DataDog/kafka-kit/v3/kafkazk"
"github.com/DataDog/kafka-kit/v3/registry/server"
"github.com/DataDog/kafka-kit/v4/kafkaadmin"
"github.com/DataDog/kafka-kit/v4/kafkazk"
"github.com/DataDog/kafka-kit/v4/registry/server"

"github.com/Masterminds/semver"
"github.com/jamiealquiza/envy"
Expand Down
Loading

0 comments on commit b096c6f

Please sign in to comment.