{"id":19242892,"url":"https://github.com/ricequant/rqalpha-mod-sentry","last_synced_at":"2025-04-21T09:32:41.675Z","repository":{"id":57462957,"uuid":"87950859","full_name":"ricequant/rqalpha-mod-sentry","owner":"ricequant","description":"Rqalpha 集成 sentry 的扩展 Mod。实现错误日志全自动采集、处理","archived":false,"fork":false,"pushed_at":"2017-04-12T03:26:58.000Z","size":10,"stargazers_count":10,"open_issues_count":1,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-01T12:04:07.756Z","etag":null,"topics":["quant","rqalpha","rqalpha-mod","sentry"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ricequant.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-11T15:32:38.000Z","updated_at":"2023-07-19T11:04:17.000Z","dependencies_parsed_at":"2022-09-05T15:40:50.915Z","dependency_job_id":null,"html_url":"https://github.com/ricequant/rqalpha-mod-sentry","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqalpha-mod-sentry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqalpha-mod-sentry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqalpha-mod-sentry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricequant%2Frqalpha-mod-sentry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ricequant","download_url":"https://codeload.github.com/ricequant/rqalpha-mod-sentry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248777940,"owners_count":21160062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["quant","rqalpha","rqalpha-mod","sentry"],"created_at":"2024-11-09T17:15:54.584Z","updated_at":"2025-04-21T09:32:41.352Z","avatar_url":"https://github.com/ricequant.png","language":"Python","readme":"==================\nrqalpha-mod-sentry\n==================\n\n\nRQAlpha 集成 `Sentry`_ 日志收集 Mod\n\nSentry 是一个开源的实时错误收集平台，您可以通过 Sentry 快速查看和追踪错误日志。\n\n您可以选择使用 `Sentry 线上平台`_ ，也可以选择自己搭建 `Sentry Server`_\n\n当您已经获取 Sentry Server Url (类似于 'https://\u003ckey\u003e:\u003csecret\u003e@sentry.io/\u003cproject\u003e' )，就可以通过该 Mod 将 RQAlpha 运行的日志集成至 Sentry 了。\n\n安装前\n====================================\n\n请务必确认已经参考 `RQAlpha 安装指南`_ 安装了最新版本的 RQAlpha\n\n安装 rqalpha-mod-sentry\n====================================\n\n当 RQAlpha 安装之后，你可以执行以下命令来安装/卸载该 Mod:\n\n..  code-block::\n\n    # 安装\n    $ rqalpha mod install sentry\n\n    # 卸载\n    $ rqalpha mod uninstall sentry\n\n之后您可以执行以下命令来启动/关闭该 Mod:\n\n..  code-block::\n\n    # 启用\n    $ rqalpha mod enable sentry\n\n    # 关闭\n    $ rqalpha mod disable sentry\n\n配置项\n====================================\n\n*   url: \u003cstr\u003e 需要指定 sentry 系统所对应的路径，比如 https://****@sentry.io/rqalpha_sample'\n*   tags: \u003clist\u003e 指定您希望发送日志时包含的 config 参数。因为参数是多级的，我们约定以 `__` 来区分，比如说想指定 :code:`mod.sys_risk.validate_position` 在 sentry 日志中显示，则将其转换成 :code:`mod__sys_risk__validate_position`\n\n如下是默认配置项:\n\n..  code-block::\n\n    {\n        \"url\": None,\n        \"tags\": [\n            \"base__start_date\",\n            \"base__end_date\",\n            \"base__stock_starting_cash\",\n            \"base__future_starting_cash\",\n            \"base__securities\",\n            \"base__run_type\",\n            \"base__frequency\",\n            \"base__benchmark\",\n        ]\n    }\n\n您可以在您的 `config.yml` 文件中添加来修改默认配置\n\n..  code-block::\n\n    mod:\n        url: https://your_own_domain@sentry.io/rqalpha_sample\n        tags: [\n            base__start_date\n            base__end_date\n            base__stock_starting_cash\n            base__future_starting_cash\n            base__securities\n            base__run_type\n            base__frequency\n            base__benchmark\n            mod__sys_risk__validate_position\n        ]\n\n您也可以直接在代码中指定配置信息:\n\n..  code-block::\n\n    from rqalpha import run\n    config = {\n        \"base\": {\n            \"strategy_file\": \"strategy.py\",\n            \"securities\": [\"stock\"],\n            \"start_date\": \"2015-01-09\",\n            \"end_date\": \"2015-03-09\",\n            \"frequency\": \"1d\",\n            \"stock_starting_cash\": 100000,\n        }\n        \"mod\": {\n            \"sentry\": {\n                \"enabled\": True,\n                \"url\": \"https://your_own_domain@sentry.io/rqalpha_sample\",\n                \"tags\": [\n                    \"base__start_date\",\n                    \"base__end_date\",\n                    \"base__stock_starting_cash\",\n                    \"base__future_starting_cash\",\n                    \"base__securities\",\n                    \"base__run_type\",\n                    \"base__frequency\",\n                    \"base__benchmark\",\n                    \"mod__sys_risk__validate_position\"\n                ]\n            }\n        }\n    }\n    run(config)\n\n在启动该 Mod 的情况下，\n\n您也可以直接通过 :code:`rqalpha run` 增加 `--sentry target_sentry_server_url` 选项来开启 Sentry 日志收集服务\n\n.. code-block::\n\n    $ rqalpha run -f strategy.py --sentry https://your_own_domain@sentry.io/rqalpha_sample\n\n.. _Sentry: https://sentry.io/welcome/\n.. _Sentry Server: https://docs.sentry.io/server/\n.. _Sentry 线上平台: https://sentry.io/welcome/\n.. _RQAlpha 安装指南: http://rqalpha.readthedocs.io/zh_CN/latest/intro/install.html\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricequant%2Frqalpha-mod-sentry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricequant%2Frqalpha-mod-sentry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricequant%2Frqalpha-mod-sentry/lists"}