当前位置:网站首页>Sentry developer contribution Guide - configure pycharm
Sentry developer contribution Guide - configure pycharm
2022-07-03 00:39:00 【I am for less】

summary
If you use PyCharm Development , You need to configure some content to run and debug .
This document describes some pairs sentry Develop useful configurations
To configure
Python Interpreter :( Make sure it's venv Interpreter ) for example ~/venv/sentry/bin/python

To create a configuration (run/debug To configure ), Just go to Run | Edit Configurations...( It can also be used in the default toolbar ).

Test runner
Sentry Use pytest Unit test .
establish pytest To configure ( stay Python tests Next )
Set a goal (Set Target): Custom
Additional parameters (Additional Arguments): tests/sentry

Have everything you need Dev server
Used in all settings (web、worker、cron) Operation in case of ( Non debugging ):
- Create another
Python To configure - Script path (
Script path): <venv dir>/bin/sentry e.g. ~/venv/sentry/bin/sentry - Parameters (
Parameters): devserver --workers - Python Interpreter (
Python interpreter): venv interpreter - working directory (
Working dir): (sentry In the installation directory src route ) e.g. ~/dev/sentry/src
Note: You will not be able to debug with this configuration Web Worker(Web Worker By calling uwsgi The server started ).

Use PyCharm debug
devserver Commands exist mainly to generate daemons in separate processes , This means that in default mode debugger Attaching to it is not very useful .
Web server
devserver The command has a special sign , It will lead to web server Start in the thread of the same process ( Not as web Daemon ). This allows you to start devserver In the same PyCharm "Debug" Actions are attached to web server And at the end of the life after the breakpoint .
Clone your devserver Run the configuration and set --debug-server Add to "Parameters" End of field . By choice "Debug" instead of "Run" To start it .
--debug-server Flags may cause the process to not respond correctly SIGINT And the shutdown is less elegant than the original configuration . It is recommended to keep both , Match the first with Run Command is used together , Match the second with Debug Command is used together .
You can use --workers Logo and --debug-server Keep together , But please pay attention to , It is impossible to attach breakpoints to workers , Nor can it be attached to by devserver Any other daemons generated .
Independent daemons
To put debugger Append to Division web A single daemon outside , Please create a running configuration for the daemon . The following attributes should be related to your devserver The configuration is the same .( You can clone it and only change Parameters Field .)
- Script path (
Script path): <venv dir>/bin/sentry, for example : ~/venv/sentry/bin/sentry - Python Interpreter (
Python interpreter): venv interpreter - working directory (
Working dir): (sentry In the installation directory src route ) for example ~/dev/sentry/src
Set the parameters of the new run configuration to start the daemon run command , for example :
-
run cron -
run worker -c 1
Tips and troubleshooting
- If you want to debug it , The same set of modifications will apply to
getentry Operation configuration of the project . -
PyCharm Of Compound The run configuration type is useful for starting multiple run configurations at once . If you are debugging one or more independent daemons that work with the development server , Then it may be convenient to set one .

- If you wish
Sentry The behavior in the debugging environment is different from that in the normal operation , You can add any environment variable , Then in your .sentry/sentry.conf.py Check them in the file .
for example , The screenshot below shows debugging disabled APM Sampling settings ( Because stopping at the breakpoint will pollute the time measurement ). Please note that ,PYCHARM_DEBUG It's an arbitrary name ; It's right PyCharm and Sentry There is no special significance .

- If the daemon you run alone doesn't work , You can debug
devserver --debug-server And in src/sentry/runner/commands/devserver.py Insert breakpoints on to troubleshoot . This will allow you to manually check devserver Command running command .( Look near the bottom manager.add_process call .) Try adjusting the parameters in the run configuration to match these commands , If they haven't yet .

边栏推荐
- 【小程序项目开发-- 京东商城】uni-app之自定义搜索组件(中)-- 搜索建议
- Helm basic learning
- 【JetCache】JetCache的配置说明和注解属性说明
- Blue decides red - burst CS teamserver password
- [shutter] image component (load network pictures | load static pictures | load local pictures | path | provider plug-in)
- Multi process programming (III): message queue
- Explain in detail the significance of the contour topology matrix obtained by using the contour detection function findcontours() of OpenCV, and how to draw the contour topology map with the contour t
- redis21道经典面试题,极限拉扯面试官
- Bypass AV with golang
- [golang syntax] map common errors golang panic: assignment to entry in nil map
猜你喜欢

Multiprocess programming (II): Pipeline

Linux软件:如何安装Redis服务

Pageoffice - bug modification journey

1.12 - 指令

Logback configuration file

奥斯陆大学:Li Meng | 基于Swin-Transformer的深度强化学习

Cmake basic use

Callback event after the antv X6 node is dragged onto the canvas (stepping on a big hole record)

Understanding and application of least square method

Use Jenkins II job
随机推荐
v8
图解网络:什么是虚拟路由器冗余协议 VRRP?
form表单实例化
[Luogu p4320] road meets (round square tree)
Tensorflow 2.x(keras)源码详解之第十五章:迁移学习与微调
文件操作IO-Part2
详解用OpenCV的轮廓检测函数findContours()得到的轮廓拓扑结构(hiararchy)矩阵的意义、以及怎样用轮廓拓扑结构矩阵绘制轮廓拓扑结构图
An excellent orm in dotnet circle -- FreeSQL
Multiprocess programming (I): basic concepts
Is there a free text to speech tool to help recommend?
Rust string slicing, structs, and enumeration classes
使用jenkins之二Job
Nc50528 sliding window
毕业总结
Overlay of shutter (Pop-Up)
The most painful programming problem in 2021, adventure of code 2021 Day24
DotNet圈里一个优秀的ORM——FreeSql
One of the reasons why setinterval timer does not take effect in ie: the callback is the arrow function
MySQL 23道经典面试吊打面试官
百度智能云牵头打造智能云综合标准化平台