Add root_span boolean tag to ssf.names_unique
@@ -658,11 +658,7 @@ func (s *Server) HandleTracePacket(packet []byte) {
log.WithError(err).Warn("ParseSSF")
return
}
- setTags := []string{
- fmt.Sprintf("indicator:%s", strconv.FormatBool(span.Indicator)),
- fmt.Sprintf("service:%s", span.Service),
- }
- s.Statsd.Set("ssf.names_unique", span.Name, setTags, 0.1)
+ reportSpanName(s.Statsd, span)
s.handleSSF(span, []string{"ssf_format:packet"})
}
@@ -986,12 +982,9 @@ func (tb *internalTraceBackend) SendSync(ctx context.Context, span *ssf.SSFSpan)
fmt.Sprintf("service:%s", span.Service),
"ssf_format:internal",
}
- setTags := []string{
- fmt.Sprintf("indicator:%s", strconv.FormatBool(span.Indicator)),
- fmt.Sprintf("service:%s", span.Service),
- }
- tb.statsd.Set("ssf.names_unique", span.Name, setTags, 0.1)
tb.statsd.Incr("ssf.spans.received_total", tags, .1)
+
+ reportSpanName(tb.statsd, span)
tb.statsd.Histogram("ssf.spans.tags_per_span", float64(len(span.Tags)), tags, .1)
}
return nil
@@ -1014,3 +1007,13 @@ var _ trace.ClientBackend = &internalTraceBackend{}
func CalculateTickDelay(interval time.Duration, t time.Time) time.Duration {
return t.Truncate(interval).Add(interval).Sub(t)
}
+
+func reportSpanName(statsd *statsd.Client, span *ssf.SSFSpan) {
+ setTags := []string{
+ fmt.Sprintf("indicator:%s", strconv.FormatBool(span.Indicator)),
+ fmt.Sprintf("service:%s", span.Service),
+ fmt.Sprintf("root_span:%s", strconv.FormatBool(span.Id == span.TraceId)),
+ }
+
+ statsd.Set("ssf.names_unique", span.Name, setTags, 0.1)
+}
