server: add raygun

This commit is contained in:
Marks Polakovs 2020-04-10 13:03:08 +02:00
parent e0039e653e
commit e48a9dd8ae
4 changed files with 29 additions and 2 deletions

2
.gitignore vendored
View file

@ -27,3 +27,5 @@ yarn-error.log*
.mypy_cache/
env/
shittyserver.ini

View file

@ -1,11 +1,16 @@
aioice==0.6.18
aiortc==0.9.27
av==7.0.1
blinker==1.4
certifi==2020.4.5.1
cffi==1.14.0
chardet==3.0.4
crc32c==2.0
cryptography==2.8
idna==2.9
JACK-Client==0.5.2
jedi==0.15.2
jsonpickle==1.3
mypy==0.770
mypy-extensions==0.4.3
netifaces==0.10.9
@ -18,8 +23,11 @@ pyls==0.1.6
pyls-mypy==0.1.8
python-jsonrpc-server==0.3.4
python-language-server==0.31.9
raygun4py==4.3.0
requests==2.23.0
six==1.14.0
typed-ast==1.4.1
typing-extensions==3.7.4.2
ujson==1.35
urllib3==1.25.8
websockets==8.1

View file

@ -10,7 +10,21 @@ import jack as Jack # type: ignore
import os
import re
from datetime import datetime
from typing import Optional, Any
from typing import Optional, Any, Type
from types import TracebackType
import sys
from raygun4py import raygunprovider # type: ignore
import configparser
config = configparser.ConfigParser()
config.read("shittyserver.ini")
def handle_exception(exc_type: Type[BaseException], exc_value: BaseException, exc_traceback: TracebackType) -> None:
cl = raygunprovider.RaygunSender(config["raygun"]["key"])
cl.send_exception(exc_info=(exc_type, exc_value, exc_traceback))
sys.excepthook = handle_exception
file_contents_ex = re.compile(r"^ws=\d$")
@ -211,6 +225,7 @@ class Session(object):
self.connection_id = uuid.uuid4()
self.connection_state = "HELLO"
print(self.connection_id, "Connected")
# TODO Raygun user ID
await websocket.send(
json.dumps({"kind": "HELLO", "connectionId": str(self.connection_id)})
)

2
shittyserver.ini.example Normal file
View file

@ -0,0 +1,2 @@
[raygun]
key = CHANGEME