Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Commit

Permalink
feat(sentry): capture exercise solved
Browse files Browse the repository at this point in the history
  • Loading branch information
tdelabro committed Jun 3, 2022
1 parent b9d353d commit d1fea3e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/runner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import contextlib
import sentry_sdk
from pathlib import Path
import sys
from threading import Lock
Expand All @@ -13,6 +14,12 @@
check_exercise_lock = Lock()


def capture_exercise_solved(exercise_path: str):
with sentry_sdk.push_scope() as scope:
scope.set_tag("exercise_solved", str(exercise_path))
sentry_sdk.capture_message("Exercise solved", level="info")


class Runner:
def __init__(self, root_path: Path):
self._file_watcher = FileWatcher(root_path)
Expand All @@ -34,6 +41,7 @@ async def _check_exercise(self):
prompt.on_exercise_check(next_exercise_path)
try:
await check_exercise(str(next_exercise_path))
capture_exercise_solved(next_exercise_path)
prompt.on_exercise_success(next_exercise_path)
except ExerciceFailed as error:
prompt.on_exercise_failure(next_exercise_path, error.message)
Expand Down

0 comments on commit d1fea3e

Please sign in to comment.