Monday, June 29, 2009

Dumpcatcher: Uncaught Exceptions and Client IDs

Alright, about halfway through my flight and I now have an Uncaught exception handler that will post messages to dumpcatcher.

It doesn't work with android at the momement... There is a thread I know I have to read on android-developers. I think I starred it because I knew I'd find it uuseful.

The first user of this class was going to be Foursquared, but it turns out the code I wrote doesn't work.

I quickly added the ability to create a client id attached to each crash in order to allow me track each individual client and in the process refactored a bit of the code here and there. I'll have to remeber to update the design doc as I have made some changes to the design after noticing flaws in my original work.

Labels: , ,

Sunday, June 28, 2009

Dumpcatcher: Java Client

I'm on my way back from Cambodia... More on that later...

After spending about two-three hours working on hmac signing with Java I now have a working Dumpcatcher client for Java, this is similar to the python client

clients/python/logging/handler.py:Dumpcatcher
in that its usage is:
Dumpcatcher dc = new Dumpcatcher(PRODUCT_KEY, SECRET, "http://localhost:8080/add", 2);
HttpResponse response = dc.sendCrash(
    new NameValuePair("short", "Some short dump"),
    new NameValuePair("long", "some long dump")
)
    assertNotNull(response);
    assertEquals(200, response.getStatusLine().getStatusCode());

Have a look: http://code.google.com/p/dumpcatcher/source/browse/clients/java/src/com/googlecode/dumpcatcher/logging/Dumpcatcher.java?r=20090629r0

Now onto making a logging client for this guy.

Labels: ,

Monday, June 22, 2009

Dumpcatcher: Python Client

For the python dumpcatcher client I decided to go with the standard python logging infrastructure. While there was definitely something lacking in the python documentation for logging.py I found all the information I needed with a combination of the docs and the source code itself. Creating a python client for the dumpcatcher is now pretty simple:
import handler  # from dumpcatcher.clients.python.logging

logger = logging.getLogger('my_tag')
logger.setLevel(logging.DEBUG)  
logger.addHandler(
      DumpcatcherHandler('agtkdW1wY2F0Y2hlcnINCxIHUHJvZHVjdBgCDA',
                         '9b6c65910428419db0d0b730278b72e3',
                         'http://localhost:8080/add',
                         5))


try:
  'a' + 1  # TypeError!
except Exception, e:
  logger.exception('Oh man! Look at this!')
The output of which looks something like:
2009-06-21 06:36:57 demo 40
handler.py:110:broken Oh man! Look at this!
handler.py:110:broken Oh man! Look at this!
Traceback (most recent call last):
File "/home/jlapenna/code/dumpcatcher/clients/python/logging/handler.py", line 108, in broken
  'a' + 1
TypeError: cannot concatenate 'str' and 'int' objects
File "/home/jlapenna/code/dumpcatcher/clients/python/logging/handler.py", line 110, in broken
  logger.exception('Oh man! Look at this!')
Looking at this now, it seems that all I have left is the java client and data aggregation before I'm feature complete!

Labels: ,

Dumpcatcher: Python HTTP and Dates libraries

Sheesh,

Python really shows its age when you have to deal with dates, http and urls. I was able to implement my signing and verification bit of code just now and it was quite a pain. I have a sample client in clients/python/example.py and the endpoint/crash.Add handler should show you the inverse side of the handshake.

The thing that was definitely most challenging was writing the example client. Because the python libraries for http, etc evolved over time there are about seventy-five ways to do an http request instead of python's normal "one."

Same can be said for datetime modules. Long ago when we had to use mx time there was a DateTime object, now its built into python so everything should be peachy? Yeah, date handling in python was improved by this change but timezones are still outrageous! Considering I'm now about 10 hours off UTC, I have had to think about how to submit a request in string form. For now though I'm going to punt and require that times submitted are in the UTC time zone.

Now that I've got that baked in, I can acutally write the code that logs the requests to the data store. After that, I need to write a bit of code to do sorting and aggregating of the crash dump data.

Labels: ,

Dumpcatcher: HTML

Wow, its been quite a while since I've written any HTML. Probably about one year. Its also been that long since I last used AppEngine and as a result I'm really, really rusty.

I'm now about 3 hours into the hack-a-thon (on a plane instead of of a coffee shop) and I have about 10 hours of battery life remaining.

Things I've learned so far:

I totally forgot the basic IO operations for the app engine data store and with this kind of knowledge its actually pretty hard to re-learn -- I remember such random bits and pieces I forget which parts are bad memory or actuality.

The design doc was fun to write, I had to think about a few different problems that I figured I would encounter. I even realized that my initial idea for request signing had some security vunerabilities which I had to think about how to resolve.

I have one third of the whole project done, but its the smallest one third. Users are now able to register their account and create an unlimited number of products.

Next, I need to write the server side component of crash logging. Eg, when a user submits a crash the request must be authorizedand then it needs to get into the datastore.

Labels: , ,

Friday, June 19, 2009

Dumpcatcher

I took the day off in order to spend it writing some code. My goal for today is to finish with a fully-functional exception catcher for my projects so that I don't have to require users to send me tracebacks or exceptions when they occur.

I started by registering http://dumpcatcher.appspot.com. I will be pushing frequently to this site as I add features. I chose App Engine because I like that its hassle-free application deployment. Launch the app, run it, walk away and it should just work!

Second, I registered http://dumpcatcher.googlecode.com. I will be pushing the code here pretty much just as frequently as I push the site. I chose Mercurial as the SCM because I am sick and tired of git.

So... Let me begin...

Addendum: I actually ended up going into work instead of taking the day off and coded this on a flight to Cambodia.

Labels: , , ,

The views and opinions expressed in the blog are of Joe LaPenna. Google has nothing to do with these pages.
For information about Google please visit: Google Press Center