문제

Starter

Airbrake/Errbit are applications that collect errors generated by other applications, and aggregate the results for review. Airbrake is a commercial app and Errbit is an open-source clone of Airbrake.

Main Course

I need some help figuring out the Errbit API. I'm not talking about the API that you use to send errors to Errbit, but Errbit (and Airbrake) have another API that you use to read data back out of it. The Airbrake API is reasonably well documented, but there are no docs for the Errbit API. I posted a question about their API to the Errbit Google Group, and was told:

  • There are no docs
  • The Errbit API is different to the Airbrake API
  • The Errbit API code is here

I had a look at the code, but being a non-Rubyist, I couldn't make much sense of it.

All I want to do, is get the total number of errors for a particular app (project). If it's only possible to get all the errors, then I could just filter out the errors for the project of interest in the API client.

Could someone familiar with Rails apps, see if the API supports this, and if so, explain how I can invoke it (what URL and params should I use)?

도움이 되었습니까?

해결책

From what I can see you just need to do a GET request to

/api/v1/stats/app?api_key=XXXXXX

Where XXXXX is the api key of the app you want to get the params for. This call will return a json wit the following information:

stats = {
  :name => @app.name,
  :last_error_time => @last_error_time,
  :unresolved_errors => @app.unresolved_count
}

If you need more information you can always modify the file: /app/controllers/api/v1/stats_controller.rb to include the relevant information

다른 팁

After a quick view in api/v1/problems you can access a comprehensive list of problems with related information such as app_id, app_name, resolved status, and more. You can filter the results by start and end date. Same for "notices" in api/v1/notices. So at that address the information you need should be available.

In api/v1/stats you will get an object with the app_name, and last time of unresolved error and those. In stats an api_key to authenticate the app is required; however, no api_key requirement is found in /problems or /notices, which is strange.

Anyway, it seems that Errbit is something to be installed in your own server, so you can modify the code to find the information you need, right? The app object seems to have a problems method that should be suitable for what you need.

Hope that helps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top