Raygun Feature Request

Feature Request

Queued exception reports (Java Client)

Current Status:

New

Votes:

2


Avatar

reezom

I'm using Raygun with a Google App Engine (GAE) web application. With GAE, you're only given a small time slot to respond to a web request. Thus, I do not want to submit my Raygun exception report synchronously. Unfortunately, GAE also does not allow you to open another thread and submit the report from there. The correct procedure is to queue the report and send the exception later, from the queue handler.

To accomplish this, I patched the Java client lib (see below), to give me a serialized version of the exception report, that I can safely store in the queue. It would be great if you could provide something along these lines as an official feature to replace my dirty patch!

Cheers FF

Patches: RaygunServletClient.java, added:

public String BuildSerializedMessage(Throwable throwable)
{
    RaygunMessage raygunMessage = BuildServletMessage(throwable);
    return new Gson().toJson(raygunMessage);
}

RaygunClient.java, added (more or less copy and paste from the Post method:

    public int PostSerializedMessage(String serializedMessage) 
{
    try
    {
        if (ValidateApiKey())
        { 
            HttpURLConnection connection = this.raygunConnection.getConnection(_apiKey);

            OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
            writer.write(serializedMessage);
            writer.flush();
            writer.close();             
            connection.disconnect();
            return connection.getResponseCode();

        }
    }
    catch (Exception e)
    {
  Logger.getLogger("Raygun4Java").warning("Couldn't post exception: " + e.getMessage());
    }
    return -1;
}

There are no comments.