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

Prevent DAG crashes because of empty service name string #656

Merged
merged 2 commits into from
Nov 4, 2020

Conversation

rubenvp8510
Copy link
Collaborator

Signed-off-by: Ruben Vargas ruben.vp8510@gmail.com

Which problem is this PR solving?

Short description of the changes

  • With this change the DAG won't show a node with an empty service, this prevents DAG view crashes because Cytoscape doesn't allow an empty string as an ID.

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
@codecov
Copy link

codecov bot commented Oct 29, 2020

Codecov Report

Merging #656 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #656   +/-   ##
=======================================
  Coverage   94.22%   94.22%           
=======================================
  Files         228      228           
  Lines        5919     5922    +3     
  Branches     1488     1489    +1     
=======================================
+ Hits         5577     5580    +3     
  Misses        303      303           
  Partials       39       39           
Impacted Files Coverage Δ
...es/jaeger-ui/src/components/DependencyGraph/DAG.js 100.00% <100.00%> (ø)

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 832b7de...9a5b510. Read the comment docs.

if (!nodeMap[d.parent]) {
nodes.push({ data: { id: d.parent } });
nodeMap[d.parent] = true;
if (d.parent.trim().length !== 0 && d.child.trim().length !== 0) {
Copy link
Member

Choose a reason for hiding this comment

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

What are the semantics of d.parent and d.child? Could we not ensure elsewhere that they are not empty?

Could you add a unit test to demonstrate that data leads to an issue you're trying to fix?

Copy link
Collaborator Author

@rubenvp8510 rubenvp8510 Oct 29, 2020

Choose a reason for hiding this comment

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

The way I was able to reproduce the issue is instrumenting a service with a space, (or empty string)

The context of this is d.parent and d.child are service names, I don't think there are other places where we ensure that the service name is not empty, indeed I can see the empty service name in the search bar

Is this considered an instrumentation error? Should we indicate it in some way? If this is consider an error in the instrumentation, may be we should do this validation in other place, more close to when we process the query service response.

I'll add a couple of tests.

Copy link
Member

Choose a reason for hiding this comment

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

imo empty or whitespace service name should be considered an instrumentation error, and we could build a sanitizer to fix it during ingestion.

However, w.r.t. this code that looks things up in a map, an empty or whitespace string is still a string, so why is the code failing on that?

Copy link
Collaborator Author

@rubenvp8510 rubenvp8510 Oct 30, 2020

Choose a reason for hiding this comment

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

I agree that we should build a sanitizer that fix this during ingestion, but also this view should not fail even if there are empty strings.

The error is not on this part, but on cytoscape, which doesn't allow empty strings nor white spaces as node IDs, I'm just filtering those cases here before calling cytoscape a couple of lines below.

@rubenvp8510 rubenvp8510 force-pushed the Issue-634 branch 2 times, most recently from cec0ebe to 1244857 Compare November 4, 2020 19:07
Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
@yurishkuro yurishkuro merged commit f254b08 into jaegertracing:master Nov 4, 2020
@yurishkuro
Copy link
Member

Thanks!

vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 4, 2021
…ng#656)

* Prevent DAG crashes because of empty service name string

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>

* Adding tests for empty service names

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 4, 2021
…ng#656)

* Prevent DAG crashes because of empty service name string

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>

* Adding tests for empty service names

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 5, 2021
…ng#656)

* Prevent DAG crashes because of empty service name string

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>

* Adding tests for empty service names

Signed-off-by: Ruben Vargas <ruben.vp8510@gmail.com>
Signed-off-by: vvvprabhakar <vvvprabhakar@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.

Error: Can not create element with invalid string ID ``
2 participants