Bool for sending packets via SSF
@@ -23,6 +23,7 @@ var (
count = flag.Int64("count", 0, "Report a 'count' metric. Value must be an integer.")
tag = flag.String("tag", "", "Tag(s) for metric, comma separated. Ex: service:airflow")
debug = flag.Bool("debug", false, "Turns on debug messages.")
+ toSSF = flag.Bool("ssf", false, "Sends packets via SSF instead of StatsD. (https://github.com/stripe/veneur/blob/master/ssf/sample.proto)")
)
// MinimalClient represents the functions that we call on Clients in veneur-emit.
@@ -59,21 +60,13 @@ func main() {
}
logrus.Debugf("destination: %s", addr)
- var conn MinimalClient
- conn, err = statsd.New(addr)
- if err != nil {
- logrus.WithError(err).Fatal("Error!")
- }
- _ = conn
-
+ if *toSSF {
var nconn net.Conn
nconn, err = net.Dial("udp", addr)
if err != nil {
logrus.WithError(err).Fatal("Error!")
}
- // tags := tags(*tag)
-
var span *ssf.SSFSpan
span, err = createMetrics(passedFlags, *name, *tag)
if err != nil {
@@ -84,6 +77,19 @@ func main() {
if err != nil {
logrus.WithError(err).Fatal("Error sending metric(s).")
}
+ } else {
+ var conn MinimalClient
+ conn, err = statsd.New(addr)
+ if err != nil {
+ logrus.WithError(err).Fatal("Error!")
+ }
+
+ tags := tags(*tag)
+ err = sendMetrics(conn, passedFlags, *name, tags)
+ if err != nil {
+ logrus.WithError(err).Fatal("Error sending metric(s).")
+ }
+ }
}
func flags() map[string]bool {
