Sync Gateway: Debugging information about who gets a particular document

29 views
Skip to first unread message

Rajagopal V

unread,
Aug 4, 2014, 6:28:15 AM8/4/14
to mobile-c...@googlegroups.com
Right now, ChangesFeed  on SyncGateway prints log messages with the Sequence, the documentId as well as the revisions being sent to a particular client. It would be very helpful to know which client also receives the change so debugging is easier. I have a patch that adds this information in the Changes+ Log messages (in the same line that sends the information about sequence etc.) and it seems to work well. For e.g. this is how it looks after my patch:

13:43:57.834421 Changes: MultiChangesFeed({*}, {Since:1304 Limit:50 Conflicts:true IncludeDocs:false Wait:true Continuous:false Terminator:0xc2107799c0}) ...  (to client_1_13_6)
client_1_13_6 is my authenticated Android Client. 

I can submit a Pull Request if you think it will be helpful for everyone. My idea is to form a complete logstream between mobile clients , sync gateway and my connecting glue so that I can trace where a document is going and if its received by all clients that have access to that document. Without the authentication details, its impossible to get that information from sync gateway.

Thanks
Raja
 

Jens Alfke

unread,
Aug 4, 2014, 11:51:27 AM8/4/14
to mobile-c...@googlegroups.com

On Aug 4, 2014, at 3:28 AM, Rajagopal V <raja...@gmail.com> wrote:

13:43:57.834421 Changes: MultiChangesFeed({*}, {Since:1304 Limit:50 Conflicts:true IncludeDocs:false Wait:true Continuous:false Terminator:0xc2107799c0}) ...  (to client_1_13_6)

In other words, you’re appending the user ID to that log message? Seems like a good idea; we’ll take a pull request for that :)

My idea is to form a complete logstream between mobile clients , sync gateway and my connecting glue so that I can trace where a document is going and if its received by all clients that have access to that document. Without the authentication details, its impossible to get that information from sync gateway.

Sounds like you’re planning to build something based on parsing/scraping the log output from the gateway? I don’t feel comfortable with that; I consider the logs to be for development and debugging purposes, and the messages can and do change often. I don’t want the possibility of someone’s system breaking because I change or remove a log message. But I can see the value of what you’re proposing; it might even be a useful tool in QA’ing the Gateway itself. Can you give more detail about what you want to do?

—Jens

Rajagopal V

unread,
Aug 4, 2014, 1:33:59 PM8/4/14
to mobile-c...@googlegroups.com


On Monday, August 4, 2014 9:21:27 PM UTC+5:30, Jens Alfke wrote:

On Aug 4, 2014, at 3:28 AM, Rajagopal V <raja...@gmail.com> wrote:

13:43:57.834421 Changes: MultiChangesFeed({*}, {Since:1304 Limit:50 Conflicts:true IncludeDocs:false Wait:true Continuous:false Terminator:0xc2107799c0}) ...  (to client_1_13_6)

In other words, you’re appending the user ID to that log message? Seems like a good idea; we’ll take a pull request for that :)

Ill create a PR for that. Adding the userId to that and a few other messages in the same method. 
 

My idea is to form a complete logstream between mobile clients , sync gateway and my connecting glue so that I can trace where a document is going and if its received by all clients that have access to that document. Without the authentication details, its impossible to get that information from sync gateway.

Sounds like you’re planning to build something based on parsing/scraping the log output from the gateway? I don’t feel comfortable with that; I consider the logs to be for development and debugging purposes, and the messages can and do change often. I don’t want the possibility of someone’s system breaking because I change or remove a log message. But I can see the value of what you’re proposing; it might even be a useful tool in QA’ing the Gateway itself. Can you give more detail about what you want to do?

I did not mean for this to be part of sync gateway but more of what I was planning to do to our application for having complete traceability. We have iOS/android clients talking to a Sync gateway and a custom python listener that also listens to SG , gets the documents and posts it to a PHP Server. The other way communication also happens -- from PHP to Sync Gateway through to the mobiles. I am using Logstash to analyze the logs from our custom python listener to know which documents are travelling from mobile to server and vice-versa, but obviously that does not give full traceability. For e.g. if one of our clients indicates that a certain document isnt with him, it would be hard to find out. My plan was , with the patch on MultiChangesFeed, I can feed that to Logstash and provide a combined path covering Sync Gateway and the mobiles. Obviously, I cannot make that work for all SG users  since the python script is custom.

Thanks
Raja

Reply all
Reply to author
Forward
0 new messages