Skip to content

Commit

Permalink
Add: Sentry を導入
Browse files Browse the repository at this point in the history
  • Loading branch information
tsukumijima committed Dec 30, 2024
1 parent dfa21b0 commit 86b6bbb
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 4 deletions.
79 changes: 77 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ gputil = "^1.4.0"
psutil = "^6.1.1"
py-cpuinfo = "^9.0.0"
wmi = {version = "^1.5.1", platform = "win32"}
sentry-sdk = {version = "^2.19.2", extras = ["fastapi"]}
# truststore は HTTPS 通信時にシステムにインストールされた証明書ストアを使うために必要
## ref: https://github.com/psf/requests/issues/2966
## ref: https://truststore.readthedocs.io/en/latest/
Expand Down
2 changes: 1 addition & 1 deletion resources/engine_manifest_assets/dependency_licenses.json

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from pathlib import Path
from typing import TextIO, TypeVar

import sentry_sdk
import uvicorn
from pydantic import TypeAdapter

Expand Down Expand Up @@ -345,7 +346,24 @@ def main() -> None:
if args.output_log_utf8:
set_output_log_utf8()

# 起動の一番早い段階で実行結果をキャッシュしておくのが重要
# Sentry によるエラートラッキングを開始
# ref: https://docs.sentry.io/platforms/python/integrations/fastapi/
sentry_sdk.init(
dsn="https://ebdf5cc288b3ab31a262186329ff3a95@o4508551725383680.ingest.us.sentry.io/4508555159470080",
release=f"AivisSpeech-Engine@{__version__}",
environment="development" if __version__ == "latest" else "production",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
traces_sample_rate=1.0,
_experiments={
# Set continuous_profiling_auto_start to True
# to automatically start the profiler on when
# possible.
"continuous_profiling_auto_start": True,
},
)

# 起動時の可能な限り早い段階で実行結果をキャッシュしておくのが重要
generate_user_agent("GPU" if args.use_gpu is True else "CPU")

logger.info(f"AivisSpeech Engine version {__version__}")
Expand Down

0 comments on commit 86b6bbb

Please sign in to comment.