-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
@shrikrishnaholla Lets write test cases. Most of us ignore the importance of test cases. If we start writing test cases early in the project, it makes sure that there are minimal bugs as we move along and it helps in preventing regression bugs. |
I agree with with Sandeep. I gave it a quick run through and it looks good. And, ship it! |
@phalgun When me and @shrikrishnaholla were discussing about this a few days back, we thought using a cloud storage which has an API (for example, Dropbox) to place the old logs. What we had thought of was to have the most recent logs (say of the last 7 days) in memory/db. Everything is logged to a file but only the last 7 days' logs are kept fresh. Very old logs would be pushed to a cloud storage and each log file has a set of metadata (keywords, discussion topics which are mined, etc) and this also adds to some metadata which is stored in a db about every log file. To summarize, the storage goes something like this -
@shrikrishnaholla hoping that this hasn't changed. |
@sathyamvellal search is not implemented in 0.1 . But yeah, the plan is to store the mined metadata of complete history in elasticsearch indices (it is recommended to keep the number of indexed documents in elasticsearch as small as possible) and as @phalgun said, maybe archive very past history, keeping recent history in files. Cloud storage may not be advisable because the network latency while downloading the stored documents would be very expensive. |
I wouldn't suggest cloud storage either except for periodic backups of archived logs. My 2 cents - since #pes-os gets very less traffic unless there are meetings scheduled, using an complicated storage structure might be an overkill. Memory management can be worked on when there is a need to do so. As with the other issue, I think using a buffer is a good idea and its implementation would be simple too. To tackle search inconsistencies, maybe we could write the buffer into the DB/file/ES before starting the search operation. But then it depends on the frequency of search or list commands we get. |
@shrikrishnaholla https://github.com/shrikrishnaholla I don't think a But if we really want to use a buffer, how about providing an option for On Tue, Dec 24, 2013 at 9:24 AM, Phalgun Guduthur
Regards, |
default: | ||
break; | ||
}; | ||
message = '[' + (new Date()).toISOString() + ']:\t' + from + ':\t' + message + '\n'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be made more generic so that the format can be picked up from the config file as per the user wish. We cannot assume here that everyone needs logs in this format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 3deec14
@shrikrishnaholla @akshayms @phalgun @sathyamvellal couple of things based on this pull request,
|
and to get some ideas on log archival & quick searching we can draw some inspiration by looking at how phenny handles it. |
@sandeepraju +1 The default process of writing into a file with non-blocking calls should suffice. And let's think of a design where we could support plugins for Optimus at a later stage - Users should be able to customize and add special plugins to the codebase. For example, if someone wants to check the latest 5 commits on pesos, it should be written as a plugin to Optimus than a core feature. |
@akshayms @sandeepraju The file writes are implemented in async mode itself. I suggested buffers because while testing it, I found that, if there are a lot of comments coming in, and in between someone requests the logs, there is a huge delay. This is because each message generates a file write, and since there are a lot of messages coming in, the operations are queued, and the log command generates a read operation which joins this queue - it has to wait till all previous operations are complete. One way to avoid file write delay was to use streams. I tried using them in two approaches.
|
Can't we maintain the last 200 messages in memory? That shouldn't take too
|
Yep. Only, instead of some number like 200, we can keep them in a buffer in memory when there is a lot of activity (say, during meetings) and write them in bulk when idle. It's okay if someone asks for logs when the channel is idle and the bot has to fetch it from file. A single read/write operation doesn't take a lot of time. The problem occurs when there are a lot of operations queued up. As for detecting whether the channel is busy or idle, I have no idea how to implement it (yet). But seems the best method to tackle this problem. |
1. Adds a configuration file that replaces previously hardcoded values with configuration values that are picked up by relevant modules (ref: pesos#1 (comment) , pesos#1 (comment), pesos#1 (comment) ) 2. Separates scheduler from the main util module and adds one more (mkfilenamer) 3. Interaction between view and controller is made event driven. Previously was callback driven. 4. Elasticsearch is commented out because it is not being used in v0.1.0 anyway
This pull request adds the following features
!logs <number>
or!log <number>