Last active
July 4, 2019 12:44
-
-
Save krisleech/15e21858f7570b35869e4853877a7296 to your computer and use it in GitHub Desktop.
Sentry and Rocketchat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Script { | |
process_incoming_request({ request }) { | |
if(request.content.event.request == undefined) { url = 'n/a' } else { url = request.content.event.request.url } | |
return { | |
content:{ | |
text: "[" + request.content.message + "](" + request.content.url + ")", | |
attachments: [ | |
{ | |
collapsed: false, | |
title: "Culprit", | |
text: request.content.culprit, | |
color: "red", | |
fields: [ | |
{ | |
short: true, | |
title: "Project", | |
value: request.content.project_name | |
}, | |
{ | |
short: true, | |
title: "Level", | |
value: request.content.level | |
}, | |
{ | |
short: true, | |
title: "Environment", | |
value: request.content.event.environment | |
}, | |
{ | |
short: true, | |
title: "Server", | |
value: url | |
}, | |
] | |
} | |
], | |
username: 'Rocket.Cat' | |
} | |
}; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
project_name: 'Dolly', | |
message: 'This is an example Python exception', | |
id: '1083661128', | |
culprit: 'raven.scripts.runner in main', | |
project_slug: 'dolly', | |
url: 'https://sentry.io/organizations/<SNIP>/issues/1083661128/?referrer=webhooks_plugin', | |
level: 'error', | |
triggering_rules: [], | |
"event": { | |
stacktrace: { frames: [Object] }, | |
extra: { emptyList: [], unauthorized: false, emptyMap: {}, url: 'http://example.org/foo/bar/', results: [Object], length: 10837790, session: [Object] }, modules: { 'my.package': '1.0.0' }, | |
_ref_version: 2, | |
_ref: 1488826, | |
id: 62093257713, | |
culprit: 'raven.scripts.runner in main', | |
title: 'This is an example Python exception', | |
event_id: 'c147251e983940ca92e383608090c3e8', | |
environment: 'prod', | |
platform: 'python', | |
version: '5', | |
location: null, | |
template: { abs_path: '/srv/example/templates/debug_toolbar/base.html', pre_context: [Object], post_context: [Object], filename: 'debug_toolbar/base.html', lineno: 14, context_line: ' data-store-id="{{ toolbar.store_id }}" data-render-panel-url="{% url \'djdt:render_panel\' %}"<br>' }, | |
logger: '', | |
type: 'default', | |
metadata: { title: 'This is an example Python exception' }, | |
tags: [ [Object], [Object], [Object], [Object], [Object], [Object], [Object], [Object] ], | |
timestamp: 1561969991.347, | |
user: { username: 'sentry', name: 'Sentry', ip_address: '127.0.0.1', email: 'sentry@example.com', geo: [Object], id: '1' }, | |
fingerprint: [ '{{ default }}' ], | |
hashes: [ 'c4a4d06bc314205bb3b6bdb612dde7f1' ], | |
received: 1561969991.347, | |
level: 'error', | |
contexts: { os: [Object], browser: [Object] }, | |
request: { cookies: [Object], url: 'http://example.com/foo', headers: [Object], env: [Object], fragment: null, query_string: [Object], data: [Object], method: 'GET', inferred_content_type: 'application/json' }, | |
logentry: { message: null, params: null, formatted: 'This is an example Python exception' } | |
}, | |
project: 'dolly', | |
logger: null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment