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 the feature of viewing traffic inside every node in the cluster #90

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sebb7
Copy link

@sebb7 sebb7 commented Nov 12, 2017

It is now possible to view message passing inside each node in the cluster on the epl_traffic tab. In general, you can click on other nodes (not just default) and see traffic inside.

Major changes were made in epl_traffic module but I changed a bit epl_viz_map and epl_ets_viz_map modules. Details:

  • Change epl_ets_viz_map:clean_ets_traffic_from_viz/2 function and move it to epl_viz_map in order to make it publicly accessible for the future use.
  • Modify epl_viz_map:pull_node/2 so that it does not crash when the pulled node does not exist,
  • Subscribe epl_traffic to all tracers and add functions which make it possible to create Vizceral map with data from all nodes. The map is still sent to epl_traffic subscribers every 5 seconds which is the moment it gets the message from the default_node. To wrap it up, this solution allows epl_traffic to build, manipulate and update the Vizceral map with data from all nodes and sents it out with all details about all nodes included.

Issues with the view of nodes which are not default_node - graphic representations of processes are sometimes overlap or the view is almost empty. I think that it can by caused by lack of message passing in the observed nodes. I watched the traffic inside the nodes while running Mnesia example from README and it seems to work decently - I could see message passing between some Mnesia processes.

Guys, please let me know what you think :) @michalslaski @arkgil @baransu @mkacper

To be honest, it is my first contribution to a real project. Thanks to @mkacper for the introduction to ErlangPL and pair-programming sessions which enabled me to create this PR! :)

  - Modify epl_viz_map:pull_node/2 to do not crash when pulled
    node does not exist
  - Change epl_ets_viz_map:clean_ets_traffic_from_viz/2 function
    and move it to epl_viz_map in order to make it publicly
    accessible for the future use
  - Subscribe epl_traffic to all nodes and update Vizceral map
    for each incoming massage from tracers; added required
    functions
@@ -94,7 +90,71 @@ code_change(_OldVsn, State, _Extra) ->
%%%===================================================================
%%% Internal functions
%%%===================================================================
verify_subscribe_reply(Reply) ->
lists:all(fun(X) -> X =:= ok end, Reply).
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe could you use R instead of X inside the fun? R is closer to Reply than X :)

{Region, _} = epl_viz_map:pull_region(Node, OldViz),
merge_focused_nodes_and_conns(Node, Viz, Region).

merge_focused_nodes_and_conns(_Node, Viz, []) ->
Copy link
Contributor

@mkacper mkacper Nov 12, 2017

Choose a reason for hiding this comment

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

Maybe better name for this function would be finally_merge_focused_nodes_and_conns(...)?

%% @doc Clears all focused nodes from `RegionName` node.
-spec clear_focused_nodes_inside_region(RegionName :: name(), Viz :: map()) ->
map().
clear_focused_nodes_inside_region(RegionName, Viz) ->
Copy link
Contributor

@mkacper mkacper Nov 12, 2017

Choose a reason for hiding this comment

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

What do you think about using clear_focused_nodes_and_conns(...) here?


finally_merge_focused_nodes_and_conns(Viz, UpdatedRegion, Regions) ->
maps:merge(Viz, #{nodes => [UpdatedRegion | Regions]}).

get_message_passing_counters(Node, Proplist, Vizceral, OldMsgPass) ->
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 that update_message_passing_counters would be more proper here after your changes :)

finally_merge_focused_conns(Region, OldFocusedConns) ->
maps:merge(Region, #{connections => OldFocusedConns}).

finally_merge_focused_nodes_and_conns(Viz, UpdatedRegion, Regions) ->
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about finally_merge_regions(...) here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants