Signed-off-by: glightfoot <glightfoot@rsglab.com>
This commit is contained in:
glightfoot 2021-02-06 23:21:49 -05:00
parent 32c612d5e8
commit 940e653ea6
6 changed files with 2 additions and 10 deletions

View file

@ -572,7 +572,7 @@ func TestHandlePacket(t *testing.T) {
le := len(events) le := len(events)
// Flatten actual events. // Flatten actual events.
actual := event.Events{} actual := event.Events{}
for i := 0; i < le; i++ { for j := 0; j < le; j++ {
actual = append(actual, <-events...) actual = append(actual, <-events...)
} }

View file

@ -492,7 +492,6 @@ func main() {
} }
} }
} }
} }
mux := http.NewServeMux() mux := http.NewServeMux()

View file

@ -84,5 +84,4 @@ func TestEventIntervalFlush(t *testing.T) {
if len(events) != 10 { if len(events) != 10 {
t.Fatal("Expected 10 events in the event channel, but got", len(events)) t.Fatal("Expected 10 events in the event channel, but got", len(events))
} }
} }

View file

@ -55,7 +55,6 @@ type Exporter struct {
// Listen handles all events sent to the given channel sequentially. It // Listen handles all events sent to the given channel sequentially. It
// terminates when the channel is closed. // terminates when the channel is closed.
func (b *Exporter) Listen(e <-chan event.Events) { func (b *Exporter) Listen(e <-chan event.Events) {
removeStaleMetricsTicker := clock.NewTicker(time.Second) removeStaleMetricsTicker := clock.NewTicker(time.Second)
for { for {
@ -77,7 +76,6 @@ func (b *Exporter) Listen(e <-chan event.Events) {
// handleEvent processes a single Event according to the configured mapping. // handleEvent processes a single Event according to the configured mapping.
func (b *Exporter) handleEvent(thisEvent event.Event) { func (b *Exporter) handleEvent(thisEvent event.Event) {
mapping, labels, present := b.Mapper.GetMapping(thisEvent.MetricName(), thisEvent.MetricType()) mapping, labels, present := b.Mapper.GetMapping(thisEvent.MetricName(), thisEvent.MetricType())
if mapping == nil { if mapping == nil {
mapping = &mapper.MetricMapping{} mapping = &mapper.MetricMapping{}

View file

@ -144,7 +144,6 @@ func (m *MetricMapper) InitFromYAMLString(fileContents string) error {
} }
currentMapping.labelFormatters = labelFormatters currentMapping.labelFormatters = labelFormatters
currentMapping.labelKeys = labelKeys currentMapping.labelKeys = labelKeys
} else { } else {
if regex, err := regexp.Compile(currentMapping.Match); err != nil { if regex, err := regexp.Compile(currentMapping.Match); err != nil {
return fmt.Errorf("invalid regex %s in mapping: %v", currentMapping.Match, err) return fmt.Errorf("invalid regex %s in mapping: %v", currentMapping.Match, err)
@ -222,7 +221,6 @@ func (m *MetricMapper) InitFromYAMLString(fileContents string) error {
if currentMapping.Ttl == 0 && n.Defaults.Ttl > 0 { if currentMapping.Ttl == 0 && n.Defaults.Ttl > 0 {
currentMapping.Ttl = n.Defaults.Ttl currentMapping.Ttl = n.Defaults.Ttl
} }
} }
m.mutex.Lock() m.mutex.Lock()

View file

@ -79,9 +79,7 @@ func (m *MetricMapperNoopCache) Get(metricKey string) (interface{}, bool) {
return nil, false return nil, false
} }
func (m *MetricMapperNoopCache) Add(metricKey string, result interface{}) { func (m *MetricMapperNoopCache) Add(metricKey string, result interface{}) {}
return
}
func (m *MetricMapperNoopCache) Reset() {} func (m *MetricMapperNoopCache) Reset() {}