Skip to content

Commit 32ee6e8

Browse files
committed
Update: --disable_sentry 引数を追加
1 parent 23b4975 commit 32ee6e8

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

run.py

+24-14
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class CLIArgs:
162162
setting_file: Path
163163
preset_file: Path | None
164164
disable_mutable_api: bool
165+
disable_sentry: bool
165166
# 以下は極力 VOICEVOX ENGINE との差分を最小限にするための互換用
166167
# 対応する引数は AivisSpeech Engine では常に無効化されている
167168
voicevox_dir: Path | None = None # 常に None
@@ -310,6 +311,12 @@ def read_cli_arguments(envs: Envs) -> CLIArgs:
310311
),
311312
)
312313

314+
parser.add_argument(
315+
"--disable_sentry",
316+
action="store_true",
317+
help="Sentry によるエラーログ収集を無効化します。",
318+
)
319+
313320
args_dict = vars(parser.parse_args())
314321

315322
# NOTE: 複数個の同名引数に基づいてリスト化されるため `CLIArgs` で複数形にリネームされている
@@ -344,25 +351,28 @@ def main() -> None:
344351

345352
# Sentry によるエラートラッキングを開始
346353
# ref: https://docs.sentry.io/platforms/python/integrations/fastapi/
347-
sentry_sdk.init(
348-
dsn="https://ebdf5cc288b3ab31a262186329ff3a95@o4508551725383680.ingest.us.sentry.io/4508555159470080",
349-
release=f"AivisSpeech-Engine@{__version__}",
350-
environment="development" if __version__ == "latest" else "production",
351-
# Set traces_sample_rate to 1.0 to capture 100%
352-
# of transactions for tracing.
353-
traces_sample_rate=1.0,
354-
_experiments={
355-
# Set continuous_profiling_auto_start to True
356-
# to automatically start the profiler on when
357-
# possible.
358-
"continuous_profiling_auto_start": True,
359-
},
360-
)
354+
if not args.disable_sentry:
355+
sentry_sdk.init(
356+
dsn="https://ebdf5cc288b3ab31a262186329ff3a95@o4508551725383680.ingest.us.sentry.io/4508555159470080",
357+
release=f"AivisSpeech-Engine@{__version__}",
358+
environment="development" if __version__ == "latest" else "production",
359+
# Set traces_sample_rate to 1.0 to capture 100%
360+
# of transactions for tracing.
361+
traces_sample_rate=1.0,
362+
_experiments={
363+
# Set continuous_profiling_auto_start to True
364+
# to automatically start the profiler on when
365+
# possible.
366+
"continuous_profiling_auto_start": True,
367+
},
368+
)
361369

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

365373
logger.info(f"AivisSpeech Engine version {__version__}")
374+
if args.disable_sentry:
375+
logger.info("Sentry error tracking is disabled.")
366376
logger.info(f"Engine root directory: {engine_root()}")
367377
logger.info(f"User data directory: {get_save_dir()}")
368378

0 commit comments

Comments
 (0)