Skip to content

Commit

Permalink
v3.0.7 - Merge pull request #301 from flask-dashboard/development
Browse files Browse the repository at this point in the history
  • Loading branch information
mircealungu authored Feb 28, 2020
2 parents 7bc7296 + 60afa3f commit 60c2bf6
Show file tree
Hide file tree
Showing 21 changed files with 67 additions and 35 deletions.
8 changes: 8 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
This project adheres to `Semantic Versioning <http://semver.org/>`_.
Please note that the changes before version 1.10.0 have not been documented.

v3.0.7
----------
Changed
- Added a first version of the Reporting functionality
- Improved usability of the overview table
- Fixed issue #`295` <https://github.com/flask-dashboard/Flask-MonitoringDashboard/issues/295>`_.


v3.0.6
----------
Changed
Expand Down
4 changes: 2 additions & 2 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ The line should then be:

.. code-block:: python
dashboard.config.init_from(envvar='DASHBOARD_CONFIG')
dashboard.config.init_from(envvar='FLASK_MONITORING_DASHBOARD_CONFIG')
This will configure the Dashboard based on the file provided in the environment variable called `DASHBOARD_CONFIG`.
This will configure the Dashboard based on the file provided in the environment variable called `FLASK_MONITORING_DASHBOARD_CONFIG`.

The content of the configuration file
-------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions docs/contact.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ Currently, the team consists of three active developers:
+------------+----------------------------------------------------------------------+

.. |Picture1| image:: https://avatars2.githubusercontent.com/u/17162650?s=460&v=4
..:width: 100px
..:width: 100px

.. |Picture2| image:: https://avatars2.githubusercontent.com/u/7281856?s=400&v=4
..:width: 100px
..:width: 100px

.. |Picture3| image:: https://avatars3.githubusercontent.com/u/17165311?s=400&v=4
..:width: 100px
..:width: 100px


Found a bug?
Expand Down
4 changes: 4 additions & 0 deletions docs/functionality.rst
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ at least 1) in the application can be found under the **Dashboard** menu:
requests for that endpoint. This provides information whether certain endpoints perform better (in terms of
execution time) than other endpoints.

6. **Reporting:** A more experimental feature which aims to automatically
detect and report changes in performance for various intervals
(e.g. today vs. yesterday, this week vs. last week, etc).

Endpoint
~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion flask_monitoringdashboard/constants.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.0.6",
"version": "3.0.7",
"author": "Patrick Vogel, Bogdan Petre",
"email": "[email protected]"
}
11 changes: 8 additions & 3 deletions flask_monitoringdashboard/core/config/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ def parse_version(parser, header, version):
# The file is specified by: 'ref: <location>'
git_file = (open(os.path.join(git, 'HEAD')).read().rsplit(': ', 1)[1]).rstrip()
# read the git-version
version = open(git + '/' + git_file).read()
# cut version to at most 6 chars
return version[:6]
version_file = os.path.join(git , git_file)
if os.path.exists(version_file):
version = open(version_file).read()
# cut version to at most 6 chars
return version[:6]
else:
# Return "dummy" version in case of no git version file found
return version
except IOError:
log("Error reading one of the files to retrieve the current git-version.")
raise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(self, thread_to_monitor, endpoint, ip, group_by, outlier_profiler=N
self._lines_body = []
self._total = 0
self._outlier_profiler = outlier_profiler
self._status_code = 404

def run(self):
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from collections import defaultdict

from flask_monitoringdashboard.controllers.requests import get_status_code_frequencies_in_interval
from flask_monitoringdashboard.core.reporting.questions.report_question import Answer, ReportQuestion
from flask_monitoringdashboard.database import session_scope
Expand Down
3 changes: 1 addition & 2 deletions flask_monitoringdashboard/database/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Contains all functions that access a Request object.
"""
import time
from random import sample

from sqlalchemy import and_, func

Expand Down Expand Up @@ -56,7 +55,7 @@ def add_request(db_session, duration, endpoint_id, ip, group_by, status_code):
status_code=status_code,
)
db_session.add(request)
db_session.flush()
db_session.commit()
return request.id


Expand Down
10 changes: 10 additions & 0 deletions flask_monitoringdashboard/static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -497,4 +497,14 @@ footer.sticky-footer {
transform: scaleY(1.0);
-webkit-transform: scaleY(1.0);
}
}

.greenText {color:green;}
.redText {color:red;}

.table_cell_with_error_count:after {
content:attr(error-count);
color: red;
vertical-align: super;
font-size: small;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<tr>
<td><b>Monitoring-level</b></td>
<td ng-click="$event.stopPropagation()">
<monitorlevel name="endpoint.info.endpoint" value="endpoint.info['monitor-level']" />
<monitorlevel name="endpoint.info.endpoint" value="endpoint.info['monitor-level']"></monitorlevel>
</td>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@
</div>
</div>

<endpointdetails/>
<endpointdetails></endpointdetails>
</div>
6 changes: 3 additions & 3 deletions flask_monitoringdashboard/static/pages/outliers.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="card-header"><h4>Outliers data</h4></div>
<div class="card-body">

<pagination/>
<pagination></pagination>

<div class="card" ng-repeat="row in table" style="margin-bottom: 10px;">
<div class="row">
Expand Down Expand Up @@ -73,9 +73,9 @@
</div>
</div>

<pagination/>
<pagination></pagination>

</div>
</div>
<endpointdetails/>
<endpointdetails></endpointdetails>
</div>
24 changes: 15 additions & 9 deletions flask_monitoringdashboard/static/pages/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,36 @@
<tbody>
<tr ng-repeat="row in table" style="cursor: pointer"
ng-click="go('/endpoint/' + row.id + '/hourly_load')">

<td style="background-color: {{ row.color }}"></td>
<td style="max-width: 200px;">{{ row.name }}</td>

<td ng-show="isHits" style="text-align: right;">

<td class="table_cell_with_error_count"
ng-show="isHits"
style="text-align: right;"
ng-attr-error-count="{{ (row['hits-today-errors'] > 0) ? row['hits-today-errors'] : ''}}">
{{ row['hits-today'] | number }}
<span ng-show="row['hits-today-errors'] > 0"
style="color: red">({{ row['hits-today-errors'] }})</span>
</td>
<td ng-show="isHits" style="text-align: right;">
{{ row['hits-week'] | number }}
<span ng-show="row['hits-week-errors'] > 0"
style="color: red">({{ row['hits-week-errors'] }})</span>


<td class="table_cell_with_error_count"
ng-show="isHits" style="text-align: right;"
ng-attr-error-count="{{ (row['hits-week-errors'] > 0) ? row['hits-week-errors'] : ''}}">
{{ row['hits-week'] | number }}
</td>

<td ng-show="isHits" style="text-align: right;">
{{ row['hits-overall'] | number }}
</td>

<td ng-show="isHits==false" style="text-align: right;">{{ row['median-today'] | duration_ms }}</td>
<td ng-show="isHits==false" style="text-align: right;">{{ row['median-week'] | duration_ms }}</td>
<td ng-show="isHits==false" style="text-align: right;">{{ row['median-overall'] | duration_ms }}</td>
<td ng-show="isHits==false"
style="text-align: right;">{{ row['median-overall'] | duration_ms }}</td>
<td style="text-align: center;">{{ row['last-accessed'] | dateDifference }}</td>
<td ng-click="$event.stopPropagation()">
<monitorlevel name="row.name" value="row.monitor" />
<monitorlevel name="row.name" value="row.monitor"></monitorlevel>
</td>
</tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion flask_monitoringdashboard/static/pages/plotly_graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@
</div>
</div>

<endpointdetails/>
<endpointdetails></endpointdetails>
</div>
6 changes: 3 additions & 3 deletions flask_monitoringdashboard/static/pages/profiler.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div class="rect5"></div>
</div>

<pagination/>
<pagination></pagination>
<div class="card" ng-repeat="request in table" style="margin-bottom: 10px;">
<div class="card-header">
<div class="row align-items-end">
Expand Down Expand Up @@ -50,9 +50,9 @@
</table>
</div>

<pagination/>
<pagination></pagination>
</div>
</div>

<endpointdetails/>
<endpointdetails></endpointdetails>
</div>
2 changes: 1 addition & 1 deletion flask_monitoringdashboard/static/pages/reporting.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ <h1>{{ summary.endpoint_name }}</h1>
<li class="list-group-item" ng-show="answer.is_significant || !onlyShowInteresting">
<div ng-switch="answer.type">
<div ng-switch-when="AVERAGE_LATENCY" style="padding-bottom:15px">
<h4>Average latency
<h4 ng-class="answer.percentual_diff > 0 ? 'redText' : 'greenText'">Average latency
{{ answer.percentual_diff > 0 ? 'increased' : 'decreased' }} by
{{ answer.percentual_diff | abs | number : 0 }}%</h4>
<p>From {{ answer.compared_to_average|number:0 }}ms to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
from time import sleep

from flask import Flask, json, jsonify
from flask import Flask, jsonify
from flask_monitoringdashboard.core.cache import EndpointInfo
from flask_monitoringdashboard.database import session_scope, Request

Expand Down
2 changes: 1 addition & 1 deletion flask_monitoringdashboard/views/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def make_report():
compared_to_interval = DateInterval(datetime.fromtimestamp(int(arguments['compared_to_interval']['from'])),
datetime.fromtimestamp(int(arguments['compared_to_interval']['to'])))

except Exception as err:
except Exception:
return 'Invalid payload', 422

endpoint_summaries = []
Expand Down
2 changes: 1 addition & 1 deletion migration/migrate_v2_to_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, joinedload
from sqlalchemy.orm import sessionmaker

from sqlalchemy.ext.declarative import declarative_base

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
click
apscheduler
flask>=0.9 # for monitoring the web-service
jinja2==2.11.1 # pinning this to avoid flask pulling in a later one which breaks python3.6
sqlalchemy>=1.1.9 # for database support
configparser # for parsing the config-file
psutil # for logging extra CPU-info
Expand Down

0 comments on commit 60c2bf6

Please sign in to comment.