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

Commit 17c55fb

Browse files
feat: add monitoring using Sentry
1 parent f64047e commit 17c55fb

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

poetry.lock

Lines changed: 35 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pytest-mock = "^3.7.0"
1818
python = ">=3.8 <3.9"
1919
watchdog = "^2.1.7"
2020
starklings-protostar = "^0.2.1"
21+
sentry-sdk = "^1.5.12"
2122

2223
[tool.poetry.dev-dependencies]
2324
GitPython = "^3.1.27"

src/cli.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
from pathlib import Path
2+
import sentry_sdk
23
from .runner import Runner
34
from .verify import ExerciseSeeker
45
from .constants import exercise_files_architecture
56
from .utils.starklings_directory import StarklingsDirectory, VersionManager
67
from .solution import SolutionPatcher
78

89

10+
sentry_sdk.init(
11+
"https://73212d09152344fd8e351ef180b8fa75@o1254095.ingest.sentry.io/6421829",
12+
# Set traces_sample_rate to 1.0 to capture 100%
13+
# of transactions for performance monitoring.
14+
# We recommend adjusting this value in production.
15+
traces_sample_rate=1.0,
16+
)
17+
18+
919
async def cli(args, script_root: Path):
1020
starklings_directory = StarklingsDirectory(script_root)
1121
version_manager = VersionManager(starklings_directory)
@@ -14,10 +24,12 @@ async def cli(args, script_root: Path):
1424
version_manager.print_current_version()
1525

1626
if args.watch:
27+
sentry_sdk.capture_message("Starting the watch mode")
1728
runner = Runner(script_root)
1829
runner.run()
1930

2031
if args.verify:
32+
sentry_sdk.capture_message("Verifying all the exercises")
2133
seeker = ExerciseSeeker(exercise_files_architecture, script_root)
2234
exercise_path = seeker.find_next_exercise()
2335

@@ -27,6 +39,9 @@ async def cli(args, script_root: Path):
2739
print(exercise_path)
2840

2941
if args.solution:
42+
sentry_sdk.capture_message(
43+
"Displaying the solution", path_to_solution=args.solution
44+
)
3045
displayer = SolutionPatcher(args.solution)
3146
solution = displayer.get_solution()
3247
if solution:

0 commit comments

Comments
 (0)