DataDog / kafka-kit

Kafka storage rebalancing, automated replication throttle, cluster API and more
Apache License 2.0
488 stars 54 forks source link

jamie/kafkaadmin #392

Closed jamiealquiza closed 2 years ago

jamiealquiza commented 2 years ago

kafkaadmin

Adds and implements the following kafkaadmin interface methods:

SetThrottle(context.Context, ThrottleConfig) error
RemoveThrottle(context.Context, RemoveThrottleConfig) error
GetDynamicConfigs(context.Context, string, []string) (ResourceConfigs, error)

SetThrottle allows per-broker inbound and outbound throttle rates. Example request:

config := kafkaadmin.SetThrottleConfig{
  // Specify what topics will have throttled brokers.
  Topics: []string{
    "test1",
    "test2",
  },
  // Specify broker throttles.
  Brokers: map[int]kafkaadmin.BrokerThrottleConfig{
    1003: {
      InboundLimitBytes:  2000,
      OutboundLimitBytes: 4000,
    },
    1004: {
      InboundLimitBytes:  2000,
      OutboundLimitBytes: 4000,
    },
  },
}

// Apply.
err := k.SetThrottle(ctx, config)

Tested working.