-
Notifications
You must be signed in to change notification settings - Fork 671
[feat][backend] add search trace tree open api #217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…t_cc_trace_event_collector
…t_cc_trace_event_collector
…t_cc_trace_event_collector
…t_cc_trace_event_collector
(LogID: 20250930143228010091094197480C923) Co-Authored-By: Coda <[email protected]>
(LogID: 20250930162038010091094197293E3B5) Co-Authored-By: Coda <[email protected]>
…t_cc_trace_event_collector
…t_cc_trace_event_collector
(LogID: 202510141631250100910941971269738) Co-Authored-By: Coda <[email protected]>
(LogID: 202510141631250100910941971269738) Co-Authored-By: Coda <[email protected]>
(LogID: 20251014175401010091094197096B65A) Co-Authored-By: Coda <[email protected]>
🤖 Generated with Coda Co-Authored-By: Coda <[email protected]> (LogID: 2025101419340301009109419719038F1) Co-Authored-By: Coda <[email protected]>
🤖 Generated with Coda (LogID: 202510142136120100910941975788B9C) Co-Authored-By: Coda <[email protected]>
🤖 Generated with Coda
🤖 Generated with Coda Co-Authored-By: Coda <[email protected]> (LogID: 20251015121552010091094197109BD6B) Co-Authored-By: Coda <[email protected]>
🤖 Generated with Coda Co-Authored-By: Coda <[email protected]> (LogID: 20251015121552010091094197109BD6B) Co-Authored-By: Coda <[email protected]>
(LogID: 2025101517003901009109419764992EC) Co-Authored-By: Coda <[email protected]>
(LogID: 2025101517003901009109419764992EC) Co-Authored-By: Coda <[email protected]>
🤖 Generated with Coda Co-Authored-By: Coda <[email protected]> (LogID: 2025101517003901009109419764992EC) Co-Authored-By: Coda <[email protected]>
(LogID: 2025101517003901009109419764992EC) Co-Authored-By: Coda <[email protected]>
defer func() { | ||
if req != nil { | ||
o.metrics.EmitTraceOapi("SearchTraceOApi", req.WorkspaceID, req.GetPlatformType(), "", int64(spansSize), errCode, st, err != nil) | ||
o.collector.CollectTraceOpenAPIEvent(ctx, "SearchTraceOApi", req.WorkspaceID, req.GetPlatformType(), "", int64(spansSize), errCode, st, err != nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是干嘛的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
byteio上报到hive的,上线才能验证
func (o *OpenAPIApplication) validateSearchTraceTreeOApiReq(ctx context.Context, req *openapi.SearchTraceTreeOApiRequest) error { | ||
if req == nil { | ||
return errorx.NewByCode(obErrorx.CommercialCommonInvalidParamCodeCode, errorx.WithExtraMsg("no request provided")) | ||
} else if req.GetTraceID() == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些尽可能idl里去校验吧
platformType := loop_span.PlatformType(req.GetPlatformType()) | ||
if req.PlatformType == nil { | ||
platformType = loop_span.PlatformCozeLoop | ||
platformType = loop_span.PlatformDefault |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default的配置和cozeloop都是一致的了是吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
预期default是目前所有配置的最小公共部分,上线前我再ckeck下
func (t *TraceConfigCenter) GetKeyColumns(ctx context.Context) []string { | ||
keyColumns := make([]string, 0) | ||
if err := t.UnmarshalKey(ctx, keyColumnsCfgKey, &keyColumns); err != nil { | ||
return []string{"start_time", "span_id", "parent_id", "duration", "span_type", "span_name", "status_code", "tags_long", "logic_delete_date"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个做用是什么?是不是写配置文件里
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
search tree需要的字段。tcc配置。这里是在配置文件
return keyColumns | ||
} | ||
|
||
func (t *TraceConfigCenter) GetKeySpanTypes(ctx context.Context) map[string]map[string][]string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
map[string]map[string][]string这种结构可读性太差了,是不是定义一个结构体出来
|
||
import "github.com/samber/lo" | ||
|
||
func getColumnStr(columns []string, omits []string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是放到某个更通用的包里?和ck其实没关系,可能别的地方也会用到
case loop_span.FieldTypeDouble: | ||
return fmt.Sprintf("system_tags_float['%s']", filter.FieldName), nil | ||
default: // not expected to be here | ||
return fmt.Sprintf("tags_string['%s']", filter.FieldName), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
system?
return buf.String() | ||
} | ||
|
||
var spanColumns = []string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前不需要定义出来的吗
QueryType: ptr.Of(loop_span.QueryTypeEnumIn), | ||
}) | ||
} | ||
filter.FilterFields = append(filter.FilterFields, &loop_span.FilterField{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getTrace为什么需要filter?
QueryEndTime int64 // ms | ||
Tenant string | ||
QueryTenants []string | ||
SpanDoubleCheck bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这几个字段的作用是什么?
What type of PR is this?
Check the PR title.
(Optional) Translate the PR title into Chinese.
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
zh(optional):
(Optional) Which issue(s) this PR fixes: