Python
How to setup recording & monitoring for Python applications
RevDeBug supplies a ready Docker container based on vanilla Debian Buster docker images that can be used as a drop-in replacement for your own microservices.
The Docker image can be used also to run a separate Python interpreter process to run applications outside the container as well.

Supported Python runtime versions

Python Version
Docker Image
3.8.13
docker.revdebug.com/python-revdebug:3.8
3.9.13
docker.revdebug.com/python-revdebug:3.9
3.10.5
docker.revdebug.com/python-revdebug:3.10

Configuration using configuration file

The RevDeBug Python configuration is first read from an optional revdebug.cfg file in the current working directory of your application. Those settings can be set or overridden through environment variables.
Then the script base directory is checked for the file again and if it is present it is read and overrides any settings from the previous file (if one was read). Finally environment variables are checked and override anything which may have come from a config file.
The config file options (case insensitive) are as follows:
1
solution = Solution_Name
2
application = App_Name # if this is not present then Application is set to absolute path of script name
3
#release = # should be set to a git hash of current release commit
4
mode = OnEvent # can be "Continuous", "OnEvent" or "Off" (case insensitive) (if mode is off then can not be enabled from remote server and just acts like normal Python).
5
host = 127.0.0.1 # RevDeBug server address
6
apm = 1 # 0 or 1, whether APM functionalyty is enabled or not
7
#force_tls = 0 # 0 or 1, whether the RevDeBug server uses a secure connection
8
9
#exc_rec_http_in = 403, 404 # http status codes to be excluded from auto exception recordings for servers (span will still be recorded)
10
#exc_rec_http_out = 403, 404 # http status codes to be excluded from auto exception recordings for clients (span will still be recorded)
11
12
#version = Version_String # Human readable version string, e.g. "1.0", etc...)
13
#record = Record:paths # ':' delimited list of absolute or relative (to .cfg) paths or files to enable or disable recording (using '+' or '-' prefix, no prefix is same as '+').
14
#conn_timeout = 4 # connection timeout in seconds
15
#reconn_wait = 60 # maximum wait before reconnect attempt (reached with exponential backoff)
16
#port = 42734
17
#auth = # authentication token for server access
18
#reprlevel = 0 # 0 .. 2, 0 = fastest least detail, 1 = fast know type stringifiers and repr for others, 2 = same as 1 but known mutable objects are shown with repr if Mutable flag not set (keep in mind values recorded may not be fully correct)
19
#mutable = 1 # 0 or 1, if set then tuples, lists, dicts, sets and bytearrays will be stringified immediately on record to be able to display the correct value at point of record
20
21
#sw_agent_name = App_Name # name of the service for APM topology and traces
22
#sw_agent_disable_plugins = sw_django # APM tracing support to disable
23
#sw_ignore_suffix = .jpeg,.jpg
24
#sw_trace_ignore_path = /metrics
25
26
# You can control what parts of your application sources you would like to have RevDeBug to record when error happens
27
# Record path examples:
28
#record = +/this/path/will/be/recorded/even/if/it/is/in/a/system/library/
29
#record = ../this/relative/path/from/.cfg/file/as/well
30
#record = -this/file/will/not/be.py
31
#record = -/neither/will/this.py:-or/this/path:/but/this/file/will/be
Copied!
You can read more about configuration options here

Minimal set of configuration required

  • REVDEBUG_SOLUTION - application or project name.
  • REVDEBUG_RELEASE - should be set to a git hash of a current release commit.
  • REVDEBUG_APPLICATIONS_HOST - fully qualified domain name or IP address of RevDeBug Server.
  • REVDEBUG_MODE - should be set to OnEvent for on error recording, other possible values are Off (still can gather APM metrics, see setting below) or Continuous for live from start to program stop recording.
  • REVDEBUG_APM - should be set to 1 for application performance metrics collection or 0 to disable.