Skip to content

Commit

Permalink
fix: remove deprecated configuration PushInterval (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
vm-001 authored Mar 10, 2025
1 parent 11e1ac0 commit 54e745e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 32 deletions.
13 changes: 0 additions & 13 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,6 @@ func TestMetricsConfig(t *testing.T) {
},
expectedValidateErr: errors.New("interval must be in the range [1, 60]"),
},
{
desc: "invalid PushInterval (Opentelemetry has higher priority)",
cfg: MetricsConfig{
Attributes: nil,
Exports: nil,
PushInterval: 1,
Opentelemetry: Opentelemetry{
PushInterval: 61,
Protocol: "http/protobuf",
},
},
expectedValidateErr: errors.New("interval must be in the range [1, 60]"),
},
}

for _, test := range tests {
Expand Down
3 changes: 0 additions & 3 deletions config/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ func (cfg *MetricsConfig) Validate() error {
return fmt.Errorf("invalid export: %s", export)
}
}
if cfg.Opentelemetry.PushInterval != 0 {
cfg.PushInterval = cfg.Opentelemetry.PushInterval
}
if cfg.PushInterval < 1 || cfg.PushInterval > 60 {
return fmt.Errorf("interval must be in the range [1, 60]")
}
Expand Down
2 changes: 0 additions & 2 deletions config/opentelemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ const (
type Opentelemetry struct {
Protocol OtlpProtocol `yaml:"protocol" envconfig:"PROTOCOL" default:"http/protobuf"`
Endpoint string `yaml:"endpoint" envconfig:"ENDPOINT" default:"http://localhost:4318/v1/metrics"`
// Deprecated: used by MetricsConfig
PushInterval uint32 `yaml:"push_interval" default:"10"`
}

func (cfg Opentelemetry) Validate() error {
Expand Down
2 changes: 1 addition & 1 deletion test/admin/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var _ = Describe("/debug", Ordered, func() {
}

for _, path := range paths {
resp, err := adminClient.R().Get(path + "?debug=1")
resp, err := adminClient.R().Get(path)
assert.NoError(GinkgoT(), err)
assert.Equal(GinkgoT(), 200, resp.StatusCode(), fmt.Sprintf("%s \n%s", path, resp.Status()))
}
Expand Down
26 changes: 13 additions & 13 deletions test/metrics/opentelemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ var _ = Describe("opentelemetry", Ordered, func() {
proxyClient = helper.ProxyClient()
var err error
app, err = helper.Start(map[string]string{
"WEBHOOKX_ADMIN_LISTEN": "0.0.0.0:8080",
"WEBHOOKX_PROXY_LISTEN": "0.0.0.0:8081",
"WEBHOOKX_WORKER_ENABLED": "true",
"WEBHOOKX_METRICS_EXPORTS": "opentelemetry",
"WEBHOOKX_METRICS_OPENTELEMETRY_PUSH_INTERVAL": "5",
"WEBHOOKX_METRICS_OPENTELEMETRY_PROTOCOL": protocol,
"WEBHOOKX_METRICS_OPENTELEMETRY_ENDPOINT": endpoints[protocol],
"WEBHOOKX_ADMIN_LISTEN": "0.0.0.0:8080",
"WEBHOOKX_PROXY_LISTEN": "0.0.0.0:8081",
"WEBHOOKX_WORKER_ENABLED": "true",
"WEBHOOKX_METRICS_EXPORTS": "opentelemetry",
"WEBHOOKX_METRICS_PUSH_INTERVAL": "1",
"WEBHOOKX_METRICS_OPENTELEMETRY_PROTOCOL": protocol,
"WEBHOOKX_METRICS_OPENTELEMETRY_ENDPOINT": endpoints[protocol],
})
assert.Nil(GinkgoT(), err)
})
Expand Down Expand Up @@ -126,12 +126,12 @@ var _ = Describe("opentelemetry", Ordered, func() {
var err error
helper.InitOtelOutput()
app, err = helper.Start(map[string]string{
"WEBHOOKX_METRICS_ATTRIBUTES": `{"env": "prod"}`,
"WEBHOOKX_METRICS_EXPORTS": "opentelemetry",
"WEBHOOKX_METRICS_OPENTELEMETRY_PROTOCOL": "grpc",
"WEBHOOKX_METRICS_OPENTELEMETRY_ENDPOINT": "localhost:4317",
"OTEL_RESOURCE_ATTRIBUTES": "key1=value1,key2=value2",
"WEBHOOKX_METRICS_OPENTELEMETRY_PUSH_INTERVAL": "5",
"WEBHOOKX_METRICS_ATTRIBUTES": `{"env": "prod"}`,
"WEBHOOKX_METRICS_EXPORTS": "opentelemetry",
"WEBHOOKX_METRICS_OPENTELEMETRY_PROTOCOL": "grpc",
"WEBHOOKX_METRICS_OPENTELEMETRY_ENDPOINT": "localhost:4317",
"OTEL_RESOURCE_ATTRIBUTES": "key1=value1,key2=value2",
"WEBHOOKX_METRICS_PUSH_INTERVAL": "1",
})
assert.Nil(GinkgoT(), err)
})
Expand Down

0 comments on commit 54e745e

Please sign in to comment.