|
| 1 | +StackImpact Python Agent |
| 2 | +======================== |
| 3 | + |
| 4 | +Overview |
| 5 | +-------- |
| 6 | + |
| 7 | +StackImpact is a performance profiler for production applications. It |
| 8 | +gives developers continuous and historical view of application |
| 9 | +performance with line-of-code precision, which includes CPU, memory |
| 10 | +allocation and blocking call hot spots as well as execution bottlenecks, |
| 11 | +errors and runtime metrics. Learn more at |
| 12 | +`stackimpact.com <https://stackimpact.com/>`__. |
| 13 | + |
| 14 | +.. figure:: https://stackimpact.com/wp-content/uploads/2017/06/hotspots-cpu-1.4-python.png |
| 15 | + :alt: dashboard |
| 16 | + |
| 17 | + dashboard |
| 18 | + |
| 19 | +Features |
| 20 | +^^^^^^^^ |
| 21 | + |
| 22 | +- Automatic hot spot profiling for CPU, memory allocations, blocking |
| 23 | + calls |
| 24 | +- Automatic bottleneck tracing for HTTP handlers and other libraries |
| 25 | +- Exception monitoring |
| 26 | +- Health monitoring including CPU, memory, garbage collection and other |
| 27 | + runtime metrics |
| 28 | +- Anomaly alerts on most important metrics |
| 29 | +- Multiple account users for team collaboration |
| 30 | + |
| 31 | +Learn more on the `features <https://stackimpact.com/features/>`__ page |
| 32 | +(with screenshots). |
| 33 | + |
| 34 | +Documentation |
| 35 | +^^^^^^^^^^^^^ |
| 36 | + |
| 37 | +See full `documentation <https://stackimpact.com/docs/>`__ for |
| 38 | +reference. |
| 39 | + |
| 40 | +Requirements |
| 41 | +------------ |
| 42 | + |
| 43 | +- Linux, OS X or Windows. Python version 2.7, 3.4 or higher. |
| 44 | +- Memorly allocation profiler and some GC metrics are only available |
| 45 | + for Python 3. |
| 46 | +- CPU and Time profilers only supports Linux and OS X. |
| 47 | +- Time (blocking call) profiler supports threads and gevent. |
| 48 | + |
| 49 | +Getting started |
| 50 | +--------------- |
| 51 | + |
| 52 | +Create StackImpact account |
| 53 | +^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 54 | + |
| 55 | +Sign up for a free account at |
| 56 | +`stackimpact.com <https://stackimpact.com/>`__. |
| 57 | + |
| 58 | +Installing the agent |
| 59 | +^^^^^^^^^^^^^^^^^^^^ |
| 60 | + |
| 61 | +Install the Go agent by running |
| 62 | + |
| 63 | +:: |
| 64 | + |
| 65 | + pip install stackimpact |
| 66 | + |
| 67 | +And import the package in your application |
| 68 | + |
| 69 | +.. code:: python |
| 70 | + |
| 71 | + import stackimpact |
| 72 | + |
| 73 | +Configuring the agent |
| 74 | +^^^^^^^^^^^^^^^^^^^^^ |
| 75 | + |
| 76 | +Start the agent in the main thread by specifying the agent key and |
| 77 | +application name. The agent key can be found in your account's |
| 78 | +Configuration section. |
| 79 | + |
| 80 | +.. code:: python |
| 81 | + |
| 82 | + agent = stackimpact.start( |
| 83 | + agent_key = 'agent key here', |
| 84 | + app_name = 'MyPythonApp', |
| 85 | + |
| 86 | +Other initialization options: |
| 87 | + |
| 88 | +- ``app_version`` (Optional) Sets application version, which can be |
| 89 | + used to associate profiling information with the source code release. |
| 90 | +- ``app_environment`` (Optional) Used to differentiate applications in |
| 91 | + different environments. |
| 92 | +- ``host_name`` (Optional) By default, host name will be the OS |
| 93 | + hostname. |
| 94 | +- ``debug`` (Optional) Enables debug logging. |
| 95 | + |
| 96 | +Analyzing performance data in the Dashboard |
| 97 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 98 | + |
| 99 | +Once your application is restarted, you can start observing regular and |
| 100 | +anomaly-triggered CPU, memory, I/O, and other hot spot profiles, |
| 101 | +execution bottlenecks as well as process metrics in the |
| 102 | +`Dashboard <https://dashboard.stackimpact.com/>`__. |
| 103 | + |
| 104 | +Troubleshooting |
| 105 | +^^^^^^^^^^^^^^^ |
| 106 | + |
| 107 | +To enable debug logging, add ``debug = True`` to startup options. If the |
| 108 | +debug log doesn't give you any hints on how to fix a problem, please |
| 109 | +report it to our support team in your account's Support section. |
| 110 | + |
| 111 | +Overhead |
| 112 | +-------- |
| 113 | + |
| 114 | +The agent overhead is measured to be less than 1% for applications under |
| 115 | +high load. |
0 commit comments