GeezerVison is showing github.com — remove report method · gaecom/stackimpact-python@6e67111
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: README.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -20,7 +20,7 @@ Learn more on the [features](https://stackimpact.com/features/) page (with scree | 20 | 20 |
| 21 | 21 | #### How it works | 22 | 22 |
| 23 | | -The 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. If an application has multiple processes, also referred to as workers, instances or nodes, only one or two processes will have active agents at any point of time. | | 23 | +The 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. | 24 | 24 |
| 25 | 25 |
| 26 | 26 | #### Documentation | @@ -165,4 +165,4 @@ To enable debug logging, add `debug = True` to startup options. If the debug log | 165 | 165 |
| 166 | 166 | ## Overhead | 167 | 167 |
| 168 | | -The agent overhead is measured to be less than 1% for applications under high load. For applications that are horizontally scaled to multiple processes, StackImpact agents are only active on a small subset of the processes at any point of time, therefore the total overhead is much lower. | | 168 | +The agent overhead is measured to be less than 1% for applications under high load. |
Collapse file Copy file name to clipboardExpand all lines: examples/demo/flask_app.py +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#env AGENT_KEY=agnetkeyhere FLASK_APP=examples/flask_app.py flask run -p 5010 | | 1 | +#env AGENT_KEY=agnetkeyhere FLASK_APP=examples/demo/flask_app.py flask run -p 5010 | 2 | 2 |
| 3 | 3 | from __future__ import print_function | 4 | 4 |
| | 28 | 28 | # StackImpact agent initialization | 29 | 29 | agent = stackimpact.start( | 30 | 30 | agent_key = os.environ['AGENT_KEY'], | | 31 | + dashboard_address = os.environ['DASHBOARD_ADDRESS'], | 31 | 32 | app_name = 'ExamplePythonFlaskApp', | 32 | 33 | app_version = '1.0.0', | 33 | 34 | debug = True) | |
Collapse file Copy file name to clipboardExpand all lines: setup.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,7 @@ def read(fname): | 6 | 6 |
| 7 | 7 | setup( | 8 | 8 | name = 'stackimpact', | 9 | | - version = '1.2.3', | | 9 | + version = '1.2.4', | 10 | 10 | description = 'StackImpact Python Profiler', | 11 | 11 | long_description = read('README.rst'), | 12 | 12 | author = 'StackImpact', | |
Collapse file Copy file name to clipboardExpand all lines: stackimpact/agent.py +7-15Lines changed: 7 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -51,7 +51,7 @@ def __exit__(self, exc_type, exc_value, traceback): | 51 | 51 |
| 52 | 52 | class Agent(object): | 53 | 53 |
| 54 | | - AGENT_VERSION = "1.2.3" | | 54 | + AGENT_VERSION = "1.2.4" | 55 | 55 | SAAS_DASHBOARD_ADDRESS = "https://agent-api.stackimpact.com" | 56 | 56 |
| 57 | 57 | def __init__(self, **kwargs): | @@ -261,6 +261,12 @@ def stop_func(): | 261 | 261 | duration = time.time() - start_timestamp | 262 | 262 | self.span_reporter.record_span(name, duration) | 263 | 263 |
| | 264 | + if not self.get_option('auto_profiling'): | | 265 | + self.config_loader.load(True) | | 266 | + if selected_reporter: | | 267 | + selected_reporter.report(True); | | 268 | + self.message_queue.flush(True) | | 269 | + | 264 | 270 | self.span_active = False | 265 | 271 |
| 266 | 272 | return Span(stop_func) | @@ -320,20 +326,6 @@ def stop_tf_profiler(self): | 320 | 326 | self._stop_profiler(self.tf_reporter) | 321 | 327 |
| 322 | 328 |
| 323 | | - def report(self): | 324 | | - if not self.agent_started or self.get_option('auto_profiling'): | 325 | | - return | 326 | | - | 327 | | - self.config_loader.load(True) | 328 | | - | 329 | | - self.cpu_reporter.report(True); | 330 | | - self.allocation_reporter.report(True); | 331 | | - self.block_reporter.report(True); | 332 | | - self.tf_reporter.report(True); | 333 | | - | 334 | | - self.messageQueue.flush(True) | 335 | | - | 336 | | - | 337 | 329 | def destroy(self): | 338 | 330 | if not self.agent_started: | 339 | 331 | self.log('Agent has not been started') | |
Collapse file Copy file name to clipboardExpand all lines: stackimpact/profilers/allocation_profiler.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -91,7 +91,7 @@ def build_profile(self, duration): | 91 | 91 | 'category': Metric.CATEGORY_MEMORY_PROFILE, | 92 | 92 | 'name': Metric.NAME_UNCOLLECTED_ALLOCATIONS, | 93 | 93 | 'unit': Metric.UNIT_BYTE, | 94 | | - 'unit_interval': None, | | 94 | + 'unit_interval': 1, | 95 | 95 | 'profile': self.profile | 96 | 96 | }] | 97 | 97 |
| |
Collapse file Copy file name to clipboardExpand all lines: tests/agent_test.py -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,7 +50,6 @@ def test_profile(self): | 50 | 50 | dashboard_address = 'http://localhost:5001', | 51 | 51 | agent_key = 'key1', | 52 | 52 | app_name = 'TestPythonApp', | 53 | | - auto_profiling = False, | 54 | 53 | debug = True | 55 | 54 | ) | 56 | 55 |
| @@ -77,7 +76,6 @@ def test_with_profile(self): | 77 | 76 | dashboard_address = 'http://localhost:5001', | 78 | 77 | agent_key = 'key1', | 79 | 78 | app_name = 'TestPythonApp', | 80 | | - auto_profiling = False, | 81 | 79 | debug = True | 82 | 80 | ) | 83 | 81 |
| |
|