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

csdsclient: add visualization #15

Merged
merged 68 commits into from
Aug 7, 2020
Merged

Conversation

Rainton
Copy link
Contributor

@Rainton Rainton commented Jul 31, 2020

This PR includes adding flag -visualization to show the relationship between xDS in the config in response.

Details:

  • Added flag -visualization and added support to it

  • Solved conflicts between -visualization and -monitor_interval

  • Added test for visualization

Signed-off-by: Yutong Li [email protected]
/cc @fuqianggao @alexburnos

Rainton added 30 commits July 9, 2020 00:50
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
solved some format issue

Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
Signed-off-by: Yutong Li <[email protected]>
@Rainton
Copy link
Contributor Author

Rainton commented Jul 31, 2020

/cc @htuch @dschaller

@fuqianggao
Copy link
Contributor

fuqianggao commented Jul 31, 2020

/cc @dio @therealmitchconnors

@therealmitchconnors
Copy link

I really like this feature. I'm a little unclear on the details though. What questions is the visualization intended to solve? Can you describe the rules used to build the graphviz markup? Does color represent sync status? perhaps a key section would be useful...

@Rainton
Copy link
Contributor Author

Rainton commented Aug 4, 2020

@therealmitchconnors Sorry for my unclear expression.

The detailed config in response is always so long that users cannot figure out the relationships between each xDS easily. The visualization feature is used to give users a clear view of the relationships by going through the detailed config, storing relationships between xDS in maps, drawing a graph by marking xDS as nodes and relationships as edges. Different colors represent different xDS types, such as LDS, RDS, CDS, and EDS.

Maybe you can take a look at this sample graph to get clearer to what this feature would be like.

The user scenario may be like this: the user sees the graph and finds that there are two RDSs here and both of them are related to the CDS0. If the user want to see the detailed config of one of the RDS, he can just hovers the mouse over the specific RDS node and its real name will shows. Then the user can find the config of this RDS easily by searching this real name in the detailed config.

@@ -10,7 +10,7 @@ For now, this initial version of this CSDS client only supports GCP's [Traffic D
# Running
* run with `./bin/csds <flag>`, e.g. <br/><br/>
* auto authentication mode
```
```bash
./bin/csds \
-service_uri <uri> \
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe consider change this to csds-client?

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've modified the Makefile to run go install to build the binary under GOPATH/bin. In this way, the binary will be renamed as csds-client and we can just run it with csds-client <flag>

csds-client/README.md Show resolved Hide resolved
csds-client/README.md Outdated Show resolved Hide resolved
csds-client/README.md Outdated Show resolved Hide resolved
csds-client/README.md Outdated Show resolved Hide resolved
csds-client/client/client.go Outdated Show resolved Hide resolved
rds := make(map[string]string)
cds := make(map[string]string)
ldsToRds := make(map[string]*treeset.Set)
rdsToCds := make(map[string]*treeset.Set)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should also handle cds to eds

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about adding handler for cds to eds in the v3 PR? Since for v2, there should not be eds in the detailed config?

Copy link
Contributor

Choose a reason for hiding this comment

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

SG.

Copy link
Member

@dio dio left a comment

Choose a reason for hiding this comment

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

Few comments. And it can be cleaned up in the next iteration.

csds-client/client/util.go Outdated Show resolved Hide resolved
Comment on lines +4 to 21
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"

"github.com/awalterschulze/gographviz"
"github.com/emirpasic/gods/sets/treeset"
envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2"
envoy_config_filter_http_router_v2 "github.com/envoyproxy/go-control-plane/envoy/config/filter/http/router/v2"
envoy_config_filter_network_http_connection_manager_v2 "github.com/envoyproxy/go-control-plane/envoy/config/filter/network/http_connection_manager/v2"
csdspb "github.com/envoyproxy/go-control-plane/envoy/service/status/v2"
envoy_type_matcher "github.com/envoyproxy/go-control-plane/envoy/type/matcher"
Copy link
Member

Choose a reason for hiding this comment

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

I'll enable a linter soon. So hopefully sorting this import will be "standardized".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool! Thanks a lot!

csds-client/client/response_for_visualization.json Outdated Show resolved Hide resolved
if err != nil {
t.Errorf("Generate graph failure:%v", err)
}
want := "digraph G {\nrankdir=LR;\n\\\"test_lds_0\\\"->\\\"test_rds_0\\\"[ arrowsize=0.3, penwidth=0.3 ];\n\\\"test_lds_0\\\"->\\\"test_rds_1\\\"[ arrowsize=0.3, penwidth=0.3 ];\n\\\"test_rds_0\\\"->\\\"test_cds_0\\\"[ arrowsize=0.3, penwidth=0.3 ];\n\\\"test_rds_0\\\"->\\\"test_cds_1\\\"[ arrowsize=0.3, penwidth=0.3 ];\n\\\"test_rds_1\\\"->\\\"test_cds_1\\\"[ arrowsize=0.3, penwidth=0.3 ];\n\\\"test_cds_0\\\" [ color=\\\"#34A853\\\", fillcolor=\\\"#34A853\\\", fontcolor=white, fontname=Roboto, label=CDS0, shape=box, style=\\\"\"filled,rounded\"\\\" ];\n\\\"test_cds_1\\\" [ color=\\\"#34A853\\\", fillcolor=\\\"#34A853\\\", fontcolor=white, fontname=Roboto, label=CDS1, shape=box, style=\\\"\"filled,rounded\"\\\" ];\n\\\"test_lds_0\\\" [ color=\\\"#4285F4\\\", fillcolor=\\\"#4285F4\\\", fontcolor=white, fontname=Roboto, label=LDS0, shape=box, style=\\\"\"filled,rounded\"\\\" ];\n\\\"test_rds_0\\\" [ color=\\\"#FBBC04\\\", fillcolor=\\\"#FBBC04\\\", fontcolor=white, fontname=Roboto, label=RDS0, shape=box, style=\\\"\"filled,rounded\"\\\" ];\n\\\"test_rds_1\\\" [ color=\\\"#FBBC04\\\", fillcolor=\\\"#FBBC04\\\", fontcolor=white, fontname=Roboto, label=RDS1, shape=box, style=\\\"\"filled,rounded\"\\\" ];\n\n}\n"
Copy link
Member

Choose a reason for hiding this comment

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

Have a comment to "manually" review this? A link to that viewer site with this data?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I modified this test to open two windows in the browser to show the expected graph and the generated graph. Does this make sense?

csds-client/client/client_test.go Show resolved Hide resolved
csds-client/client/client.go Outdated Show resolved Hide resolved
@dio
Copy link
Member

dio commented Aug 7, 2020

Seems like you need to merge master.

@Rainton
Copy link
Contributor Author

Rainton commented Aug 7, 2020

@dio Sorry about that. I've just merged.

@dio dio merged commit f6b73a4 into envoyproxy:master Aug 7, 2020
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.

4 participants