A rather opinionated tool to raise alerts and report data.
She is watching your application with great concern
pip install git+http://[email protected]/tapway/raven.gitThis is what you get from the default settings, you can also choose to extend this with the barebone API.
from raven.utils import alert
@alert(
config_path="raven_config.yaml"
)
def division(a, b):
x = a / b
division(1, 0)- Create a secret in AWS secret manager with BOT_TOKEN variable in the secret
- Make sure the machine/pod/container has appropriate permissions to get secrets from AWS Secrets Manager
- You have your config yaml file in correct directory
Example yaml file,
channels:
alert_channel: CXXXXXXXXXX # can be obtained from slack channel settings
cloudwatch: <IF YOU HAVE A CLOUDWATH PREFIX URL | OPTIONAL>
service: <YOUR SERVICE NAME | OPTIONAL>
params: <IF YOU WISH TO HAVE INPUT PARAMS | OPTIONAL>
aws_sm_secret: <YOUR SECRET NAME>
aws_region: <YOUR AWS REGION>Note: For cloudwatch link to work, your app should be running in a kubernetes cluster, otherwise, it will skip sending the cloudwatch link.
Sends alert to the first channel in the yaml file,
from raven.utils import alert
@alert(
config_path="raven_config.yaml"
)
def division(**kwargs):
x = kwargs.get("a") / kwargs.get("b")
division(a=1, b=0)Sends alert to specified channel in the yaml file,
from raven.utils import alert
@alert(
config_path="raven_config.yaml",
channel="alert_channel"
)
def division(**kwargs):
x = kwargs.get("a") / kwargs.get("b")
division(a=1, b=0)from raven.utils import send_alert
def division(**kwargs):
try:
x = kwargs.get("a") / kwargs.get("b")
except Exception:
# for raven to catch this error
send_alert_with_config(
config_path="raven_config.yaml"
)
division(a=1, b=0)Example yaml file,
channels:
alert_channel: CXXXXXXXXXX # can be obtained from slack channel settings
cloudwatch: <IF YOU HAVE A CLOUDWATH PREFIX URL | OPTIONAL>
service: <YOUR SERVICE NAME | OPTIONAL>
params: <IF YOU WISH TO HAVE INPUT PARAMS | OPTIONAL>Note: For cloudwatch link to work, your app should be running in a kubernetes cluster, otherwise, it will skip sending the cloudwatch link.
Sends alert to the first channel in the yaml file,
from raven.utils import alert
@alert(
config_path="raven_config.yaml",
token=<BOT_TOKEN>
)
def division(**kwargs):
x = kwargs.get("a") / kwargs.get("b")
division(a=1, b=0)Sends alert to specified channel in the yaml file,
from raven.utils import alert
@alert(
config_path="raven_config.yaml",
token=<BOT_TOKEN>,
channel="alert_channel"
)
def division(**kwargs):
x = kwargs.get("a") / kwargs.get("b")
division(a=1, b=0)from raven.utils import send_alert
def division(**kwargs):
try:
x = kwargs.get("a") / kwargs.get("b")
except Exception:
# for raven to catch this error
send_alert_with_config(
config_path="raven_config.yaml",
token=<BOT_TOKEN>
)
division(a=1, b=0)from raven.utils import alert
@alert(
token=<YOUR SLACK TOKEN>,
channel_id=<YOUR SLACK CHANNEL ID>,
)
def division(**kwargs):
x = kwargs.get("a") / kwargs.get("b")
division(a=1, b=0)from raven.utils import send_alert
def division(**kwargs):
try:
x = kwargs.get("a") / kwargs.get("b")
except Exception:
# for raven to catch this error
send_alert(
token=<YOUR SLACK TOKEN>,
channel_id=<YOUR SLACK CHANNEL ID>,
)environment can be passed as an optional param in all options
callbacks can be passed as an optional param in all options
Contributions are welcomed. View CONTRIBUTING.md

