{"id":13468854,"url":"https://github.com/stackimpact/stackimpact-python","last_synced_at":"2025-03-26T05:31:20.973Z","repository":{"id":121267206,"uuid":"95447826","full_name":"stackimpact/stackimpact-python","owner":"stackimpact","description":"DEPRECATED StackImpact Python Profiler - Production-Grade Performance Profiler: CPU, memory allocations, blocking calls, exceptions, metrics, and more","archived":false,"fork":false,"pushed_at":"2019-05-14T14:48:14.000Z","size":82,"stargazers_count":660,"open_issues_count":7,"forks_count":25,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-29T22:56:45.971Z","etag":null,"topics":["cpu-profiler","hot-spot-profiles","memory-leak-detection","memory-profiler","monitoring","performance-metrics","performance-tuning","profiler","python","python3"],"latest_commit_sha":null,"homepage":"https://stackimpact.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackimpact.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-06-26T13:12:06.000Z","updated_at":"2024-10-21T12:48:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"737185ae-d295-405c-92b2-0dcff03e51d5","html_url":"https://github.com/stackimpact/stackimpact-python","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackimpact%2Fstackimpact-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackimpact%2Fstackimpact-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackimpact%2Fstackimpact-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackimpact%2Fstackimpact-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackimpact","download_url":"https://codeload.github.com/stackimpact/stackimpact-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245597321,"owners_count":20641865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpu-profiler","hot-spot-profiles","memory-leak-detection","memory-profiler","monitoring","performance-metrics","performance-tuning","profiler","python","python3"],"created_at":"2024-07-31T15:01:20.508Z","updated_at":"2025-03-26T05:31:20.537Z","avatar_url":"https://github.com/stackimpact.png","language":"Python","readme":"# StackImpact Python Profiler\n\n## Overview\n\nStackImpact is a production-grade performance profiler built for both production and development environments. It gives developers continuous and historical code-level view of application performance that is essential for locating CPU, memory allocation and I/O hot spots as well as latency bottlenecks. Included runtime metrics and error monitoring complement profiles for extensive performance analysis. Learn more at [stackimpact.com](https://stackimpact.com/).\n\n![dashboard](https://stackimpact.com/img/readme/hotspots-cpu-1.4-python.png)\n\n#### Features\n\n* Continuous hot spot profiling of CPU usage, memory allocation and blocking calls.\n* Error and exception monitoring.\n* Health monitoring including CPU, memory, garbage collection and other runtime metrics.\n* Alerts on profile anomalies.\n* Team access.\n\nLearn more on the [features](https://stackimpact.com/features/) page (with screenshots).\n\n\n#### How it works\n\nThe StackImpact profiler agent is imported into a program and used as a normal package. When the program runs, various sampling profilers are started and stopped automatically by the agent and/or programmatically using the agent methods. The agent periodically reports recorded profiles and metrics to the StackImpact Dashboard. The agent can also operate in manual mode, which should be used in development only.\n\n\n#### Documentation\n\nSee full [documentation](https://stackimpact.com/docs/) for reference.\n\n\n\n## Supported environment\n\n* Linux, OS X or Windows. Python version 2.7, 3.4 or higher.\n* Memory allocation profiler and some GC metrics are only available for Python 3.\n* Profilers only support Linux and OS X.\n* Time (blocking call) profiler supports threads and gevent.\n* On unix systems the profilers use the following signals: SIGPROF, SIGALRM, SIGUSR2. Only SIGUSR2 is handled transparently, i.e. it should not conflict with previousely registered handlers.\n\n\n## Getting started\n\n\n#### Create StackImpact account\n\nSign up for a free trial account at [stackimpact.com](https://stackimpact.com) (also with GitHub login).\n\n\n#### Installing the agent\n\nInstall the Python agent by running\n\n```\npip install stackimpact\n```\n\nAnd import the package in your application\n\n```python\nimport stackimpact\n```\n\n\n#### Configuring the agent\n\nStart the agent in the main thread by specifying the agent key and application name. The agent key can be found in your account's Configuration section.\n\n```python\nagent = stackimpact.start(\n    agent_key = 'agent key here',\n    app_name = 'MyPythonApp')\n```\n\nAdd the agent initialization to the worker code, e.g. wsgi.py, if applicable.\n\nAll initialization options:\n\n* `agent_key` (Required) The access key for communication with the StackImpact servers.\n* `app_name` (Required) A name to identify and group application data. Typically, a single codebase, deployable unit or executable module corresponds to one application.\n* `app_version` (Optional) Sets application version, which can be used to associate profiling information with the source code release.\n* `app_environment` (Optional) Used to differentiate applications in different environments.\n* `host_name` (Optional) By default, host name will be the OS hostname.\n* `auto_profiling` (Optional) If set to `False`, disables automatic profiling and reporting. Focused or manual profiling should be used instead. Useful for environments without support for timers or background tasks.\n* `debug` (Optional) Enables debug logging.\n* `cpu_profiler_disabled`, `allocation_profiler_disabled`, `block_profiler_disabled`, `error_profiler_disabled` (Optional) Disables respective profiler when `True`.\n* `include_agent_frames` (Optional) Set to `True` to not exclude agent stack frames from profile call graphs.\n* `auto_destroy` (Optional) Set to `False` to disable agent's exit handlers. If necessary, call `destroy()` to gracefully shutdown the agent.\n\n\n#### Focused profiling\n\nUse `agent.profile(name)` to instruct the agent when to start and stop profiling. The agent decides if and which profiler is activated. Normally, this method should be used in repeating code, such as request or event handlers. In addition to more precise profiling, timing information will also be reported for the profiled spans. Usage example:\n\n```python\nspan = agent.profile('span1');\n\n# your code here\n\nspan.stop();\n```\n\nAlternatively, a `with` statement can be used:\n\n```python\nwith agent.profile('span1'):\n\t# your code ehere\n```\n\n\n#### Manual profiling\n\n*Manual profiling should not be used in production!*\n\nBy default, the agent starts and stops profiling automatically. Manual profiling allows to start and stop profilers directly. It is suitable for profiling short-lived programs and should not be used for long-running production applications. Automatic profiling should be disabled with `auto_profiling: False`.\n\n```python\n# Start CPU profiler.\nagent.start_cpu_profiler();\n```\n\n```python\n# Stop CPU profiler and report the recorded profile to the Dashboard.\nagent.stop_cpu_profiler();\n```\n\n```python\n# Start blocking call profiler.\nagent.start_block_profiler();\n```\n\n```python\n# Stop blocking call profiler and report the recorded profile to the Dashboard.\nagent.stop_block_profiler();\n```\n\n```python\n# Start heap allocation profiler.\nagent.start_allocation_profiler();\n```\n\n```python\n# Stop heap allocation profiler and report the recorded profile to the Dashboard.\nagent.stop_allocation_profiler();\n```\n\n#### Analyzing performance data in the Dashboard\n\nOnce your application is restarted, you can start observing continuous CPU, memory, I/O, and other hot spot profiles, execution bottlenecks as well as process metrics in the [Dashboard](https://dashboard.stackimpact.com/).\n\n\n#### Troubleshooting\n\nTo enable debug logging, add `debug = True` to startup options. If the debug log doesn't give you any hints on how to fix a problem, please report it to our support team in your account's Support section.\n\n\n## Overhead\n\nThe agent overhead is measured to be less than 1% for applications under high load.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackimpact%2Fstackimpact-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackimpact%2Fstackimpact-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackimpact%2Fstackimpact-python/lists"}