Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Support Airbrake V3 API. #163

Closed
benarent opened this Issue Jan 5, 2013 · 4 comments

Comments

Projects
None yet
2 participants
Contributor

benarent commented Jan 5, 2013

Airbrake version 2, provides a JSON API. It allows for significant performance and is JSON.

This only work for users posting to collect.airbrake.io.

The notice URL has changed, Requiring both Project_ID and API Key, and the scheme has changed.

http://help.airbrake.io/kb/api-2/notifier-api-v3

POST http://collect.airbrake.io/api/v3/projects/PROJECT_ID/notices?key=API_KEY
Content-Type: application/json

{
  "notifier": {
    "name":    "notifier name",
    "version": "notifier version",
    "url":     "notifier url"
  },
  "errors": [
    {
      "type":      "error1",
      "message":   "message1",
      "backtrace": [
        {
          "file": "backtrace file",
          "line": 10,
          "function": "backtrace function"
        }
      ]
    },
    {
      "type":      "error2",
      "message":   "message2",
      "backtrace": [
        {
          "file": "backtrace file",
          "line": 10,
          "function": "backtrace function"
        }
      ]
    }
  ],
  "context": { // Optional.
    "os": "Linux 3.5.0-21-generic #32-Ubuntu SMP Tue Dec 11 18:51:59 UTC 2012 x86_64",
    "language": "Ruby 1.9.1",
    "environment": "production",

    "version": "1.1.1",
    "url:": "http://some-site.com/example",
    "rootDirectory": "/home/app-root-directory",

    "userId": "12345",
    "userName": "root",
    "userEmail": "root@root.com",
  },
  "environment": {}, // Optional.
  "session": {}, // Optional.
  "params": {} // Optional.
}

collect.airbrake.io still XML accepts notices posted to http://collect.airbrake.io/notifier_api/v2/notices

@ghost ghost assigned shime Jan 5, 2013

Contributor

benarent commented Jan 5, 2013

Don't set this as default, but maybe auto-set it to JSON if the user is posting to collect.airbrake.io

shime added a commit that referenced this issue Jan 8, 2013

Contributor

shime commented Jan 8, 2013

Ok, I've added this. Should I add an entry for this to the wiki?

Sending to new JSON API is enabled only if host is set to collect.airbrake.io and project_id is not blank. Silent fallback to the old API included.

Your Airbrake configuration should look something like this:

Airbrake.configure do |config|
  config.api_key = "my_api_key1234567"
  config.project_id = 12345 # can also be string
  config.host = "collect.airbrake.io"
end

I've also added additional elements to the JSON schema. component and action to context to be more specific.

Contributor

benarent commented Jan 8, 2013

@shime Looks great. Let's add a page to the wiki and push it.

Contributor

shime commented Jan 8, 2013

Cool. Added it here.

@shime shime closed this Jan 8, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment