mirror of
https://github.com/usestrix/strix.git
synced 2026-08-23 03:12:37 +02:00
Add PostHog integration for analytics and error debugging
This commit is contained in:
+27
-4
@@ -34,6 +34,7 @@ from strix.interface.utils import (
|
||||
validate_llm_response,
|
||||
)
|
||||
from strix.runtime.docker_runtime import HOST_GATEWAY_HOSTNAME, STRIX_IMAGE
|
||||
from strix.telemetry import posthog
|
||||
from strix.telemetry.tracer import get_global_tracer
|
||||
|
||||
|
||||
@@ -514,10 +515,32 @@ def main() -> None:
|
||||
|
||||
args.local_sources = collect_local_sources(args.targets_info)
|
||||
|
||||
if args.non_interactive:
|
||||
asyncio.run(run_cli(args))
|
||||
else:
|
||||
asyncio.run(run_tui(args))
|
||||
is_whitebox = bool(args.local_sources)
|
||||
|
||||
posthog.start(
|
||||
model=os.getenv("STRIX_LLM"),
|
||||
scan_mode=args.scan_mode,
|
||||
is_whitebox=is_whitebox,
|
||||
interactive=not args.non_interactive,
|
||||
has_instructions=bool(args.instruction),
|
||||
)
|
||||
|
||||
exit_reason = "user_exit"
|
||||
try:
|
||||
if args.non_interactive:
|
||||
asyncio.run(run_cli(args))
|
||||
else:
|
||||
asyncio.run(run_tui(args))
|
||||
except KeyboardInterrupt:
|
||||
exit_reason = "interrupted"
|
||||
except Exception as e:
|
||||
exit_reason = "error"
|
||||
posthog.error("unhandled_exception", str(e))
|
||||
raise
|
||||
finally:
|
||||
tracer = get_global_tracer()
|
||||
if tracer:
|
||||
posthog.end(tracer, exit_reason=exit_reason)
|
||||
|
||||
results_path = Path("strix_runs") / args.run_name
|
||||
display_completion_message(args, results_path)
|
||||
|
||||
Reference in New Issue
Block a user