Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
daabr committed Jan 10, 2025
1 parent 08989fa commit fa9b4af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
14 changes: 8 additions & 6 deletions ops/alert_on_session_errors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ to look for sessions that ended with an error status in the previous minute.

1. Generate a personal API auth token in the web UI:

1. Click your user icon in the bottom-left corner of the page
2. Click the "Client Setup" menu option to go to that page
3. Click the "Generate Token" button, and copy the generated
[JWT](https://jwt.io/)
- Click your user icon in the bottom-left corner of the page
- Click the "Client Setup" menu option to go to that page
- Click the "Generate Token" button, and copy the generated
[JWT](https://jwt.io/)

2. Import/upload the project
3. Initialize your connections
4. Set/modify these project variables:

- `AUTOKITTEH_API_BASE_URL` (default = `https://api.autokitteh.cloud`)
- `AUTOKITTEH_UI_BASE_URL` (default = `https://app.autokitteh.cloud`)
- `AUTOKITTEH_API_BASE_URL` (default = `https://api.autokitteh.cloud`,
use `http://localhost:9980` for self-hosted servers)
- `AUTOKITTEH_UI_BASE_URL` (default = `https://app.autokitteh.cloud`,
use `http://localhost:9982` for self-hosted servers)
- `AUTOKITTEH_AUTH_TOKEN`: the API auth token generated in step 1 above
- `SLACK_CHANNEL`: send alert messages to this Slack channel name/ID
(default = `autokitteh-alerts`)
Expand Down
7 changes: 3 additions & 4 deletions ops/alert_on_session_errors/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from requests import exceptions


API_BASE_URL = os.getenv("AUTOKITTEH_API_BASE_URL", "https://api.autokitteh.cloud")
UI_BASE_URL = os.getenv("AUTOKITTEH_UI_BASE_URL", "https://app.autokitteh.cloud")
API_BASE_URL = os.getenv("AUTOKITTEH_API_BASE_URL", "")
UI_BASE_URL = os.getenv("AUTOKITTEH_UI_BASE_URL", "")
JWT = os.getenv("AUTOKITTEH_AUTH_TOKEN", "")
SLACK_CHANNEL = os.getenv("SLACK_CHANNEL", "")

Expand Down Expand Up @@ -44,8 +44,7 @@ def _list_sessions_with_errors():

resp = requests.post(url, headers=headers, json={"stateType": 3}, timeout=10)
print(f"API call's Round Trip Time: {resp.elapsed}")
if not resp.ok:
resp.raise_for_status()
resp.raise_for_status()

try:
return resp.json().get("sessions", [])
Expand Down

0 comments on commit fa9b4af

Please sign in to comment.