Skip to content
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: new trace details waterfall integration #6708

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

vikrantgupta25
Copy link
Collaborator

@vikrantgupta25 vikrantgupta25 commented Dec 24, 2024

Summary

  • added endpoint v2/traces/{traceID} for the new trace details API
  • constructs the trace details graph at query service and serve the requested spans based on the interestedSpanId received from frontend
  • frontend integration for the new trace details

Related Issues / PR's

contributes to - #6132

Screenshots

NA

Affected Areas and Manually Tested Areas

@github-actions github-actions bot added the enhancement New feature or request label Dec 24, 2024
@vikrantgupta25
Copy link
Collaborator Author

contributes to - #6132

@vikrantgupta25 vikrantgupta25 changed the title feat: query service waterfall changes for new trace details feat: new trace details waterfall integration Dec 24, 2024
@SigNoz SigNoz deleted a comment from github-actions bot Dec 26, 2024
@SigNoz SigNoz deleted a comment from github-actions bot Dec 26, 2024
@SigNoz SigNoz deleted a comment from github-actions bot Dec 26, 2024
@SigNoz SigNoz deleted a comment from github-actions bot Dec 26, 2024
@vikrantgupta25 vikrantgupta25 changed the base branch from new-trace-detail to main January 4, 2025 06:43
Copy link
Member

@nityanandagohain nityanandagohain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added few comments, the main point will be to add tests for the logics you have implemented.

Apart from that the flux interval should be there and it should be configurable with default set to 1 min.

@@ -156,6 +158,8 @@ type ClickHouseReader struct {
traceLocalTableName string
traceResourceTableV3 string
traceSummaryTable string

CacheV2 cacheV2.Cache
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be private instead of public ? cacheV2

@@ -1441,6 +1449,293 @@ func (r *ClickHouseReader) SearchTraces(ctx context.Context, params *model.Searc
return &searchSpansResult, nil
}

func contains(slice []string, item string) bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should go to utils ?


// create the trace tree based on the spans fetched above
// create a map of [spanId]: spanNode
for _, item := range searchScanResponses {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this logic can be moved to utils/traces. And proper test cases


// traverse through the map and append each node to the children array of the parent node
// capture the root nodes as well
for _, spanNode := range spanIdToSpanNodeMap {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for this


// mark the current path from root to the interested node as uncollapsed
// Important - do not mark the interested node as uncollapsed in the above exercise to handle node collapses
rootToInterestedNodePath = func(node *model.Span) bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part as well, should be invdividually testable

// get the index for the interested span id
if req.InterestedSpanID != "" {
for i, span := range preOrderTraversal {
if span.SpanID == req.InterestedSpanID {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this logic be merged with traverse function, this will prevent reiteration ?

@@ -538,6 +538,7 @@ func (aH *APIHandler) RegisterRoutes(router *mux.Router, am *AuthMiddleware) {

router.HandleFunc("/api/v2/traces/fields", am.ViewAccess(aH.traceFields)).Methods(http.MethodGet)
router.HandleFunc("/api/v2/traces/fields", am.EditAccess(aH.updateTraceField)).Methods(http.MethodPost)
router.HandleFunc("/api/v2/traces/{traceId}", am.ViewAccess(aH.SearchTracesV3)).Methods(http.MethodPost)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename searchTracesV3 to listSpans or getSpansForTrace ?

Level int64 `json:"level"`
}

type SearchTracesV3Cache struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't be in response.go as it is not a response struct.

@@ -315,6 +315,12 @@ type SearchTracesParams struct {
MaxSpansInTrace int `json:"maxSpansInTrace"`
}

type SearchTracesV3Params struct {
InterestedSpanID string `json:"interestedSpanId"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: instead of insterested, will selectedSpanID be more verbose ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs required enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants