Lot of times developers want to know
1) How many exceptions are happening in a 100 node cluster
2) When I do a new release are the no of exceptions growing or decreasing
3) What are my top 5 exceptions in the app that I need to focus on
4) overall are there any nodes where some exception is happening a lot of times compared to other nodes.
Getting all this statistics is tricky as you have to parse logs and aggregate what not so all this is messy and time consuming. Also when nodes are added/removed from cluster you have to change the script.
Solution I came up was very simple
1) 90% of the time the exceptions are logged using logger so I overrode the logger.error method and would get first 100 chars out of exception stacktrace keep a counter in a static in memory hashmap.
2) Some exceptions that are never logged so I wrote a servlet filter to catch them in a top level filter and log them to logger that way it would be counted.
3) I wrote a quartz job at the end of the day to print all this information in memory to scribe.
4) Scibe logs from all app nodes are sent to scribe server(We use it for other purposes but I piggy backed on it). The logs are rolled once a day.
5) Wrote a python program that listens to scribe log file rollover at the end of day and combines exception counters from all nodes and generates a sweet report and mails it to developers.
6) Next goal is to add these statistics counters to graphite dashboard so we can trend them and get the 4 requirements I highlighted above.
1) How many exceptions are happening in a 100 node cluster
2) When I do a new release are the no of exceptions growing or decreasing
3) What are my top 5 exceptions in the app that I need to focus on
4) overall are there any nodes where some exception is happening a lot of times compared to other nodes.
Getting all this statistics is tricky as you have to parse logs and aggregate what not so all this is messy and time consuming. Also when nodes are added/removed from cluster you have to change the script.
Solution I came up was very simple
1) 90% of the time the exceptions are logged using logger so I overrode the logger.error method and would get first 100 chars out of exception stacktrace keep a counter in a static in memory hashmap.
2) Some exceptions that are never logged so I wrote a servlet filter to catch them in a top level filter and log them to logger that way it would be counted.
3) I wrote a quartz job at the end of the day to print all this information in memory to scribe.
4) Scibe logs from all app nodes are sent to scribe server(We use it for other purposes but I piggy backed on it). The logs are rolled once a day.
5) Wrote a python program that listens to scribe log file rollover at the end of day and combines exception counters from all nodes and generates a sweet report and mails it to developers.
6) Next goal is to add these statistics counters to graphite dashboard so we can trend them and get the 4 requirements I highlighted above.
Comments
Post a Comment