mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-15 15:25:53 +08:00
feat: add spanKind and status in span response (#5120)
* feat: add spanKind and errorMessage in span response * fix: add statusCodeString
This commit is contained in:
parent
1ad61615c6
commit
4f2c314f39
@ -1942,7 +1942,7 @@ func (r *ClickHouseReader) SearchTraces(ctx context.Context, params *model.Searc
|
||||
end := time.Now()
|
||||
zap.L().Debug("getTraceSQLQuery took: ", zap.Duration("duration", end.Sub(start)))
|
||||
searchSpansResult := []model.SearchSpansResult{{
|
||||
Columns: []string{"__time", "SpanId", "TraceId", "ServiceName", "Name", "Kind", "DurationNano", "TagsKeys", "TagsValues", "References", "Events", "HasError"},
|
||||
Columns: []string{"__time", "SpanId", "TraceId", "ServiceName", "Name", "Kind", "DurationNano", "TagsKeys", "TagsValues", "References", "Events", "HasError", "StatusMessage", "StatusCodeString", "SpanKind"},
|
||||
Events: make([][]interface{}, len(searchScanResponses)),
|
||||
IsSubTree: false,
|
||||
},
|
||||
|
@ -252,19 +252,22 @@ type Event struct {
|
||||
|
||||
//easyjson:json
|
||||
type SearchSpanResponseItem struct {
|
||||
TimeUnixNano uint64 `json:"timestamp"`
|
||||
DurationNano int64 `json:"durationNano"`
|
||||
SpanID string `json:"spanId"`
|
||||
RootSpanID string `json:"rootSpanId"`
|
||||
TraceID string `json:"traceId"`
|
||||
HasError bool `json:"hasError"`
|
||||
Kind int32 `json:"kind"`
|
||||
ServiceName string `json:"serviceName"`
|
||||
Name string `json:"name"`
|
||||
References []OtelSpanRef `json:"references,omitempty"`
|
||||
TagMap map[string]string `json:"tagMap"`
|
||||
Events []string `json:"event"`
|
||||
RootName string `json:"rootName"`
|
||||
TimeUnixNano uint64 `json:"timestamp"`
|
||||
DurationNano int64 `json:"durationNano"`
|
||||
SpanID string `json:"spanId"`
|
||||
RootSpanID string `json:"rootSpanId"`
|
||||
TraceID string `json:"traceId"`
|
||||
HasError bool `json:"hasError"`
|
||||
Kind int32 `json:"kind"`
|
||||
ServiceName string `json:"serviceName"`
|
||||
Name string `json:"name"`
|
||||
References []OtelSpanRef `json:"references,omitempty"`
|
||||
TagMap map[string]string `json:"tagMap"`
|
||||
Events []string `json:"event"`
|
||||
RootName string `json:"rootName"`
|
||||
StatusMessage string `json:"statusMessage"`
|
||||
StatusCodeString string `json:"statusCodeString"`
|
||||
SpanKind string `json:"spanKind"`
|
||||
}
|
||||
|
||||
type OtelSpanRef struct {
|
||||
@ -301,7 +304,7 @@ func (item *SearchSpanResponseItem) GetValues() []interface{} {
|
||||
keys = append(keys, k)
|
||||
values = append(values, v)
|
||||
}
|
||||
returnArray := []interface{}{item.TimeUnixNano, item.SpanID, item.TraceID, item.ServiceName, item.Name, strconv.Itoa(int(item.Kind)), strconv.FormatInt(item.DurationNano, 10), keys, values, referencesStringArray, item.Events, item.HasError}
|
||||
returnArray := []interface{}{item.TimeUnixNano, item.SpanID, item.TraceID, item.ServiceName, item.Name, strconv.Itoa(int(item.Kind)), strconv.FormatInt(item.DurationNano, 10), keys, values, referencesStringArray, item.Events, item.HasError, item.StatusMessage, item.StatusCodeString, item.SpanKind}
|
||||
|
||||
return returnArray
|
||||
}
|
||||
|
@ -118,6 +118,12 @@ func easyjson6ff3ac1dDecodeGoSignozIoSignozPkgQueryServiceModel(in *jlexer.Lexer
|
||||
}
|
||||
case "rootName":
|
||||
out.RootName = string(in.String())
|
||||
case "statusMessage":
|
||||
out.StatusMessage = string(in.String())
|
||||
case "statusCodeString":
|
||||
out.StatusCodeString = string(in.String())
|
||||
case "spanKind":
|
||||
out.SpanKind = string(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
@ -233,6 +239,21 @@ func easyjson6ff3ac1dEncodeGoSignozIoSignozPkgQueryServiceModel(out *jwriter.Wri
|
||||
out.RawString(prefix)
|
||||
out.String(string(in.RootName))
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"statusMessage\":"
|
||||
out.RawString(prefix)
|
||||
out.String(string(in.StatusMessage))
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"statusCodeString\":"
|
||||
out.RawString(prefix)
|
||||
out.String(string(in.StatusCodeString))
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"spanKind\":"
|
||||
out.RawString(prefix)
|
||||
out.String(string(in.SpanKind))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user