Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
wonderflow committed Dec 24, 2024
1 parent 5329df6 commit dd12883
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 114 deletions.
58 changes: 0 additions & 58 deletions api/pkg/filtermanager/metricsconfigparser.go

This file was deleted.

13 changes: 0 additions & 13 deletions api/pkg/plugins/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ var (
pluginTypes = map[string]Plugin{}
plugins = map[string]Plugin{}
httpFilterFactoryAndParser = map[string]*FilterFactoryAndParser{}
metricsCounters = map[string]capi.CounterMetric{}
metricsDefinitions = map[string]MetricsRegister{}
)

Expand Down Expand Up @@ -253,15 +252,3 @@ func RegisterMetricsDefinitions(pluginName string, definition MetricsRegister) {
func GetMetricsDefinitions() map[string]MetricsRegister {
return metricsDefinitions
}

func RegisterCounterMetrics(name string) {
metricsCounters[name] = nil
}

func GetCounterMetricsForCallback() map[string]capi.CounterMetric {
return metricsCounters
}

func LoadCounterMetric(name string) capi.CounterMetric {
return metricsCounters[name]
}
30 changes: 0 additions & 30 deletions api/plugins/tests/integration/dataplane/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ type bootstrap struct {
accessLogFormat string
clusters []map[string]interface{}

filterGolangForMetrics map[string]interface{}

dp *DataPlane
}

Expand All @@ -46,8 +44,6 @@ func Bootstrap() *bootstrap {
backendRoutes: []map[string]interface{}{},
consumers: map[string]map[string]interface{}{},
clusters: []map[string]interface{}{},

filterGolangForMetrics: map[string]interface{}{},
}
}

Expand Down Expand Up @@ -84,11 +80,6 @@ func (b *bootstrap) AddConsumer(name string, c map[string]interface{}) *bootstra
return b
}

func (b *bootstrap) AddFilterForGoMetrics(c map[string]interface{}) *bootstrap {
b.filterGolangForMetrics = c
return b
}

func (b *bootstrap) SetFilterGolang(cfg map[string]interface{}) *bootstrap {
b.httpFilterGolang = cfg
return b
Expand Down Expand Up @@ -153,27 +144,6 @@ func (b *bootstrap) buildConfiguration() (map[string]interface{}, error) {
}
}
}
if len(b.filterGolangForMetrics) > 0 {
wrapper := map[string]interface{}{
"@type": "type.googleapis.com/xds.type.v3.TypedStruct",
"value": b.filterGolangForMetrics,
}
var additionalFilters []interface{} = []interface{}{
map[string]interface{}{
"name": "htnn.go.metrics",
"disabled": true,
"typed_config": map[string]interface{}{
"@type": "type.googleapis.com/envoy.extensions.filters.http.golang.v3alpha.Config",
"library_path": "/etc/libgolang.so",
"library_id": "fm-metrics",
"plugin_name": "fm-metrics",
"plugin_config": wrapper,
},
},
}
httpFilters = append(additionalFilters, httpFilters...)
hcm["http_filters"] = httpFilters
}

if b.accessLogFormat != "" {
accessLog := hcm["access_log"].([]interface{})[0].(map[string]interface{})["typed_config"].(map[string]interface{})
Expand Down
12 changes: 0 additions & 12 deletions api/tests/integration/filtermanager_latest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"path/filepath"
"strings"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -346,16 +345,6 @@ func TestFilterManagerLogWithTrailers(t *testing.T) {
func TestMetricsEnabledPlugin(t *testing.T) {
dp, err := dataplane.StartDataPlane(t, &dataplane.Option{
LogLevel: "debug",
/*
Bootstrap: dataplane.Bootstrap().AddFilterForGoMetrics(map[string]interface{}{
"plugins": []interface{}{
map[string]interface{}{
"name": "onLog",
"config": map[string]interface{}{},
},
},
}),
*/
})
if err != nil {
t.Fatalf("failed to start data plane: %v", err)
Expand Down Expand Up @@ -402,5 +391,4 @@ func TestMetricsEnabledPlugin(t *testing.T) {
}
}
assert.Equal(t, 1, found, "expect to have metrics usage.counter and usage.gauge")
time.Sleep(5 * time.Minute)
}
1 change: 0 additions & 1 deletion api/tests/integration/libgolang/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (

func init() {
http.RegisterHttpFilterFactoryAndConfigParser("fm", filtermanager.FilterManagerFactory, &filtermanager.FilterManagerConfigParser{})
//http.RegisterHttpFilterFactoryAndConfigParser("fm-metrics", filtermanager.MetricsConfigFactory, &filtermanager.MetricsConfigParser{})
http.RegisterHttpFilterFactoryAndConfigParser("cm", consumer.ConsumerManagerFactory, &consumer.ConsumerManagerConfigParser{})
http.RegisterHttpFilterFactoryAndConfigParser("dc", dynamicconfig.DynamicConfigFactory, &dynamicconfig.DynamicConfigParser{})
}
Expand Down

0 comments on commit dd12883

Please sign in to comment.