{ "info": { "author": "Piotr Szymanski", "author_email": "piotr.szymanski@fieldaware.com", "bugtrack_url": null, "classifiers": [], "description": "[![CircleCI](https://circleci.com/gh/fieldaware/liveprofiler_sampler.svg?style=svg)](https://circleci.com/gh/fieldaware/liveprofiler_sampler)\n[![PyPI version](https://badge.fury.io/py/liveprofiler_sampler.svg)](https://badge.fury.io/py/liveprofiler_sampler)\n\n# Object and middleware for profiling live services\n\nThis is a package that should be used to profile python services on production. This is fallow up work based on https://github.com/nylas/nylas-perftools. So most of the credit goes to: nylas.com\n\nTo really understand what is going on here check this great blog post: https://www.nylas.com/blog/performance\n\n# Usage\n\nFor wsgi applications you can this library as any other middleware. Here we have a little flask example:\n\n```\nfrom flask import Flask\napp = Flask(__name__)\n\nimport liveprofiler_sampler\napp.wsgi_app = liveprofiler_sampler.ProfilingMiddleware(app, interval=0.05, secret_header='secret')\napp.run()\n\n\n> curl -v localhost:5000/liveprofiler\n* Trying 127.0.0.1...\n* Connected to localhost (127.0.0.1) port 5000 (#0)\n> GET /liveprofiler HTTP/1.1\n> Host: localhost:5000\n> User-Agent: curl/7.43.0\n> Accept: */*\n>\n* HTTP 1.0, assume close after body\n< HTTP/1.0 403 YOU SHALL NOT PASS!!!!!!!!!!!!1111oneoneonelephant\n< Connection: close\n< Server: Werkzeug/0.11.10 Python/2.7.8\n< Date: Thu, 30 Jun 2016 15:30:21 GMT\n<\n* Closing connection 0\n\n```\n\nOur tiny app denied the request, because we should not expose our profiling data to anyone. The `secret_header` param passed to `ProfilingMiddleware` constructor is the secret value that protects our stacks. Passing the secret token will return a json ready to consume and visualise.\n\n```\n> curl curl --header \"PROFILER_TOKEN: secret\" -v localhost:5000/liveprofiler\n* Rebuilt URL to: curl/\n* Could not resolve host: curl\n* Closing connection 0\ncurl: (6) Could not resolve host: curl\n* Trying 127.0.0.1...\n* Connected to localhost (127.0.0.1) port 5000 (#1)\n> GET /liveprofiler HTTP/1.1\n> Host: localhost:5000\n> User-Agent: curl/7.43.0\n> Accept: */*\n> PROFILER_TOKEN: secret\n>\n* HTTP 1.0, assume close after body\n< HTTP/1.0 200 OK\n< Connection: close\n< Server: Werkzeug/0.11.10 Python/2.7.8\n< Date: Thu, 30 Jun 2016 15:31:39 GMT\n<\n{\"granularity\": 0.05, \"stacks\": [{\"count\": 9, \"frame\": \"(__main__);start_ipython(IPython);launch_instance(traitlets.config.application);\nstart(IPython.terminal.ipapp);mainloop(IPython.terminal.interactiveshell);\ninteract(IPython.terminal.interactiveshell);run_cell(IPrt(IP...........\n```\n\nTo visualize the data please check: https://github.com/fieldaware/liveprofiler\n# Installation\n\nTo install the package simply type:\n\n```\npip install liveprofiler_sampler\n```\n\n# uWSGI integration\n\nBecause sampler is implemented based on signals, you have to be aware of that when running your service under uWSGI.\nIn order to gather any samples you need to add following configuration to your uwsgi.ini\n```\npy-call-osafterfork = true # enable child processes running cpython to trap OS signals\nlazy-apps = true # load apps in each worker instead of the master\n\n```", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fieldaware/liveprofiler_sampler", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "liveprofiler_sampler", "package_url": "https://pypi.org/project/liveprofiler_sampler/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/liveprofiler_sampler/", "project_urls": { "Homepage": "https://github.com/fieldaware/liveprofiler_sampler" }, "release_url": "https://pypi.org/project/liveprofiler_sampler/0.9.3/", "requires_dist": null, "requires_python": "", "summary": "Module for sampling profiling output from the main process", "version": "0.9.3" }, "last_serial": 2201563, "releases": { "0.9.0": [ { "comment_text": "", "digests": { "md5": "a887752a20b90ddc0a8cd2b52756fb68", "sha256": "028e09b61aa10d86215d6d333aa90a59d344d4688b1fdad1f4a619b144546ebf" }, "downloads": -1, "filename": "liveprofiler_sampler-0.9.0-py2-none-any.whl", "has_sig": false, "md5_digest": "a887752a20b90ddc0a8cd2b52756fb68", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3568, "upload_time": "2016-06-27T12:23:56", "url": "https://files.pythonhosted.org/packages/d2/65/27bd036001a414ac2d5e2324e5b058f212dcc075936b232c7b5eaf4b7e2e/liveprofiler_sampler-0.9.0-py2-none-any.whl" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "d4d1088cae063a2f25735e2c01a01263", "sha256": "abdc68f608a26214abf34229660248febdfaa02128c34cd7de880cc3fee00a86" }, "downloads": -1, "filename": "liveprofiler_sampler-0.9.1-py2-none-any.whl", "has_sig": false, "md5_digest": "d4d1088cae063a2f25735e2c01a01263", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3571, "upload_time": "2016-06-27T14:50:42", "url": "https://files.pythonhosted.org/packages/20/da/a689a3806146b19c7e93944014e9c4e8521b0cb572ce28b3eb0da25f053a/liveprofiler_sampler-0.9.1-py2-none-any.whl" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "49fe28126da823f3baa8a9c4e10d36ec", "sha256": "557154bce081bcd11ec6e46b7b91fa7159d260e4a21144906d334ed70cc8a5db" }, "downloads": -1, "filename": "liveprofiler_sampler-0.9.2-py2-none-any.whl", "has_sig": false, "md5_digest": "49fe28126da823f3baa8a9c4e10d36ec", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 5626, "upload_time": "2016-06-30T15:55:18", "url": "https://files.pythonhosted.org/packages/aa/b9/f8650b4fdab553eb1fe660f69b940f86f1821c0aaa20a634cd2ff5852f5c/liveprofiler_sampler-0.9.2-py2-none-any.whl" } ], "0.9.3": [ { "comment_text": "", "digests": { "md5": "22920d7e3fedb2f7ad983fa3aff8411e", "sha256": "6dc8599ad682a533154a2513f1e20296dbcc2447bcc756c16677685e62fb36f2" }, "downloads": -1, "filename": "liveprofiler_sampler-0.9.3-py2-none-any.whl", "has_sig": false, "md5_digest": "22920d7e3fedb2f7ad983fa3aff8411e", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6116, "upload_time": "2016-07-04T11:29:44", "url": "https://files.pythonhosted.org/packages/0b/69/eef149fc5389a7062c6a7fa46bcc7524a3000f155aec007d9b744b381fd2/liveprofiler_sampler-0.9.3-py2-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "22920d7e3fedb2f7ad983fa3aff8411e", "sha256": "6dc8599ad682a533154a2513f1e20296dbcc2447bcc756c16677685e62fb36f2" }, "downloads": -1, "filename": "liveprofiler_sampler-0.9.3-py2-none-any.whl", "has_sig": false, "md5_digest": "22920d7e3fedb2f7ad983fa3aff8411e", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6116, "upload_time": "2016-07-04T11:29:44", "url": "https://files.pythonhosted.org/packages/0b/69/eef149fc5389a7062c6a7fa46bcc7524a3000f155aec007d9b744b381fd2/liveprofiler_sampler-0.9.3-py2-none-any.whl" } ] }