Unobstrusively detects the most common running stacks in your Python program, for use with the Mindsight product.
This utility can be plugged in to your Python application to collect vital data about your code's behavior so that Mindsight can help you write better code more safely.
This utility is not designed to work with web frameworks that utilize multithreading like Django and Flask. If you are using one of those frameworks, use the appropriate data collector:
To install this utility for use in your program:
pip install mindsight-sampler
Before proceeding, make sure you have setup your Mindsight account. Contact us if you need help.
To use this utility to observe your program and send data to Mindsight:
-
First, set up and run the Mindsight Agent (the binary download is easy and recommended).
- For the purpose of this example, we will assume your agent is running at
http://localhost:8000
- For the purpose of this example, we will assume your agent is running at
-
Initialize the sampler in your code:
import sampler
sampler.start("http://localhost:8000", "My Project", ["my.module", "my.other_module"], environment="production")
Let's explain each parameter:
"http://localhost:8000"
- URL to your running Mindsight Agent
"My Project"
- The name of your project in your Mindsight account that tracks this application
["my.module", "my.other_module"]
- The Python modules that you want to have monitored by Mindsight
- Each element of this array is a prefix, so
["my"]
will watch those 2, plus any others undermy.*
environment="production"
- Name of the environment the application is running in
- This parameter is optional
- You can name your environments however you like