Skip to content

Commit

Permalink
Merge pull request #99 from keep94/30158
Browse files Browse the repository at this point in the history
Send span lines with span logs.
  • Loading branch information
keep94 authored Aug 19, 2022
2 parents 10ec95b + 135bff5 commit c3769c5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion senders/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (sender *wavefrontSender) SendSpan(name string, startMillis, durationMillis
}

if len(spanLogs) > 0 {
logs, err := SpanLogJSON(traceId, spanId, spanLogs)
logs, err := SpanLogJSON(traceId, spanId, spanLogs, line)
if err != nil {
sender.spanLogsInvalid.Inc()
return err
Expand Down
2 changes: 1 addition & 1 deletion senders/direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (sender *directSender) SendSpan(name string, startMillis, durationMillis in
}

if len(spanLogs) > 0 {
logs, err := SpanLogJSON(traceId, spanId, spanLogs)
logs, err := SpanLogJSON(traceId, spanId, spanLogs, line)
if err != nil {
sender.spanLogsInvalid.Inc()
return err
Expand Down
3 changes: 2 additions & 1 deletion senders/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,12 @@ func SpanLine(name string, startMillis, durationMillis int64, source, traceId, s
}

// SpanLogJSON is for internal use only.
func SpanLogJSON(traceId, spanId string, spanLogs []SpanLog) (string, error) {
func SpanLogJSON(traceId, spanId string, spanLogs []SpanLog, span string) (string, error) {
l := SpanLogs{
TraceId: traceId,
SpanId: spanId,
Logs: spanLogs,
Span: span,
}
out, err := json.Marshal(l)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion senders/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (sender *proxySender) SendSpan(name string, startMillis, durationMillis int
}

if len(spanLogs) > 0 {
logs, err := SpanLogJSON(traceId, spanId, spanLogs)
logs, err := SpanLogJSON(traceId, spanId, spanLogs, line)
if err != nil {
sender.spanLogsInvalid.Inc()
return err
Expand Down
1 change: 1 addition & 0 deletions senders/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type SpanLogs struct {
TraceId string `json:"traceId"`
SpanId string `json:"spanId"`
Logs []SpanLog `json:"logs"`
Span string `json:"span"`
}

// MetricSender Interface for sending metrics to Wavefront
Expand Down

0 comments on commit c3769c5

Please sign in to comment.