Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/scollector: fix empty host= tags not working after PR #1856 #1871

Merged
merged 1 commit into from Aug 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions cmd/scollector/collectors/collectors.go
Expand Up @@ -241,6 +241,11 @@ func AddTS(md *opentsdb.MultiDataPoint, name string, ts int64, value interface{}
}

tags := t.Copy()
if host, present := tags["host"]; !present {
tags["host"] = util.Hostname
} else if host == "" {
delete(tags, "host")
}
// if tags are not cleanable, log a message and skip it
if err := tags.Clean(); err != nil {
line := ""
Expand All @@ -256,11 +261,6 @@ func AddTS(md *opentsdb.MultiDataPoint, name string, ts int64, value interface{}
slog.Errorf("Invalid tagset discovered: %s. Skipping datapoint. Added from: %s", tags.String(), line)
return
}
if host, present := tags["host"]; !present {
tags["host"] = util.Hostname
} else if host == "" {
delete(tags, "host")
}
if rate != metadata.Unknown {
metadata.AddMeta(name, nil, "rate", rate, false)
}
Expand Down