WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit e676d47

Browse files
authored
Merge pull request #58 from flask-dashboard/core
Core
2 parents e49ac9c + a904535 commit e676d47

File tree

134 files changed

+1354
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+1354
-244
lines changed

CHANGELOG.md renamed to CHANGELOG.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ Change Log
22
=========================================================================
33

44
All notable changes to this project will be documented in this file.
5-
This project adheres to [Semantic Versioning](http://semver.org/).
5+
This project adheres to `Semantic Versioning <http://semver.org/>`_.
66
Please note that the changes before version 1.10.0 have not been documented.
77

8-
[Unreleased][unreleased]
8+
Unreleased
99
-------------------------------------------------------------------------
10-
### Changed
10+
Changed
1111

1212
- Added security for automatic endpoint-data retrieval.
13-
- Added test for export_data-endpoints
13+
14+
- Added test for export_data-endpoints
15+
16+
- Added MIT License.
17+
18+
- Added documentation

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
recursive-include dashboard/static *
2-
recursive-include dashboard/templates *
1+
recursive-include flask_monitoringdashboard/static *
2+
recursive-include flask_monitoringdashboard/templates *

README.md

Lines changed: 12 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The Flask Monitoring Dashboard provides 4 main functionalities:
55
- **Monitor the Flask application:**
66
This Flask extensions finds all your endpoints.
77
You can choose which endpoints you want to monitor and which not.
8+
Monitoring and endpoint allows you to see which endpoints are being processed quickly, and which are not.
9+
Additionally, it provides information about the performance of the endpoint throughout different versions.
810
- **Monitor your test coverage:**
911
Find out what endpoints are covered by unittest.
1012
For more information, see Section 'TravisCI unit testing'.
@@ -19,16 +21,11 @@ The dashboard stores more information about outliers, such as:
1921
The dashboard is automatically added to your existing Flask application.
2022
When running your app, the dashboard van be viewed by default in the route:
2123

22-
/dashboard
24+
[/dashboard](http://localhost:5000/dashboard)
2325

2426
### Status
25-
[![Build Status](https://travis-ci.org/flask-dashboard/Flask-Monitoring-Dashboard.svg?branch=master)](https://travis-ci.org/flask-dashboard/Flask-Monitoring-Dashboard.svg)
26-
27-
### Testing
28-
If you want to run the unit test locally, use the following command
29-
```
30-
python setup.py test
31-
```
27+
[![Build Status](https://travis-ci.org/flask-dashboard/Flask-Monitoring-Dashboard.svg?branch=master)](https://travis-ci.org/flask-dashboard/Flask-Monitoring-Dashboard.svg?branch=master)
28+
[![Documentation Status](https://readthedocs.org/projects/flask-monitoringdashboard/badge/?version=latest)](http://flask-monitoringdashboard.readthedocs.io/en/latest/?badge=latest)
3229

3330
## Installation
3431
To install from source, download the source code, then run this:
@@ -37,80 +34,20 @@ To install from source, download the source code, then run this:
3734

3835
Or install with pip:
3936

40-
pip install flask_monitoring_dashboard
37+
pip install flask_monitoringdashboard
4138

4239
### Setup
4340
Adding the extension to your flask app is simple:
4441

4542
from flask import Flask
46-
import dashboard
47-
48-
user_app = Flask(__name__)
49-
dashboard.config.init_from(file='/<path to your config file>/config.cfg')
50-
51-
def get_session_id():
52-
# Implement your own function for obtaining the user variable here.
53-
return "12345"
43+
import flask_monitoringdashboard as dashboard
5444

55-
dashboard.config.get_group_by = get_session_id
56-
dashboard.bind(app=user_app)
45+
app = Flask(__name__)
46+
dashboard.bind(app)
5747

58-
Instead of having a hardcoded string containing the location of the config file in the code above, it is also possible
59-
to define an environment variable that specifies the location of this config file.
60-
The line should then be `dashboard.config.init_from(envvar='DASHBOARD_CONFIG')`. This will configure the dashboard based on the file
61-
provided in the environment variable called `DASHBOARD_CONFIG`.
62-
63-
## Usage
64-
Once the setup is done, a config file ('config.cfg') should be set next to the python file that contains the entry point of the app.
65-
The following things can be configured:
66-
67-
[dashboard]
68-
APP_VERSION=1.0
69-
CUSTOM_LINK=dashboard
70-
USERNAME=admin
71-
PASSWORD=admin
72-
GUEST_USERNAME=guest
73-
GUEST_PASSWORD=['dashboardguest!', 'second_pw!']
74-
DATABASE=sqlite:////<path to your project>/dashboard.db
75-
GIT=/<path to your project>/.git/
76-
TEST_DIR=/<path to your project>/tests/
77-
N=5
78-
SUBMIT_RESULTS_URL=http://0.0.0.0:5000/dashboard/submit-test-results
79-
OUTLIER_DETECTION_CONSTANT=2.5
80-
COLORS={'main':[0,97,255], 'static':[255,153,0]}
81-
82-
For more information, please refer to [this file](dashboard/config.py)
83-
84-
## TravisCI unit testing
85-
To enable Travis to run your unit tests and send the results to the dashboard, four steps have to be taken:
86-
87-
1. Update the config file ('config.cfg') to include three additional values, TEST_DIR, SUBMIT_RESULTS_URL and N.
88-
- TEST_DIR specifies where the unit tests reside.
89-
- SUBMIT_RESULTS_URL specifies where Travis should upload the test results to. When left out, the results will not
90-
be sent anywhere, but the performance collection process will still run.
91-
- N specifies the number of times Travis should run each unit test.
92-
93-
2. The installation requirement for the dashboard has to be added to the 'setup.py' file of your app:
94-
95-
dependency_links=["https://github.com/flask-dashboard/Flask-Monitoring-Dashboard/tarball/master#egg=flask_monitoring_dashboard"]
96-
97-
install_requires=('flask_monitoring_dashboard')
98-
99-
3. In your '.travis.yml' file, three script commands should be added:
100-
101-
script:
102-
- export DASHBOARD_CONFIG=./config.cfg
103-
- export DASHBOARD_LOG_DIR=./logs/
104-
- python -m dashboard.collect_performance
105-
106-
The config environment variable specifies where the performance collection process can find the config file.
107-
The log directory environment variable specifies where the performance collection process should place the logs it uses.
108-
The third command will start the actual performance collection process.
109-
110-
4. A method that is executed after every request should be added to the blueprint of your app.
111-
This is done by the dashboard automatically when the blueprint is passed to the binding function like so: `dashboard.bind(app=app, blue_print=api)`.
112-
This extra method is needed for the logging, and without it, the unit test results cannot be grouped by endpoint that they test.
113-
11448
## Screenshots
11549
![Screenshot 1](/docs/img/screenshot1.png)
11650
![Screenshot 2](/docs/img/screenshot2.png)
51+
52+
## Documentation
53+
For a more advanced documentation, see [this site](http://flask-monitoringdashboard.readthedocs.io).

docs/Makefile

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = Flask-MonitoringDashboard
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# User-friendly check for sphinx-build
12+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
13+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don\'t have Sphinx installed, grab it from http://sphinx-doc.org/)
14+
endif
15+
16+
# Internal variables.
17+
PAPEROPT_a4 = -D latex_paper_size=a4
18+
PAPEROPT_letter = -D latex_paper_size=letter
19+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
20+
# the i18n builder cannot share the environment and doctrees with the others
21+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
22+
23+
.PHONY: help
24+
help:
25+
@echo "Please use \`make <target>' where <target> is one of"
26+
@echo " html to make standalone HTML files"
27+
@echo " dirhtml to make HTML files named index.html in directories"
28+
@echo " singlehtml to make a single large HTML file"
29+
@echo " pickle to make pickle files"
30+
@echo " json to make JSON files"
31+
@echo " htmlhelp to make HTML files and a HTML help project"
32+
@echo " qthelp to make HTML files and a qthelp project"
33+
@echo " applehelp to make an Apple Help Book"
34+
@echo " devhelp to make HTML files and a Devhelp project"
35+
@echo " epub to make an epub"
36+
@echo " epub3 to make an epub3"
37+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
38+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
39+
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
40+
@echo " text to make text files"
41+
@echo " man to make manual pages"
42+
@echo " texinfo to make Texinfo files"
43+
@echo " info to make Texinfo files and run them through makeinfo"
44+
@echo " gettext to make PO message catalogs"
45+
@echo " changes to make an overview of all changed/added/deprecated items"
46+
@echo " xml to make Docutils-native XML files"
47+
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
48+
@echo " linkcheck to check all external links for integrity"
49+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
50+
@echo " coverage to run coverage check of the documentation (if enabled)"
51+
@echo " dummy to check syntax errors of document sources"
52+
53+
.PHONY: clean
54+
clean:
55+
rm -rf $(BUILDDIR)/*
56+
57+
.PHONY: html
58+
html:
59+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
60+
@echo
61+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
62+
63+
.PHONY: dirhtml
64+
dirhtml:
65+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
66+
@echo
67+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
68+
69+
.PHONY: singlehtml
70+
singlehtml:
71+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
72+
@echo
73+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
74+
75+
.PHONY: pickle
76+
pickle:
77+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
78+
@echo
79+
@echo "Build finished; now you can process the pickle files."
80+
81+
.PHONY: json
82+
json:
83+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
84+
@echo
85+
@echo "Build finished; now you can process the JSON files."
86+
87+
.PHONY: htmlhelp
88+
htmlhelp:
89+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
90+
@echo
91+
@echo "Build finished; now you can run HTML Help Workshop with the" \
92+
".hhp project file in $(BUILDDIR)/htmlhelp."
93+
94+
.PHONY: qthelp
95+
qthelp:
96+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
97+
@echo
98+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
99+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
100+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Flask-Ask.qhcp"
101+
@echo "To view the help file:"
102+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Flask-Ask.qhc"
103+
104+
.PHONY: applehelp
105+
applehelp:
106+
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
107+
@echo
108+
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
109+
@echo "N.B. You won't be able to view it unless you put it in" \
110+
"~/Library/Documentation/Help or install it in your application" \
111+
"bundle."
112+
113+
.PHONY: devhelp
114+
devhelp:
115+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
116+
@echo
117+
@echo "Build finished."
118+
@echo "To view the help file:"
119+
@echo "# mkdir -p $$HOME/.local/share/devhelp/Flask-Ask"
120+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Flask-Ask"
121+
@echo "# devhelp"
122+
123+
.PHONY: epub
124+
epub:
125+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
126+
@echo
127+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
128+
129+
.PHONY: epub3
130+
epub3:
131+
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
132+
@echo
133+
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
134+
135+
.PHONY: latex
136+
latex:
137+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
138+
@echo
139+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
140+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
141+
"(use \`make latexpdf' here to do that automatically)."
142+
143+
.PHONY: latexpdf
144+
latexpdf:
145+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
146+
@echo "Running LaTeX files through pdflatex..."
147+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
148+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
149+
150+
.PHONY: latexpdfja
151+
latexpdfja:
152+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
153+
@echo "Running LaTeX files through platex and dvipdfmx..."
154+
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
155+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
156+
157+
.PHONY: text
158+
text:
159+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
160+
@echo
161+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
162+
163+
.PHONY: man
164+
man:
165+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
166+
@echo
167+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
168+
169+
.PHONY: texinfo
170+
texinfo:
171+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
172+
@echo
173+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
174+
@echo "Run \`make' in that directory to run these through makeinfo" \
175+
"(use \`make info' here to do that automatically)."
176+
177+
.PHONY: info
178+
info:
179+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
180+
@echo "Running Texinfo files through makeinfo..."
181+
make -C $(BUILDDIR)/texinfo info
182+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
183+
184+
.PHONY: gettext
185+
gettext:
186+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
187+
@echo
188+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
189+
190+
.PHONY: changes
191+
changes:
192+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
193+
@echo
194+
@echo "The overview file is in $(BUILDDIR)/changes."
195+
196+
.PHONY: linkcheck
197+
linkcheck:
198+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
199+
@echo
200+
@echo "Link check complete; look for any errors in the above output " \
201+
"or in $(BUILDDIR)/linkcheck/output.txt."
202+
203+
.PHONY: doctest
204+
doctest:
205+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
206+
@echo "Testing of doctests in the sources finished, look at the " \
207+
"results in $(BUILDDIR)/doctest/output.txt."
208+
209+
.PHONY: coverage
210+
coverage:
211+
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
212+
@echo "Testing of coverage in the sources finished, look at the " \
213+
"results in $(BUILDDIR)/coverage/python.txt."
214+
215+
.PHONY: xml
216+
xml:
217+
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
218+
@echo
219+
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
220+
221+
.PHONY: pseudoxml
222+
pseudoxml:
223+
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
224+
@echo
225+
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
226+
227+
.PHONY: dummy
228+
dummy:
229+
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
230+
@echo
231+
@echo "Build finished. Dummy builder generates no files."

docs/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Documentation
2+
The documentation is generated using [Sphinx](http://www.sphinx-doc.org/en/master/).
3+
4+
If you want to generate the documentation, you can run:
5+
```
6+
make html
7+
```
8+
9+
# Installation
10+
The following packages are required to generate the documentation:
11+
```
12+
pip install Sphinx
13+
pip install Flask-Sphinx-Themes
14+
```
15+
16+
# Read The Docs
17+
You can also find the documentation on see [this site](http://flask-monitoringdashboard.readthedocs.io).

0 commit comments

Comments
 (0)