Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add sentry to project #12

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@ queue = "queue/<username>/test"
password = "<pulse-password>"
ssl = true

[sentry]
sentry_url = ""

[clones]
directory = "../git_hg_sync_repos/"

5 changes: 5 additions & 0 deletions git_hg_sync/__main__.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
import sys
from pathlib import Path

import sentry_sdk
from kombu import Connection, Exchange, Queue
from mozlog import commandline

@@ -69,6 +70,10 @@ def main() -> None:
args = parser.parse_args()
logger = commandline.setup_logging("service", args, {"raw": sys.stdout})
config = Config.from_file(args.config)
sentry_config = config.sentry
if sentry_config and sentry_config.sentry_url:
logger.info(f"sentry url: {sentry_config.sentry_url}")
sentry_sdk.init(sentry_config.sentry_url)
start_app(config, logger)


5 changes: 5 additions & 0 deletions git_hg_sync/config.py
Original file line number Diff line number Diff line change
@@ -27,8 +27,13 @@ class ClonesConfig(pydantic.BaseModel):
directory: pathlib.Path


class SentryConfig(pydantic.BaseModel):
sentry_url: str | None = None


class Config(pydantic.BaseModel):
pulse: PulseConfig
sentry: SentryConfig | None = None
clones: ClonesConfig
tracked_repositories: list[TrackedRepository]
mappings: list[Mapping]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ name = "git-hg-sync"
readme = "README.md"
requires-python = ">=3.10"
version = "0.1"
dependencies = ['kombu', 'mozillapulse', 'GitPython', 'mozlog', "pydantic"]
dependencies = ['kombu', 'mozillapulse', 'GitPython', 'mozlog', "pydantic", "sentry_sdk"]

[tool.ruff]
line-length = 100