filter empty metric name

Signed-off-by: royeo <ljn6176@gmail.com>
This commit is contained in:
royeo 2021-06-25 16:42:22 +08:00
parent ef6627b9f0
commit 3b062c01c8

View file

@ -76,6 +76,11 @@ func (b *Exporter) Listen(e <-chan event.Events) {
// handleEvent processes a single Event according to the configured mapping.
func (b *Exporter) handleEvent(thisEvent event.Event) {
if thisEvent.MetricName() == "" {
level.Error(b.Logger).Log("msg", "metric name cannot be empty")
return
}
mapping, labels, present := b.Mapper.GetMapping(thisEvent.MetricName(), thisEvent.MetricType())
if mapping == nil {
mapping = &mapper.MetricMapping{}