sentry-extensions / cyclops

Cyclops is meant to be a high performance barrier in front of Sentry (http://getsentry.com).
http://sentry-extensions.github.io/cyclops/
163 stars 15 forks source link

Ravenjs >= 2.0 support #30

Closed sokil closed 1 year ago

sokil commented 7 years ago

Raven prior to v2 (up to 1.3) had the following payload based on GET request:

https://cyclops/api/1/store/?sentry_version=7&sentry_client=raven-js/1.3.0&sentry_key=a533644da64e5232377aeb94de0c53eb&sentry_data=%SENTRY_DATA%

Where the %SENTRY_DATA% is urlencoded stringified JSON:

{
  "project":"1",
  "logger":"my.module",
  "platform":"javascript",
  "request":{
    "headers":{
      "User-Agent":"Mozilla/5.0"
    },
    "url":"http://domain.com/raven.1.3.0.html"
  },
  "exception":{
    "values":[
      {
        "type":"Error",
        "value":"errMsg",
        "stacktrace":{
          "frames":[
            {
              "filename":"http://domain.com/raven.1.3.0.html",
              "lineno":13,
              "colno":25,
              "function":"HTMLButtonElement.onclick",
              "in_app":true
            },
            {
              "filename":"http://domain.com/raven.1.3.0.html",
              "lineno":9,
              "colno":19,
              "function":"f",
              "in_app":true
            }
          ]
        }
      }
    ]
  },
  "culprit":"http://domain.com/raven.1.3.0.html",
  "message":"Error: errMsg",
  "extra":{
    "planet":{
      "name":"Earth"
    },
    "session:duration":5170
  },
  "event_id":"8bba97f719294b01b4eca860b41af197"
}

Starting from version 2.0 Raven use POST method instead of GET and POST data to URI in the following format:

https://cyclops/api/1/store/?sentry_version=7&sentry_client=raven-js%2F3.17.0&sentry_key=a533644da64e5232377aeb94de0c53eb

The body has the same format:

{
  "project":"1",
  "logger":"my.module",
  "platform":"javascript",
  "request":{
    "headers":{
      "User-Agent":"Mozilla/5.0"
    },
    "url":"http://domain.com/raven.1.3.0.html"
  },
  "exception":{
    "values":[
      {
        "type":"Error",
        "value":"errMsg",
        "stacktrace":{
          "frames":[
            {
              "filename":"http://domain.com/raven.1.3.0.html",
              "lineno":13,
              "colno":25,
              "function":"HTMLButtonElement.onclick",
              "in_app":true
            },
            {
              "filename":"http://domain.com/raven.1.3.0.html",
              "lineno":9,
              "colno":19,
              "function":"f",
              "in_app":true
            }
          ]
        }
      }
    ]
  },
  "culprit":"http://domain.com/raven.1.3.0.html",
  "extra":{
    "planet":{
      "name":"Earth"
    },
    "session:duration":1521
  },
  "event_id":"3a7f3b10d06a4fa48cd50e899175b886"
}

The difference:

GET requests contains sentry_data, POST request doesn't POST requests contains stringified JSON in body