Skip to content

Commit

Permalink
kafka - don't scale beyond number of partitions
Browse files Browse the repository at this point in the history
Former-commit-id: 3656c06
  • Loading branch information
yaron2 committed May 6, 2019
1 parent fb9366c commit 93a600e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/scalers/kafka_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ func (s *kafkaScaler) GetMetrics(ctx context.Context, merticName string, metricS
totalLag += lag
}

// We should find a way to not scale beyond the number of partitions
// don't scale out beyond the number of partitions
if (totalLag / s.metadata.lagThreshold) > int64(len(partitions)) {
totalLag = int64(len(partitions)) * s.metadata.lagThreshold
}

metric := external_metrics.ExternalMetricValue{
MetricName: merticName,
Value: *resource.NewQuantity(int64(totalLag), resource.DecimalSI),
Expand Down

0 comments on commit 93a600e

Please sign in to comment.