GitHub user anthonycorbacho opened a pull request: https://github.com/apache/zeppelin/pull/1588
[ZEPPELIN-1610] [WIP] - Add notebook watcher ### What is this PR for? Add a Simple way to switch a websocket connection to a new state; watcher. A websocket watcher is a special connection that will watch most of the web socket even in Zeppelin, this cam be used to monitor zeppelin server activity. ### What type of PR is it? [Feature] ### Todos * [ ] - Add watcher Queue * [ ] - Add endpoint to switch from regular client to watcher * [ ] - Add a way to generate a uniq key when zeppelin server restart * [ ] - Add example on how to use watcher. ### What is the Jira issue? * [ZEPPELIN-1610](https://issues.apache.org/jira/browse/ZEPPELIN-1610) ### How should this be tested? You will have to create your own websocket client and provide a valid http header (`X-Watcher-Key`) when you connect to zeppelin ws something like ``` private Session openWatcherSession() { ClientUpgradeRequest request = new ClientUpgradeRequest(); request.setHeader(WatcherSecurityKey.HTTP_HEADER, WatcherSecurityKey.getKey()); WatcherWebsocket socket = WatcherWebsocket.createInstace(); Future<Session> future = null; Session session = null; try { future = wsClient.connect(socket, zeppelinWebsocketUrl, request); session = future.get(); } catch (IOException | InterruptedException | ExecutionException e) { LOG.error("Couldn't establish websocket connection to Zeppelin ", e); return session; } return session; } ``` ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? Yes You can merge this pull request into a Git repository by running: $ git pull https://github.com/anthonycorbacho/incubator-zeppelin feat/updateWebsocketInZeppelinHubRepo Alternatively you can review and apply these changes as the patch at: https://github.com/apache/zeppelin/pull/1588.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1588 ---- commit e0333bcafd7ce260ba7e842d324b7174a9850e57 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-10-27T05:11:38Z Add new message type :: Watcher message, this class will wrapp zeppelin ws message and add extra information such as noteId and user commit 248871ee7d2c03c7c075beebf8d114e7c5267685 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-10-27T05:21:09Z Added new WS queue called watcher, watcher will be abler to listen to almost every note action performed in zeppelin notebook websocket server commit 66c86a9809b1e9cf6ffb13dc99401d5d0124eb01 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-10-27T05:21:30Z Add new OP watcher commit b65eda67b47c6bcb65efc2f22ff7176c40b91aa9 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-10-27T08:32:27Z Add zeppelinhub notebook watcher commit 738c6765ba8a90aecbe04feb30d0ae4609675e79 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-10-27T08:32:59Z Strting to rework ZeppelinClient commit cfa0b1644e8e48515b723e979fa04a3c63355264 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-10-27T08:34:58Z make private field public for accessibility commit b16be194feba1379f17976370950a163c2b56076 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-10-27T08:36:15Z Update ping routine commit 479f7bad3c86b041b42fcd4e44c90405fb989d85 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-10-28T04:45:52Z Reorder import :: Google check style commit 615b3899804d383536f59ecc686292fce2c8ac99 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-10-28T04:46:47Z rework watcher creation and ws session with notes commit 51e5792a656a6469dcef1581a4378fbbe3c6ebc5 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-10-28T04:47:38Z Handle remoing wssession from notebook map once the session is close :: avoiding socket connection to be ide commit ce96a3043a9d09fd31c1cb40e56b4300901f47bd Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-11-03T07:39:43Z Add simple Key generation for Watcher ws client commit 31de2bfa4c413df51c3a10c3cd4f4a41d35dd63b Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-11-03T07:41:13Z Add simple check for ws before switching ws client to watcher, client should provide a header X-Watcher-Key with a valid key (generated at runtime), if key invalid client wont be accepted commit 3ac2945d9de8adb65da653a92f6f56542a3e33de Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-11-03T07:42:57Z Add X-Watcher-Key in request header for watcher client commit 25cde1305c62b9437d058e5efd668f3053e146ff Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-11-03T08:17:12Z Light refactoring :: add missing header, add comment, refacto some methods commit b0b8e41bf4e9020aa07913617ea53ddd7fdf5ad3 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-11-03T08:22:54Z fix test commit 0345bec48424da2ba4c8f154fc6bc412e988c648 Author: Anthony Corbacho <corbacho.anth...@gmail.com> Date: 2016-11-03T08:33:12Z Add remove connection from note back in test ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---