-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Modify Default Producer Compression Type
- Loading branch information
Showing
7 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2024 Redpanda Data, Inc. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file https://github.com/redpanda-data/redpanda/blob/dev/licenses/bsl.md | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0 | ||
|
||
package api | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/cloudhut/common/rest" | ||
"go.uber.org/zap" | ||
) | ||
|
||
// handleGetProducerCompressionType returns the default producer compression type | ||
func (api *API) handleGetProducerCompressionType() http.HandlerFunc { | ||
type response struct { | ||
ProducerCompressionType string `json:"producerCompressionType"` | ||
} | ||
|
||
return func(w http.ResponseWriter, r *http.Request) { | ||
producerCompressionType := api.Cfg.Kafka.PComp.Value | ||
logger := api.Logger.With(zap.String("producer_compression_type", producerCompressionType)) | ||
|
||
rest.SendResponse(w, r, logger, http.StatusOK, &response{ | ||
ProducerCompressionType: producerCompressionType, | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2024 Redpanda Data, Inc. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.md | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0 | ||
|
||
package config | ||
|
||
// PComp represents the producer compression type default. | ||
type PComp struct { | ||
Value string `yaml:"value"` | ||
} | ||
|
||
// SetDefaults for the producer compression type configuration. | ||
func (c *PComp) SetDefaults() { | ||
c.Value = "snappy" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters