mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-20 14:49:20 +08:00
Trace static fields and structs for trace v4. (#6469)
* fix: update static fields and add response structs * fix: update ch names * fix: move models to it's own file
This commit is contained in:
parent
649560265e
commit
57c2326908
@ -1,6 +1,7 @@
|
|||||||
package constants
|
package constants
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"maps"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
@ -238,8 +239,8 @@ const (
|
|||||||
SIGNOZ_EXP_HISTOGRAM_TABLENAME = "distributed_exp_hist"
|
SIGNOZ_EXP_HISTOGRAM_TABLENAME = "distributed_exp_hist"
|
||||||
SIGNOZ_TRACE_DBNAME = "signoz_traces"
|
SIGNOZ_TRACE_DBNAME = "signoz_traces"
|
||||||
SIGNOZ_SPAN_INDEX_TABLENAME = "distributed_signoz_index_v2"
|
SIGNOZ_SPAN_INDEX_TABLENAME = "distributed_signoz_index_v2"
|
||||||
SIGNOZ_SPAN_INDEX_LOCAL_TABLENAME = "signoz_index_v2"
|
|
||||||
SIGNOZ_SPAN_INDEX_V3 = "distributed_signoz_index_v3"
|
SIGNOZ_SPAN_INDEX_V3 = "distributed_signoz_index_v3"
|
||||||
|
SIGNOZ_SPAN_INDEX_LOCAL_TABLENAME = "signoz_index_v2"
|
||||||
SIGNOZ_SPAN_INDEX_V3_LOCAL_TABLENAME = "signoz_index_v3"
|
SIGNOZ_SPAN_INDEX_V3_LOCAL_TABLENAME = "signoz_index_v3"
|
||||||
SIGNOZ_TIMESERIES_v4_LOCAL_TABLENAME = "time_series_v4"
|
SIGNOZ_TIMESERIES_v4_LOCAL_TABLENAME = "time_series_v4"
|
||||||
SIGNOZ_TIMESERIES_v4_6HRS_LOCAL_TABLENAME = "time_series_v4_6hrs"
|
SIGNOZ_TIMESERIES_v4_6HRS_LOCAL_TABLENAME = "time_series_v4_6hrs"
|
||||||
@ -447,150 +448,70 @@ const MaxFilterSuggestionsExamplesLimit = 10
|
|||||||
var SpanRenderLimitStr = GetOrDefaultEnv("SPAN_RENDER_LIMIT", "2500")
|
var SpanRenderLimitStr = GetOrDefaultEnv("SPAN_RENDER_LIMIT", "2500")
|
||||||
var MaxSpansInTraceStr = GetOrDefaultEnv("MAX_SPANS_IN_TRACE", "250000")
|
var MaxSpansInTraceStr = GetOrDefaultEnv("MAX_SPANS_IN_TRACE", "250000")
|
||||||
|
|
||||||
var StaticFieldsTraces = map[string]v3.AttributeKey{
|
var NewStaticFieldsTraces = map[string]v3.AttributeKey{
|
||||||
"timestamp": {},
|
"timestamp": {},
|
||||||
"traceID": {
|
"trace_id": {
|
||||||
Key: "traceID",
|
Key: "trace_id",
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
IsColumn: true,
|
IsColumn: true,
|
||||||
},
|
},
|
||||||
"spanID": {
|
"span_id": {
|
||||||
Key: "spanID",
|
Key: "span_id",
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
IsColumn: true,
|
IsColumn: true,
|
||||||
},
|
},
|
||||||
"parentSpanID": {
|
"trace_state": {
|
||||||
Key: "parentSpanID",
|
Key: "trace_state",
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
IsColumn: true,
|
IsColumn: true,
|
||||||
},
|
},
|
||||||
|
"parent_span_id": {
|
||||||
|
Key: "parent_span_id",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"flags": {
|
||||||
|
Key: "flags",
|
||||||
|
DataType: v3.AttributeKeyDataTypeInt64,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
"name": {
|
"name": {
|
||||||
Key: "name",
|
Key: "name",
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
IsColumn: true,
|
IsColumn: true,
|
||||||
},
|
},
|
||||||
"serviceName": {
|
|
||||||
Key: "serviceName",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"kind": {
|
"kind": {
|
||||||
Key: "kind",
|
Key: "kind",
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
IsColumn: true,
|
IsColumn: true,
|
||||||
},
|
},
|
||||||
"spanKind": {
|
"kind_string": {
|
||||||
Key: "spanKind",
|
Key: "kind_string",
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
IsColumn: true,
|
IsColumn: true,
|
||||||
},
|
},
|
||||||
"durationNano": {
|
"duration_nano": {
|
||||||
Key: "durationNano",
|
Key: "duration_nano",
|
||||||
DataType: v3.AttributeKeyDataTypeFloat64,
|
DataType: v3.AttributeKeyDataTypeFloat64,
|
||||||
IsColumn: true,
|
IsColumn: true,
|
||||||
},
|
},
|
||||||
"statusCode": {
|
"status_code": {
|
||||||
Key: "statusCode",
|
Key: "status_code",
|
||||||
DataType: v3.AttributeKeyDataTypeFloat64,
|
DataType: v3.AttributeKeyDataTypeFloat64,
|
||||||
IsColumn: true,
|
IsColumn: true,
|
||||||
},
|
},
|
||||||
"hasError": {
|
"status_message": {
|
||||||
Key: "hasError",
|
Key: "status_message",
|
||||||
DataType: v3.AttributeKeyDataTypeBool,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"statusMessage": {
|
|
||||||
Key: "statusMessage",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
IsColumn: true,
|
IsColumn: true,
|
||||||
},
|
},
|
||||||
"statusCodeString": {
|
"status_code_string": {
|
||||||
Key: "statusCodeString",
|
Key: "status_code_string",
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"externalHttpMethod": {
|
|
||||||
Key: "externalHttpMethod",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"externalHttpUrl": {
|
|
||||||
Key: "externalHttpUrl",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"dbSystem": {
|
|
||||||
Key: "dbSystem",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"dbName": {
|
|
||||||
Key: "dbName",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"dbOperation": {
|
|
||||||
Key: "dbOperation",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"peerService": {
|
|
||||||
Key: "peerService",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"httpMethod": {
|
|
||||||
Key: "httpMethod",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"httpUrl": {
|
|
||||||
Key: "httpUrl",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"httpRoute": {
|
|
||||||
Key: "httpRoute",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"httpHost": {
|
|
||||||
Key: "httpHost",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"msgSystem": {
|
|
||||||
Key: "msgSystem",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"msgOperation": {
|
|
||||||
Key: "msgOperation",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"rpcSystem": {
|
|
||||||
Key: "rpcSystem",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"rpcService": {
|
|
||||||
Key: "rpcService",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"rpcMethod": {
|
|
||||||
Key: "rpcMethod",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
|
||||||
IsColumn: true,
|
|
||||||
},
|
|
||||||
"responseStatusCode": {
|
|
||||||
Key: "responseStatusCode",
|
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
IsColumn: true,
|
IsColumn: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
// new support
|
// new support for composite attributes
|
||||||
"response_status_code": {
|
"response_status_code": {
|
||||||
Key: "response_status_code",
|
Key: "response_status_code",
|
||||||
DataType: v3.AttributeKeyDataTypeString,
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
@ -645,4 +566,155 @@ var StaticFieldsTraces = map[string]v3.AttributeKey{
|
|||||||
// they are taken care by new format <attribute_type>_<attribute_datatype>_'<attribute_key>'
|
// they are taken care by new format <attribute_type>_<attribute_datatype>_'<attribute_key>'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var DeprecatedStaticFieldsTraces = map[string]v3.AttributeKey{
|
||||||
|
"traceID": {
|
||||||
|
Key: "traceID",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"spanID": {
|
||||||
|
Key: "spanID",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"parentSpanID": {
|
||||||
|
Key: "parentSpanID",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"spanKind": {
|
||||||
|
Key: "spanKind",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"durationNano": {
|
||||||
|
Key: "durationNano",
|
||||||
|
DataType: v3.AttributeKeyDataTypeFloat64,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"statusCode": {
|
||||||
|
Key: "statusCode",
|
||||||
|
DataType: v3.AttributeKeyDataTypeFloat64,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"statusMessage": {
|
||||||
|
Key: "statusMessage",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"statusCodeString": {
|
||||||
|
Key: "statusCodeString",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
// old support for composite attributes
|
||||||
|
"responseStatusCode": {
|
||||||
|
Key: "responseStatusCode",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"externalHttpUrl": {
|
||||||
|
Key: "externalHttpUrl",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"httpUrl": {
|
||||||
|
Key: "httpUrl",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"externalHttpMethod": {
|
||||||
|
Key: "externalHttpMethod",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"httpMethod": {
|
||||||
|
Key: "httpMethod",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"httpHost": {
|
||||||
|
Key: "httpHost",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"dbName": {
|
||||||
|
Key: "dbName",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"dbOperation": {
|
||||||
|
Key: "dbOperation",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"hasError": {
|
||||||
|
Key: "hasError",
|
||||||
|
DataType: v3.AttributeKeyDataTypeBool,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"isRemote": {
|
||||||
|
Key: "isRemote",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
// old support for resource attributes
|
||||||
|
"serviceName": {
|
||||||
|
Key: "serviceName",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
// old support for simple attributes
|
||||||
|
"httpRoute": {
|
||||||
|
Key: "httpRoute",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"msgSystem": {
|
||||||
|
Key: "msgSystem",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"msgOperation": {
|
||||||
|
Key: "msgOperation",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"dbSystem": {
|
||||||
|
Key: "dbSystem",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"rpcSystem": {
|
||||||
|
Key: "rpcSystem",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"rpcService": {
|
||||||
|
Key: "rpcService",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"rpcMethod": {
|
||||||
|
Key: "rpcMethod",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
"peerService": {
|
||||||
|
Key: "peerService",
|
||||||
|
DataType: v3.AttributeKeyDataTypeString,
|
||||||
|
IsColumn: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var StaticFieldsTraces = map[string]v3.AttributeKey{}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
StaticFieldsTraces = maps.Clone(NewStaticFieldsTraces)
|
||||||
|
maps.Copy(StaticFieldsTraces, DeprecatedStaticFieldsTraces)
|
||||||
|
}
|
||||||
|
|
||||||
const TRACE_V4_MAX_PAGINATION_LIMIT = 10000
|
const TRACE_V4_MAX_PAGINATION_LIMIT = 10000
|
||||||
|
29
pkg/query-service/model/trace.go
Normal file
29
pkg/query-service/model/trace.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type SpanItemV2 struct {
|
||||||
|
TimeUnixNano time.Time `ch:"timestamp"`
|
||||||
|
DurationNano uint64 `ch:"duration_nano"`
|
||||||
|
SpanID string `ch:"span_id"`
|
||||||
|
TraceID string `ch:"trace_id"`
|
||||||
|
HasError bool `ch:"has_error"`
|
||||||
|
Kind int8 `ch:"kind"`
|
||||||
|
ServiceName string `ch:"resource_string_service$$name"`
|
||||||
|
Name string `ch:"name"`
|
||||||
|
References string `ch:"references"`
|
||||||
|
Attributes_string map[string]string `ch:"attributes_string"`
|
||||||
|
Attributes_number map[string]float64 `ch:"attributes_number"`
|
||||||
|
Attributes_bool map[string]bool `ch:"attributes_bool"`
|
||||||
|
Events []string `ch:"events"`
|
||||||
|
StatusMessage string `ch:"status_message"`
|
||||||
|
StatusCodeString string `ch:"status_code_string"`
|
||||||
|
SpanKind string `ch:"kind_string"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TraceSummary struct {
|
||||||
|
TraceID string `ch:"trace_id"`
|
||||||
|
Start time.Time `ch:"start"`
|
||||||
|
End time.Time `ch:"end"`
|
||||||
|
NumSpans uint64 `ch:"num_spans"`
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user