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

  • 3.8.9

  • 3.9.1 (available soon)

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:

solution = Solution_Name
application = App_Name # if this is not present then Application is set to absolute path of script name
#release = # should be set to a git hash of current release commit
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).
host = # RevDeBug server address
apm = 1 # 0 or 1, whether APM functionalyty is enabled or not
exc_status = 401, 403, 404 # http status codes to be excluded from auto-exception record for SERVERS, APM clients receiving these error codes will always record
#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 '+').
#port = 42734
#authtoken = # authentication token for server access
#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)
#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
#apm_host = # host of RevDeBug APM server
#apm_port = 11800 # port of APM OAP server
#sw_agent_name = App_Name # name of the service for APM topology and traces
#sw_agent_disable_plugins = sw_django # APM tracing support to disable
#sw_ignore_suffix = .jpeg,.jpg
#sw_trace_ignore_path = /metrics
# You can control what parts of your application sources you would like to have RevDeBug to record when error happens
#record = +/this/path/will/be/recorded/even/if/it/is/in/a/system/library/
#record = ../this/relative/path/from/.cfg/file/as/well
#record = -this/file/will/not/
#record = -/neither/will/

Configuration using environment variables

Environment variables corresponding to options in the configuration file. Those have precedence over the configuration file and can be used without the configuration file present at all.

REVDEBUG_RECORD # this bases relative paths from cwd on execution

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.