当前位置:网站首页>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 .

边栏推荐
- kubernetes编写yml简单入门
- [IELTS reading] Wang Xiwei reading P1 (reading judgment question)
- [shutter] Introduction to the official example of shutter Gallery (project introduction | engineering construction)
- 简单聊聊运维监控的其他用途
- About qbytearray storage hexadecimal and hexadecimal conversion
- There is an unknown problem in inserting data into the database
- Shell implements basic file operations (SED edit, awk match)
- Pytorch 20 realizes corrosion expansion based on pytorch
- Rust ownership (very important)
- 为什么网站打开速度慢?
猜你喜欢

Hdu3507 (slope DP entry)

Pageoffice - bug modification journey

Attributeerror: 'tuple' object has no attribute 'layer' problem solving

多进程编程(一):基本概念

Detailed explanation of pod life cycle

Is there a free text to speech tool to help recommend?

【单片机项目实训】八路抢答器

Cmake basic use

Why is the website slow to open?

DotNet圈里一个优秀的ORM——FreeSql
随机推荐
Nc17059 queue Q
[target detection] r-cnn, fast r-cnn, fast r-cnn learning
Markdown tutorial
pageoffice-之bug修改之旅
DotNet圈里一个优秀的ORM——FreeSql
[MCU project training] eight way answering machine
1.11 - 总线
Two common methods and steps of character device registration
One of the reasons why setinterval timer does not take effect in ie: the callback is the arrow function
Cmake basic use
关于QByteArray存储十六进制 与十六进制互转
Andorid gets the system title bar height
Rust所有权(非常重要)
Pytorch 20 realizes corrosion expansion based on pytorch
NC24840 [USACO 2009 Mar S]Look Up
Detailed explanation of pod life cycle
v8
关于Unity屏幕相关Screen的练习题目,Unity内部环绕某点做运动
NC20806 区区区间间间
University of Toronto: Anthony coach | the conditions of deep reinforcement learning can induce dynamic risk measurement