Skip to content

Commit

Permalink
Merge pull request #84 from flask-dashboard/group_by
Browse files Browse the repository at this point in the history
resolved bug
  • Loading branch information
mircealungu committed Apr 8, 2018
2 parents f7cd817 + 0964bb6 commit 14d7420
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions flask_monitoringdashboard/database/function_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ def add_function_call(time, endpoint, ip):
""" Add a measurement to the database. """
with session_scope() as db_session:
group_by = None
if config.get_group_by:
group_by = config.get_group_by()
try:
if config.get_group_by:
group_by = config.get_group_by()
except Exception as e:
print('Can\'t execute group_by function: {}'.format(e))
call = FunctionCall(endpoint=endpoint, execution_time=time, version=config.version,
time=datetime.datetime.now(), group_by=str(group_by), ip=ip)
db_session.add(call)
Expand Down
4 changes: 2 additions & 2 deletions flask_monitoringdashboard/measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def wrapper(*args, **kwargs):
add_function_call(time=t, endpoint=endpoint, ip=request.environ['REMOTE_ADDR'])

# outlier detection
endpoint_count[endpoint] += 1
endpoint_sum[endpoint] += t
endpoint_count[endpoint] = endpoint_count.get(endpoint, 0) + 1
endpoint_sum[endpoint] = endpoint_sum.get(endpoint, 0) + t

if stack_info:
add_outlier(endpoint, t, stack_info, request)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def desc():

setuptools.setup(
name="Flask-MonitoringDashboard",
version='1.11.3',
version='1.11.5',
packages=setuptools.find_packages(),
include_package_data=True,
platforms='Any',
Expand Down

0 comments on commit 14d7420

Please sign in to comment.