-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(trace-details): query service changes for trace details #6906
Conversation
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
1 similar comment
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
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.
👍 Looks good to me! Reviewed everything up to 835d7a3 in 3 minutes and 20 seconds
More details
- Looked at
1369
lines of code in16
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. pkg/query-service/app/server.go:161
- Draft comment:
EnsurefluxIntervalForTraceDetail
is consistently used across all instances. Currently, it is passed asnil
here, which might lead to unexpected behavior. - Reason this comment was not posted:
Marked as duplicate.
2. pkg/query-service/app/server.go:183
- Draft comment:
EnsurefluxIntervalForTraceDetail
is consistently used across all instances. Currently, it is passed asnil
here, which might lead to unexpected behavior. - Reason this comment was not posted:
Marked as duplicate.
3. pkg/query-service/app/server.go:134
- Draft comment:
EnsurefluxIntervalForTraceDetail
is consistently used across all instances. Currently, it is passed asnil
here, which might lead to unexpected behavior. - Reason this comment was not posted:
Comment did not seem useful.
4. pkg/query-service/interfaces/interface.go:44
- Draft comment:
Do not add non-ClickHouse related functions to the ClickHouseReader interface. Use the DAO in the telemetry instance to access such information instead. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment seems to be based on a misunderstanding. This is a general Reader interface, not a ClickHouseReader interface. The new functions are trace-related operations which fit with other trace operations already in the interface (like SearchTraces). The interface already contains many non-ClickHouse specific operations. The comment appears to be enforcing a rule that doesn't apply here.
I could be wrong about the broader context - maybe there's a reason these specific functions should be handled differently from other trace operations. There might be architectural decisions I'm not aware of.
Even with potential missing context, the evidence strongly suggests this is a general interface for reading various types of data, including traces. The new methods are consistent with existing patterns in the interface.
The comment should be deleted because it appears to be based on a misunderstanding of the interface's purpose and scope. The new methods are consistent with the interface's existing functionality.
Workflow ID: wflow_shWExKQEufwO4YOY
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and 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.
👍 Looks good to me! Incremental review on 90476d7 in 1 minute and 32 seconds
More details
- Looked at
1313
lines of code in10
files - Skipped
0
files when reviewing. - Skipped posting
9
drafted comments based on config settings.
1. pkg/query-service/app/clickhouseReader/reader.go:160
- Draft comment:
The import alias for the cache package has been changed fromcacheV2
tocache
, but the variable namecacheV2
is still used in some places. Ensure consistency in naming to avoid confusion. - Reason this comment was not posted:
Comment looked like it was already resolved.
2. pkg/query-service/app/clickhouseReader/reader.go:175
- Draft comment:
The import alias for the cache package has been changed fromcacheV2
tocache
, but the variable namecacheV2
is still used in some places. Ensure consistency in naming to avoid confusion. - Reason this comment was not posted:
Marked as duplicate.
3. pkg/query-service/app/clickhouseReader/reader.go:186
- Draft comment:
The import alias for the cache package has been changed fromcacheV2
tocache
, but the variable namecacheV2
is still used in some places. Ensure consistency in naming to avoid confusion. - Reason this comment was not posted:
Marked as duplicate.
4. pkg/query-service/app/clickhouseReader/reader.go:288
- Draft comment:
The import alias for the cache package has been changed fromcacheV2
tocache
, but the variable namecacheV2
is still used in some places. Ensure consistency in naming to avoid confusion. - Reason this comment was not posted:
Marked as duplicate.
5. pkg/query-service/app/clickhouseReader/reader.go:1454
- Draft comment:
The import alias for the cache package has been changed fromcacheV2
tocache
, but the variable namecacheV2
is still used in some places. Ensure consistency in naming to avoid confusion. - Reason this comment was not posted:
Marked as duplicate.
6. pkg/query-service/app/clickhouseReader/reader.go:1553
- Draft comment:
The import alias for the cache package has been changed fromcacheV2
tocache
, but the variable namecacheV2
is still used in some places. Ensure consistency in naming to avoid confusion. - Reason this comment was not posted:
Marked as duplicate.
7. pkg/query-service/app/traces/tracedetail/flamegraph.go:1
- Draft comment:
Avoid using thecomponent/index.tsx
file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. - Reason this comment was not posted:
Comment was not on a valid diff hunk.
8. pkg/query-service/app/traces/tracedetail/waterfall.go:1
- Draft comment:
Avoid using thecomponent/index.tsx
file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. - Reason this comment was not posted:
Marked as duplicate.
9. pkg/query-service/model/cacheable.go:1
- Draft comment:
Avoid using thecomponent/index.tsx
file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. - Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_zzD5Kbzef6WEAE9V
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and 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.
👍 Looks good to me! Incremental review on a1d3d6f in 38 seconds
More details
- Looked at
166
lines of code in5
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. pkg/query-service/app/traces/tracedetail/flamegraph.go:91
- Draft comment:
The logic for adjustinglowerLimit
andupperLimit
is repeated inGetSelectedSpansForFlamegraphForRequest
andGetSelectedSpans
inwaterfall.go
. Consider refactoring this into a helper function to improve maintainability. - Reason this comment was not posted:
Confidence changes required:50%
The functionGetSelectedSpansForFlamegraphForRequest
inflamegraph.go
has redundant code for adjusting thelowerLimit
andupperLimit
. The same logic is repeated inGetSelectedSpans
inwaterfall.go
. This redundancy can be refactored into a helper function to improve code maintainability.
2. pkg/query-service/app/traces/tracedetail/waterfall.go:106
- Draft comment:
The parameterisPartOfPreOrder
intraverseTrace
could be renamed to something more descriptive to indicate its purpose more clearly, such asshouldIncludeInPreOrder
. - Reason this comment was not posted:
Confidence changes required:20%
ThetraverseTrace
function inwaterfall.go
has a parameterisPartOfPreOrder
that is used to determine if a node should be added to thepreOrderTraversal
. This logic is correct, but the nameisPartOfPreOrder
could be more descriptive to indicate its purpose more clearly.
3. pkg/query-service/app/traces/tracedetail/waterfall.go:106
- Draft comment:
Avoid using inline styles in React components. Instead, use external stylesheets, CSS classes, or styled components. - Reason this comment was not posted:
Confidence changes required:50%
The functiontraverseTrace
inwaterfall.go
has been modified to include an additional parameterisPartOfPreOrder
, which is used to determine whether to append the node to the pre-order traversal. This change is consistent with the logic of maintaining a pre-order traversal based on certain conditions.
Workflow ID: wflow_Av3v4ufTz2pUfriC
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and 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.
👍 Looks good to me! Incremental review on b33aa74 in 29 seconds
More details
- Looked at
340
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
3
drafted comments based on config settings.
1. pkg/query-service/app/traces/tracedetail/waterfall.go:4
- Draft comment:
The use of theslices
package for theContains
function is a good replacement for the customcontains
function. This improves code readability and maintainability. - Reason this comment was not posted:
Confidence changes required:10%
Theslices
package is used for theContains
function, which is a good replacement for the customcontains
function. This change is appropriate and improves code readability.
2. pkg/query-service/app/traces/tracedetail/waterfall.go:81
- Draft comment:
Theslices.Contains
function is used correctly in place of the customcontains
function. This change is appropriate and improves code readability. This is also applicable at line 130. - Reason this comment was not posted:
Confidence changes required:10%
Theslices.Contains
function is used correctly in place of the customcontains
function. This change is appropriate and improves code readability.
3. pkg/query-service/app/traces/tracedetail/waterfall.go:78
- Draft comment:
Thecontains
function is defined but not used. Consider removing it to clean up the code. - Reason this comment was not posted:
Confidence changes required:50%
The functioncontains
is defined but not used anywhere in the code. It should be removed to clean up the code.
Workflow ID: wflow_l5aBhccFBv3WkfPC
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and 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.
👍 Looks good to me! Incremental review on 52ad95e in 1 minute and 27 seconds
More details
- Looked at
44
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
4
drafted comments based on config settings.
1. pkg/query-service/app/clickhouseReader/reader.go:1456
- Draft comment:
The function signature has changed, addingtraceDetailsQuery
as a parameter. Ensure all invocations ofGetSpansForTrace
are updated accordingly. - Reason this comment was not posted:
Confidence changes required:50%
The change in the function signature ofGetSpansForTrace
requires updating all its invocations. The PR author has done this, but it's important to ensure that all invocations are updated correctly. The change involves adding a new parametertraceDetailsQuery
.
2. pkg/query-service/app/clickhouseReader/reader.go:1469
- Draft comment:
Logging SQL queries can expose sensitive information. Ensure this complies with security and privacy policies. - Reason this comment was not posted:
Confidence changes required:50%
The SQL query string is being logged, which can be useful for debugging but may expose sensitive information. It's important to ensure that logging this information does not violate any security or privacy policies.
3. pkg/query-service/app/clickhouseReader/reader.go:1523
- Draft comment:
Ensure thatfmt.Sprintf
usage for SQL query construction does not allow user input to affect the query structure, preventing SQL injection. - Reason this comment was not posted:
Confidence changes required:50%
The SQL query string is being constructed usingfmt.Sprintf
, which is generally safe here because the table names are not user inputs. However, it's important to ensure that no user input can affect the query structure to prevent SQL injection.
4. pkg/query-service/app/clickhouseReader/reader.go:1456
- Draft comment:
Avoid adding non-ClickHouse related parameters liketraceDetailsQuery
to theClickHouseReader
interface. Use the DAO in the telemetry instance to access such information instead. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment appears to be incorrect. ThetraceDetailsQuery
parameter is directly related to ClickHouse functionality as it contains SQL queries executed against ClickHouse. This is not a non-ClickHouse related parameter. The parameter is used to make the query reusable across different trace detail retrieval scenarios.
Could I be wrong about the parameter's purpose? Maybe there's a better architectural pattern for handling different query variations?
While there could be other patterns, passing the query as a parameter is a valid approach here since it's still directly related to ClickHouse functionality. The parameter name could be clearer but the functionality is appropriate.
The comment should be deleted as it incorrectly identifies traceDetailsQuery as a non-ClickHouse related parameter when it is actually a ClickHouse SQL query parameter.
Workflow ID: wflow_p5S9N3tt3nQuDGoC
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and 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.
I have done some basic review, I will review the logics more. But please add test to review the logic otherwise it is really difficult.
} | ||
|
||
if time.Since(time.UnixMilli(int64(cachedTraceData.EndTime))) < r.fluxIntervalForTraceDetail { | ||
zap.L().Info("the trace end time falls under the flux interval, skipping getWaterfallSpansForTraceWithMetadata cache", zap.String("traceID", traceID)) |
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.
debug log ?
} | ||
|
||
if err != nil { | ||
zap.L().Info("cache miss for getWaterfallSpansForTraceWithMetadata", zap.String("traceID", traceID)) |
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.
I see redundant logs.
} | ||
totalSpans = uint64(len(searchScanResponses)) | ||
|
||
processingBeforeCache := time.Now() |
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.
this part can be it's own function ?
|
||
// traverse through the map and append each node to the children array of the parent node | ||
// and add the missing spans | ||
for _, spanNode := range spanIdToSpanNodeMap { |
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.
this part as well, with tests.
|
||
processingBeforeCache := time.Now() | ||
for _, item := range searchScanResponses { | ||
ref := []model.OtelSpanRef{} |
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.
duplicate parts from GetWaterfallSpansForTraceWithMetadata
return selectedSpanIndex | ||
} | ||
|
||
func getPathFromRootToSelectedSpanId(node *model.Span, selectedSpanId string, uncollapsedSpans []string, isSelectedSpanIDUnCollapsed bool) (bool, []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.
I don't see any test cases for functions in these files.
} | ||
|
||
func (c *GetWaterfallSpansForTraceWithMetadataCache) MarshalBinary() (data []byte, err error) { | ||
return json.Marshal(c) |
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.
Is this required ?
Summary
Related Issues / PR's
contributes to - #6132
Screenshots
NA
Affected Areas and Manually Tested Areas