Use hexadecimal ids and lowercase names in zipkin input (#3488)
This commit is contained in:
committed by
Daniel Nelson
parent
f9b808572f
commit
113184ddae
@@ -1,6 +1,8 @@
|
||||
package zipkin
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins/inputs/zipkin/trace"
|
||||
)
|
||||
@@ -28,12 +30,13 @@ func (l *LineProtocolConverter) Record(t trace.Trace) error {
|
||||
fields := map[string]interface{}{
|
||||
"duration_ns": s.Duration.Nanoseconds(),
|
||||
}
|
||||
|
||||
tags := map[string]string{
|
||||
"id": s.ID,
|
||||
"parent_id": s.ParentID,
|
||||
"trace_id": s.TraceID,
|
||||
"name": s.Name,
|
||||
"service_name": s.ServiceName,
|
||||
"name": formatName(s.Name),
|
||||
"service_name": formatName(s.ServiceName),
|
||||
}
|
||||
l.acc.AddFields("zipkin", fields, tags, s.Timestamp)
|
||||
|
||||
@@ -42,8 +45,8 @@ func (l *LineProtocolConverter) Record(t trace.Trace) error {
|
||||
"id": s.ID,
|
||||
"parent_id": s.ParentID,
|
||||
"trace_id": s.TraceID,
|
||||
"name": s.Name,
|
||||
"service_name": a.ServiceName,
|
||||
"name": formatName(s.Name),
|
||||
"service_name": formatName(a.ServiceName),
|
||||
"annotation": a.Value,
|
||||
"endpoint_host": a.Host,
|
||||
}
|
||||
@@ -55,8 +58,8 @@ func (l *LineProtocolConverter) Record(t trace.Trace) error {
|
||||
"id": s.ID,
|
||||
"parent_id": s.ParentID,
|
||||
"trace_id": s.TraceID,
|
||||
"name": s.Name,
|
||||
"service_name": b.ServiceName,
|
||||
"name": formatName(s.Name),
|
||||
"service_name": formatName(b.ServiceName),
|
||||
"annotation": b.Value,
|
||||
"endpoint_host": b.Host,
|
||||
"annotation_key": b.Key,
|
||||
@@ -71,3 +74,10 @@ func (l *LineProtocolConverter) Record(t trace.Trace) error {
|
||||
func (l *LineProtocolConverter) Error(err error) {
|
||||
l.acc.AddError(err)
|
||||
}
|
||||
|
||||
// formatName formats name and service name
|
||||
// Zipkin forces span and service names to be lowercase:
|
||||
// https://github.com/openzipkin/zipkin/pull/805
|
||||
func formatName(name string) string {
|
||||
return strings.ToLower(name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user