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

边栏推荐
- Free we media essential tools sharing
- NC24840 [USACO 2009 Mar S]Look Up
- There is an unknown problem in inserting data into the database
- antv x6节点拖拽到画布上后的回调事件(踩大坑记录)
- 利亚德:Micro LED 产品消费端首先针对 100 英寸以上电视,现阶段进入更小尺寸还有难度
- CMake基本使用
- 多进程编程(四):共享内存
- DotNet圈里一个优秀的ORM——FreeSql
- 关于QByteArray存储十六进制 与十六进制互转
- Thinkadmin V6 arbitrary file read vulnerability (cve-2020-25540)
猜你喜欢

FAQ | FAQ for building applications for large screen devices

图解网络:什么是虚拟路由器冗余协议 VRRP?

antv x6节点拖拽到画布上后的回调事件(踩大坑记录)

Shell 实现文件基本操作(sed-编辑、awk-匹配)

如何系统学习机器学习

Introduction of UART, RS232, RS485, I2C and SPI

Shell 实现文件基本操作(切割、排序、去重)

Understanding and application of least square method

百度智能云牵头打造智能云综合标准化平台

Redis21 classic interview questions, extreme pull interviewer
随机推荐
Callback event after the antv X6 node is dragged onto the canvas (stepping on a big hole record)
【雅思阅读】王希伟阅读P2(阅读填空)
【Pulsar文档】概念和架构/Concepts and Architecture
Maya fishing house modeling
Vulkan并非“灵药“
form表单实例化
Extension of flutter
Confluence的PDF导出中文文档异常显示问题解决
NC24840 [USACO 2009 Mar S]Look Up
Linux Software: how to install redis service
Rust ownership (very important)
NC50965 Largest Rectangle in a Histogram
NC17059 队列Q
Solution to the problem of abnormal display of PDF exported Chinese documents of confluence
Centos7 one click compilation to build MySQL script
Form form instantiation
Unity learns from spaceshooter to record the difference between fixedupdate and update in unity for the second time
Vulkan-性能及精细化
Kubernetes simple introduction to writing YML
Linux软件:如何安装Redis服务