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

Introduce ParentReference adjuster #3786

Merged

Conversation

bobrik
Copy link
Contributor

@bobrik bobrik commented Jun 28, 2022

As demonstrated in https://github.com/jaegertracing/jaeger-ui/issues/966, jaeger-ui expects the first reference to be of CHILD_OF type to properly render the tree. This new adjuster achieves exactly that.

Resolves #3785

@bobrik bobrik requested a review from a team as a code owner June 28, 2022 23:16
@bobrik bobrik requested a review from albertteoh June 28, 2022 23:16
@bobrik bobrik force-pushed the ivan/reference-sorter-adjuster branch from 215cce0 to 816f274 Compare June 28, 2022 23:17
@codecov
Copy link

codecov bot commented Jun 28, 2022

Codecov Report

Merging #3786 (a7d1650) into main (8c2e162) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3786      +/-   ##
==========================================
+ Coverage   97.58%   97.59%   +0.01%     
==========================================
  Files         288      289       +1     
  Lines       16778    16800      +22     
==========================================
+ Hits        16372    16396      +24     
+ Misses        321      319       -2     
  Partials       85       85              
Impacted Files Coverage Δ
cmd/query/app/querysvc/adjusters.go 100.00% <100.00%> (ø)
model/adjuster/parent_reference.go 100.00% <100.00%> (ø)
pkg/config/tlscfg/cert_watcher.go 94.68% <0.00%> (+2.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c2e162...a7d1650. Read the comment docs.

model/adjuster/sort_references.go Outdated Show resolved Hide resolved
sort.SliceStable(span.References, func(i, j int) bool {
iType := span.References[i].GetRefType()
jType := span.References[j].GetRefType()
return iType == model.SpanRefType_CHILD_OF && jType == model.SpanRefType_FOLLOWS_FROM
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is a sufficient condition. The logic to pick the correct parent should be:

  • first ref with refType=CHILD_OF and the same trace ID
  • otherwise, first ref that has the same trace ID
  • otherwise no change

Also, I would avoid the actual sorting, and only do the swap into the first position.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, updated.

model/adjuster/sort_references.go Outdated Show resolved Hide resolved
@bobrik bobrik force-pushed the ivan/reference-sorter-adjuster branch from 816f274 to 0db7af1 Compare June 29, 2022 04:19
@bobrik bobrik changed the title Introduce SortReferences adjuster Introduce ParentReference adjuster Jun 29, 2022
As demonstrated in https://github.com/jaegertracing/jaeger-ui/issues/966,
jaeger-ui expects the first reference to be of `CHILD_OF` type to properly
render the tree. This new adjuster achieves exactly that.

Signed-off-by: Ivan Babrou <github@ivan.computer>
@bobrik bobrik force-pushed the ivan/reference-sorter-adjuster branch from 0db7af1 to 119210c Compare June 29, 2022 04:21
Signed-off-by: Yuri Shkuro <github@ysh.us>
@yurishkuro yurishkuro enabled auto-merge (squash) July 1, 2022 19:18
@yurishkuro yurishkuro merged commit c2e23e2 into jaegertracing:main Jul 1, 2022
@bobrik bobrik deleted the ivan/reference-sorter-adjuster branch July 1, 2022 20:07
albertteoh pushed a commit to albertteoh/jaeger that referenced this pull request Jul 13, 2022
* Introduce ParentReference adjuster

As demonstrated in https://github.com/jaegertracing/jaeger-ui/issues/966,
jaeger-ui expects the first reference to be of `CHILD_OF` type to properly
render the tree. This new adjuster achieves exactly that.

Signed-off-by: Ivan Babrou <github@ivan.computer>

* Simplify algorithm, clean-up tests

Signed-off-by: Yuri Shkuro <github@ysh.us>

Co-authored-by: Yuri Shkuro <github@ysh.us>
Signed-off-by: Albert Teoh <see.kwang.teoh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FOLLOWS_FROM breaks nesting
2 participants