Agent for PAM


Keywords
pam, rust, profiling, performance
License
MIT
Install
pip install pamagent==0.3.0

Documentation

Codacy Badge Build Status PyPI pyversions PyPI version Latest Docs

pamagent

This is a Python Agent for PAM platform. See doc for more information

How-to install

Linux 64-bit

pip install pamagent

Other OS

  1. Install rust-nightly via rustup
  2. pip install --no-binary :all: pamagent

Support technology

  • Frameworks
    • Django
  • Database(Drivers)
    • mysql-connector-python
    • mysqlclient
    • psycopg2
    • sqlite (builtin)
  • Library for external call
    • requests
  • Caches
    • Redis (redis-py)

TODO

  • Tornado
  • AsyncIO
  • Asyncio-http
  • cx_oracle
  • urllib
  • memcache
  • flask
  • twisted
  • Django Templates
  • Jinja2

How to setup your app

Django

For django project you need to call agent.init in your wsgi.py file For example, you would have:

import os

from django.core.wsgi import get_wsgi_application


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_app.settings")


def pam_enable():
    try:
        from pamagent import agent
        agent.init(token='YOU_OWN_TOKEN')
    except Exception as exc:
        print(exc)


pam_enable()

application = get_wsgi_application()

When using uWSGI you will need to add specific options to the uwsgi config

For example:

#test_app_uwsgi.ini
[uwsgi]
chdir           = /Users/dzhiltsov/Development/test_app
module          = test_app.wsgi
home            = /Users/dzhiltsov/Development/envs/test_app
http-socket = :9999
master          = true
processes       = 4
socket          = 127.0.0.1:8002
vacuum          = true
pp              = /Users/dzhiltsov/Development/envs/test_app
virtualenv = /Users/dzhiltsov/Development/envs/test_app
# Use this option and restrict yourself to a single web application
# per process
single-interpreter = true
# This option need if you use uwsgi<= 2.0.14
#wsgi-env-behavior = holy
# This option need if you use  option master=true
lazy-apps = true
# Custom option for configuring pamagent log level
env = PAMAGENT_LEVEL_LOG=2