Skip to content

Commit

Permalink
feat: use compression types for ProxyPrometheusProvider
Browse files Browse the repository at this point in the history
Signed-off-by: zufardhiyaulhaq <zufardhiyaulhaq@gmail.com>
  • Loading branch information
zufardhiyaulhaq committed Apr 15, 2024
1 parent 11ecc75 commit d26052a
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 321 deletions.
9 changes: 3 additions & 6 deletions api/v1alpha1/envoyproxy_metric_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ type ProxyOpenTelemetrySink struct {
type ProxyPrometheusProvider struct {
// Disable the Prometheus endpoint.
Disable bool `json:"disable,omitempty"`
// Enable the compression on Prometheus endpoint.
EnableCompression bool `json:"enableCompression,omitempty"`
// Compression type
// +kubebuilder:validation:Enum=gzip;brotli;zstd
// +kubebuilder:default=gzip
CompressionLibrary string `json:"compressionLibrary,omitempty"`
// Configure the compression on Prometheus endpoint.
// +optional
Compression *Compression `json:"compression,omitempty"`
}
7 changes: 6 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6227,20 +6227,24 @@ spec:
description: Prometheus defines the configuration for Admin
endpoint `/stats/prometheus`.
properties:
compressionLibrary:
default: gzip
description: Compression type
enum:
- gzip
- brotli
- zstd
type: string
compression:
description: Configure the compression on Prometheus endpoint.
properties:
gzip:
description: The configuration for GZIP compressor.
type: object
type:
description: CompressorType defines the compressor
type to use for compression.
enum:
- Gzip
type: string
required:
- type
type: object
disable:
description: Disable the Prometheus endpoint.
type: boolean
enableCompression:
description: Enable the compression on Prometheus endpoint.
type: boolean
type: object
sinks:
description: Sinks defines the metric sinks where metrics
Expand Down
6 changes: 3 additions & 3 deletions internal/xds/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ func GetRenderedBootstrapConfig(opts *RenderBootsrapConfigOptions) (string, erro

if proxyMetrics.Prometheus != nil {
enablePrometheus = !proxyMetrics.Prometheus.Disable
enablePrometheusCompression = proxyMetrics.Prometheus.EnableCompression

if proxyMetrics.Prometheus.EnableCompression {
PrometheusCompressionLibrary = proxyMetrics.Prometheus.CompressionLibrary
if proxyMetrics.Prometheus.Compression != nil {
enablePrometheusCompression = true
PrometheusCompressionLibrary = string(proxyMetrics.Prometheus.Compression.Type)
}
}

Expand Down
27 changes: 3 additions & 24 deletions internal/xds/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,9 @@ func TestGetRenderedBootstrapConfig(t *testing.T) {
opts: &RenderBootsrapConfigOptions{
ProxyMetrics: &egv1a1.ProxyMetrics{
Prometheus: &egv1a1.ProxyPrometheusProvider{
EnableCompression: true,
CompressionLibrary: "gzip",
},
},
},
},
{
name: "enable-prometheus-brotli-compression",
opts: &RenderBootsrapConfigOptions{
ProxyMetrics: &egv1a1.ProxyMetrics{
Prometheus: &egv1a1.ProxyPrometheusProvider{
EnableCompression: true,
CompressionLibrary: "brotli",
},
},
},
},
{
name: "enable-prometheus-zstd-compression",
opts: &RenderBootsrapConfigOptions{
ProxyMetrics: &egv1a1.ProxyMetrics{
Prometheus: &egv1a1.ProxyPrometheusProvider{
EnableCompression: true,
CompressionLibrary: "zstd",
Compression: &egv1a1.Compression{
Type: "gzip",
},
},
},
},
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit d26052a

Please sign in to comment.