Skip to content

Commit

Permalink
Found how to use composition for shared interface implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenaLee committed Oct 12, 2022
1 parent c04b41f commit 703dfe1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions integration/test/metric/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

type CPUMetricValueFetcher struct {
base *baseMetricValueFetcher
baseMetricValueFetcher
}

func (f *CPUMetricValueFetcher) Fetch(namespace string, metricName string, stat Statistics) ([]float64, error) {
Expand All @@ -26,10 +26,6 @@ func (f *CPUMetricValueFetcher) Fetch(namespace string, metricName string, stat
return values, err
}

func (f *CPUMetricValueFetcher) fetch(namespace string, metricSpecificDimensions []types.Dimension, metricName string, stat Statistics) ([]float64, error) {
return f.base.fetch(namespace, metricSpecificDimensions, metricName, stat)
}

var cpuSupportedMetricValues = map[string]struct{}{
"cpu_time_active": {},
"cpu_time_guest": {},
Expand Down
2 changes: 1 addition & 1 deletion integration/test/metric/metric_value_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

var metricValueFetchers = []MetricValueFetcher{
&CPUMetricValueFetcher{base: &baseMetricValueFetcher{}},
&CPUMetricValueFetcher{},
}

func GetMetricFetcher(metricName string) (MetricValueFetcher, error) {
Expand Down

0 comments on commit 703dfe1

Please sign in to comment.