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

Add new Servicegraph visualization. #3318

Merged
merged 2 commits into from
Feb 9, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Review Comments.
  • Loading branch information
jeffmendoza committed Feb 8, 2018
commit b93ed7d16b96daf19d6770aaef6f7b0bb847c926
10 changes: 5 additions & 5 deletions addons/servicegraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ deploying and using Servicegraph is
## Visualizations

- `/force/forcegraph.html` is an interactive
[D3.js](https://d3js.org/) visualization. This graph only displays
services that are currently receiving traffic.
[D3.js](https://d3js.org/) visualization.

- `/dotviz` is a static [Graphviz](https://www.graphviz.org/)
visualization.
Expand All @@ -29,14 +28,15 @@ deploying and using Servicegraph is

## Query Parameters

All endpoints except for `/force/forcegraph.html` take these query parameters:
All endpoints take these query parameters:

- `time_horizon` controls the timespan to consider for graph
generation.
generation. Format is a number plus a time unit. Example `15s` or
`1m`. Default is `5m`.

- `filter_empty=true` will restrict the nodes and edges shown to only
those that reflect non-zero traffic levels during the specified
`time_horizon`.
`time_horizon`. Deafult is `false`.

# Demosvc service
Defined in `servicegraph/cmd/demosvc`, this provides a simple HTTP
Expand Down
4 changes: 4 additions & 0 deletions addons/servicegraph/force/forcegraph.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ table, th, td {
.conn-table {
margin: 20px;
}

div.float {
position:absolute;
}
4 changes: 4 additions & 0 deletions addons/servicegraph/force/forcegraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<link rel="stylesheet" href="forcegraph.css">
</head>
<body>
<div id="title" class="float">
<h2>Istio Service Graph</h2>
Click on a service for traffic information
</div>
<div id="total">
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add some text to this page that describes what it is and how to use (a la "click on nodes to see metrics")?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will Do.

<div id="graph"></div>
<div id="info"></div>
Expand Down
24 changes: 23 additions & 1 deletion addons/servicegraph/force/forcegraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,33 @@ d3cola.on("tick", function () {

});

var endpoint = "/d3graph";

(function(){
var query={};
var i=0;
var tele;
var search_values=location.search.replace('\?','').split('&');
for(i=0;i<search_values.length;i++){
telem=search_values[i].split('=');
query[telem[0]]=telem[1];
}

if (query.time_horizon != undefined && query.filter_empty != undefined) {
endpoint = endpoint + "?time_horizon=" + query.time_horizon +
"&filter_empty=" + query.filter_empty;
} else if (query.time_horizon != undefined) {
endpoint = endpoint + "?time_horizon=" + query.time_horizon;
} else if (query.filter_empty != undefined) {
endpoint = endpoint + "?filter_empty=" + query.filter_empty;
}
}());

refresh()
d3.interval(refresh, 5000)

function refresh() {
d3.json("/d3graph?time_horizon=10s&filter_empty=true", updateData);
d3.json(endpoint, updateData);
return true;
}

Expand Down