netsage-project / netsage-sankey-panel

Apache License 2.0
9 stars 5 forks source link

Dynamic multi-hops with just two columns #24

Open pakerfeldt opened 5 months ago

pakerfeldt commented 5 months ago

First I want to say, there are other issues reported where the root cause is likely the same. I just want to collect my findings and try to explain the issue more concretely.

There seems to be a limitation in this plugin in that you cannot draw a graph with simply source and destination that potentially skips hops if not necessary, or where middle-hops isn't drawn on the very left side. Let me provide an example created from https://observablehq.com/@mbostock/flow-o-matic. image

As you can see, the input data only contains source and destination. Miami, being both referenced as a source and a destination is not drawn on the left side but in the middle in the graph. Same with Frankfurt.

If you try to produce the same graph in Grafana, it will look something like this: image

(My data source is currently BigQuery, which is why you see the SQL query to provide the data)

Given that the underlying library d3-sankey supports this more complex structure while still only providing two columns, I get the feeling that the grafana plugin is making some assumptions on data or just inputting the data into d3-sankey the wrong way.

First of all, I just wanna confirm I'm not doing something wrong but that there's actually a limitation in the plugin. Is that correct? I know it's been suggested to add extra columns but that will not solve issue since the produced graph still doesn't look like the top one as expected.

KatrinaTurner commented 4 months ago

Hi! Thanks for bringing this to my attention. I have some time slotted next week to work on this plugin and will take a look. Its been a while since I looked at the code, but there are definitely some assumptions that had to be made to feed the data into the d3 library, but I will try to see if I can fix some of that by adding more options to the plugin.

pakerfeldt commented 4 months ago

I appreciate that, thank you! Fully understand this is pro-bono but hope you're able to spot the issue. If there is anything else I can provide, just let me know.

anydef commented 2 months ago

@pakerfeldt just tried to make it make it work with dynamic links for myself. I've looked into the source code and it seems that implementation expects "node hops" to be sourced from different columns. (Which is convenient if you want to avoid managing loops)

@KatrinaTurner is there a plan to support this behavior?