Skip to content

Commit c0f1fb3

Browse files
author
Justin Reagor
committed
Prevent overzealous collection of Metric events through Prometheus
1 parent 4cc285b commit c0f1fb3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

events/bus.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ func (bus *EventBus) Publish(event Event) {
126126
bus.lock.Lock()
127127
defer bus.lock.Unlock()
128128
log.Debugf("event: %v", event)
129-
collector.WithLabelValues(event.Code.String(), event.Source).Inc()
129+
130+
if event.Code.String() != "Metric" {
131+
collector.WithLabelValues(event.Code.String(), event.Source).Inc()
132+
}
133+
130134
for subscriber := range bus.registry {
131135
// sending to an unsubscribed Subscriber shouldn't be a runtime
132136
// error, so this is in intentionally allowed to panic here

0 commit comments

Comments
 (0)