Flask "To-Do" Sample Application
- This package is not hosted on Pypi. You can install all dependencies locally using
pip install -r azure_monitor/flask_sample/requirements.txt.
- To send telemetry to Azure Monitor, pass in your instrumentation key into
INSTRUMENTATION_KEY = <your-ikey-here>
The default database URI links to a sqlite database
app.db. To configure a different database, you can modify
config.py and change the
SQLALCHEMY_DATABASE_URI value to point to a database of your choosing.
SQLALCHEMY_DATABASE_URI = <your-database-URI-here>
- Navigate to where
- Run the main application via
- Hit your local endpoint (should be http://localhost:5000). This should open up a browser to the main page.
- On the newly opened page, you can add tasks via the textbox under
Add a new todo item:. You can enter any text you want (cannot be blank).
Add Itemto add the task. The task will be added under
Incomplete Items. Adding an item with greater than 10 characters will generate an error.
- To utilize the
Save to Filefeature, run the endpoint application via
python endpoint.py. This will run another Flask application with a WSGI server running on http://localhost:5001. Click
Save to Fileand all tasks will be written to a file
- Each task has a
Mark As Completebutton. Clicking it will move the task from incomplete to completed.
Types of telemetry sent
There are various types of telemetry that are being sent in the sample application. Refer to Telemetry Type in Azure Monitor. Every button click hits an endpoint that exists in the flask application, so they will be treated as incoming requests (
requests table in Azure Monitor). A log message is also sent every time a button is clicked, so a log telemetry is sent (
traces table in Azure Monitor). An exception telemetry is sent when an invalid task is entered (greater than 10 characters).