GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — remove report method · gaecom/stackimpact-python@6e67111

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • README.md
  • examples/demo
    • flask_app.py
  • setup.py
  • stackimpact
    • agent.py
    • profilers
      • allocation_profiler.py
  • tests
    • agent_test.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎README.md‎

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 numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Learn more on the [features](https://stackimpact.com/features/) page (with scree
2020

2121
#### How it works
2222

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.
2424

2525

2626
#### Documentation
@@ -165,4 +165,4 @@ To enable debug logging, add `debug = True` to startup options. If the debug log
165165

166166
## Overhead
167167

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

‎examples/demo/flask_app.py‎

Copy file name to clipboardExpand all lines: examples/demo/flask_app.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
22

33
from __future__ import print_function
44

@@ -28,6 +28,7 @@
2828
# StackImpact agent initialization
2929
agent = stackimpact.start(
3030
agent_key = os.environ['AGENT_KEY'],
31+
dashboard_address = os.environ['DASHBOARD_ADDRESS'],
3132
app_name = 'ExamplePythonFlaskApp',
3233
app_version = '1.0.0',
3334
debug = True)
Collapse file

‎setup.py‎

Copy file name to clipboardExpand all lines: setup.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def read(fname):
66

77
setup(
88
name = 'stackimpact',
9-
version = '1.2.3',
9+
version = '1.2.4',
1010
description = 'StackImpact Python Profiler',
1111
long_description = read('README.rst'),
1212
author = 'StackImpact',
Collapse file

‎stackimpact/agent.py‎

Copy file name to clipboardExpand all lines: stackimpact/agent.py
+7-15Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __exit__(self, exc_type, exc_value, traceback):
5151

5252
class Agent(object):
5353

54-
AGENT_VERSION = "1.2.3"
54+
AGENT_VERSION = "1.2.4"
5555
SAAS_DASHBOARD_ADDRESS = "https://agent-api.stackimpact.com"
5656

5757
def __init__(self, **kwargs):
@@ -261,6 +261,12 @@ def stop_func():
261261
duration = time.time() - start_timestamp
262262
self.span_reporter.record_span(name, duration)
263263

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+
264270
self.span_active = False
265271

266272
return Span(stop_func)
@@ -320,20 +326,6 @@ def stop_tf_profiler(self):
320326
self._stop_profiler(self.tf_reporter)
321327

322328

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-
337329
def destroy(self):
338330
if not self.agent_started:
339331
self.log('Agent has not been started')
Collapse file

‎stackimpact/profilers/allocation_profiler.py‎

Copy file name to clipboardExpand all lines: stackimpact/profilers/allocation_profiler.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def build_profile(self, duration):
9191
'category': Metric.CATEGORY_MEMORY_PROFILE,
9292
'name': Metric.NAME_UNCOLLECTED_ALLOCATIONS,
9393
'unit': Metric.UNIT_BYTE,
94-
'unit_interval': None,
94+
'unit_interval': 1,
9595
'profile': self.profile
9696
}]
9797

Collapse file

‎tests/agent_test.py‎

Copy file name to clipboardExpand all lines: tests/agent_test.py
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def test_profile(self):
5050
dashboard_address = 'http://localhost:5001',
5151
agent_key = 'key1',
5252
app_name = 'TestPythonApp',
53-
auto_profiling = False,
5453
debug = True
5554
)
5655

@@ -77,7 +76,6 @@ def test_with_profile(self):
7776
dashboard_address = 'http://localhost:5001',
7877
agent_key = 'key1',
7978
app_name = 'TestPythonApp',
80-
auto_profiling = False,
8179
debug = True
8280
)
8381

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.