Python Monitoring Quick Start Guide
Getting started with Instrumental and Python
Here's how to get up and running with Python application monitoring and Instrumental. Like all our agents, the Python agent is designed to prevent exceptions from impacting your application. It's also completely non-blocking.
Installation
Add the agent to your project:
pip install --upgrade instrumental_agent
Require the agent and configure it with your project token:
from instrumental_agent import Agent i = Agent("PROJECT_TOKEN", enabled=True)
Sending Metrics
Increments are simple counters. learn more
i.increment('job.mailer.name.success', 1)
Gauges represent a value at a point in time. learn more
i.gauge('queue.name.size', 234)
The time method measures a function call time.
i.time('app.query_time.post.find', lambda: Post.find(1))
Sending Notices
Notices are project specific events.
i.notice('Deployed revision 038ade4 to production') i.notice('event with a duration', time.time(), timedelta(minutes=20))
Using StatsD or statsite? We’ve got you covered with our StatsD backend and statsite sink