Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging and replaying RealityServer Web Services requests

I am trying to diagnose a problem with my RealityServer application, however it is becoming very time consuming to manually reproduce problems using my applications user interface.

Is there any way to log and replay the JSON-RPC Web Services commands that RealityServer receives so I can reproduce my problems without using the applications user interface?

like image 321
Claudio Bredfeldt Avatar asked Aug 05 '15 09:08

Claudio Bredfeldt


2 Answers

RealityServer provides two tools for monitoring requests. The main one you are probably interested in this case is the Commandlog plugin which ships with RealityServer but is disabled by default. You need to edit your realityserver.conf file and uncomment the relevant lines. Here is the relevant part of the file:

# uncomment below to enable the command logging state handler.
# this will record every JSON-RPC command received during a RealityServer
# session into a python script which can later be replayed to re-run the
# session. this can be useful for tracking down bugs.
# note that when enabled this will overwrite the replay.py file every
# time RealityServer starts so you must ensure you make a copy of any
# file you wish to keep. The file is created in the working directory,
# not the RealityServer root.
<url .*>
state Commandlog_state_handler
</url>

As described enabling this state handler will record all JSON-RPC requests into a special Python file. You can then run this file like so:

python replay.py 127.0.0.1:8080

This will then send the sequence of recorded commands to the running RealityServer. The commands will be exactly the same as those recorded but will not include timing so will be played back as fast as possible. If your issue is timing sensitive you may need to use an alternative method to capture and replay the data.

NOTE: RealityServer overwrites the replay.py file on startup, so you must copy the file to another name if you wish to retain it between starts. If you use a script to automatically restart RealityServer you will need to take care to include a step to copy the file out.

If you wish to log all HTTP requests and not just the JSON-RPC requests there is also the following realityserver.conf option you can add for this:

http_log access.log

This will log all requests in the Apache Log format which can be useful for use with tools supporting that format. A full list of RealityServer configuration options can be found here.

like image 108
Paul Arden Avatar answered Nov 20 '22 08:11

Paul Arden


Either write your own program for it in any programming language of your choice, or try out Fiddler. Fiddler can record HTTP sessions and replay them.

like image 34
MichaelK Avatar answered Nov 20 '22 08:11

MichaelK