Removed namespace; support for multiple tags
@@ -11,15 +11,14 @@ import (
var (
hostport = flag.String("hostport", "", "Hostname and port of destination.")
- namespace = flag.String("ns", "", "Namespace for metrics. Ex: daemontools")
- name = flag.String("name", "", "Name of metric to report. Ex: service.starts")
+ name = flag.String("name", "", "Name of metric to report. Ex: daemontools.service.starts")
gauge = flag.Float64("gauge", 0, "Report a 'gauge' metric. Value must be float64.")
timing = flag.Duration("timing", time.Now().Sub(time.Now()), "Report a 'timing' metric. Value must be parseable by time.ParseDuration.")
timeinms = flag.Float64("timeinms", 0, "Report a 'timing' metric, in milliseconds. Value must be float64.")
incr = flag.Bool("incr", false, "Report an 'incr' metric.")
decr = flag.Bool("decr", false, "Report a 'decr' metric.")
count = flag.Int64("count", 0, "Report a 'count' metric. Value must be an integer.")
- tag = flag.String("tag", "", "Tag for metric. Ex: `service:airflow")
+ tag = flag.String("tag", "", "Tag(s) for metric, comma separated. Ex: service:airflow")
)
func main() {
@@ -33,23 +32,14 @@ func main() {
logrus.Fatal("You must specifiy a valid destination host and port.")
}
- // fmt.Println("hostport: ", *hostport)
- // fmt.Println("namespace: ", *namespace)
- // fmt.Println("name: ", *name)
- // fmt.Println("gauge: ", *gauge)
- // fmt.Println("timing: ", *timing)
- // fmt.Println("timeinms: ", *timeinms)
- // fmt.Println("incr: ", *incr)
- // fmt.Println("decr: ", *decr)
- // fmt.Println("count: ", *count)
-
conn, err := statsd.New(*hostport)
if err != nil {
panic("ERROR")
}
- conn.Namespace = *namespace + "."
- conn.Tags = append(conn.Tags, *tag)
+ for _, elem := range strings.Split(*tag, ",") {
+ conn.Tags = append(conn.Tags, elem)
+ }
if passedFlags["gauge"] {
conn.Gauge(*name, *gauge, nil, 1)
