Microsoft Azure Application Insights integration for Flask.
Project description
# flask_applicationinsights
Flask extension for Microsoft Azure Application Insights.
Make your Flask application able to send tracking information to an Application Insights Azure component.
[![Build Status](https://travis-ci.org/gghez/flask_applicationinsights.svg?branch=master)](https://travis-ci.org/gghez/flask_applicationinsights)
## Dependencies
- flask>=1.0.2
- applicationinsights==0.11.6
> If you are encountering locale issues with application insights, please check this hack: https://github.com/Azure/azure-cli-shell/issues/63
## Usage
Retrieve package from pypi:
```
pip install flask_applicationinsights
```
> Instrumentation key can be provided programmatically as well as by environment variable or flask configuration key.
Key name is `APPINSIGHTS_INSTRUMENTATION_KEY`.
### Basic
Will track all requests (succeeded or failed) to your application insight referenced by its instrumentation key.
```python
from flask import Flask
from flask_applicationinsights import ApplicationInsights
app = Flask(__name__)
insight = ApplicationInsights(instrumentation_key='<yours>')
insight.init_app(app)
@app.route('/')
def index():
return 'HIT'
app.run()
```
### Advanced
You can also add custom properties or measurements to each tracked request by using special decorators.
```python
...
insight = ApplicationInsights(...)
...
@insight.properties
def custom_properties(req: Request, resp: Response):
return {
'req_pragma': req.headers.get('Pragma'),
'resp_charset': resp.charset
}
```
## Contribution
Not open yet due to initial WIP.
Flask extension for Microsoft Azure Application Insights.
Make your Flask application able to send tracking information to an Application Insights Azure component.
[![Build Status](https://travis-ci.org/gghez/flask_applicationinsights.svg?branch=master)](https://travis-ci.org/gghez/flask_applicationinsights)
## Dependencies
- flask>=1.0.2
- applicationinsights==0.11.6
> If you are encountering locale issues with application insights, please check this hack: https://github.com/Azure/azure-cli-shell/issues/63
## Usage
Retrieve package from pypi:
```
pip install flask_applicationinsights
```
> Instrumentation key can be provided programmatically as well as by environment variable or flask configuration key.
Key name is `APPINSIGHTS_INSTRUMENTATION_KEY`.
### Basic
Will track all requests (succeeded or failed) to your application insight referenced by its instrumentation key.
```python
from flask import Flask
from flask_applicationinsights import ApplicationInsights
app = Flask(__name__)
insight = ApplicationInsights(instrumentation_key='<yours>')
insight.init_app(app)
@app.route('/')
def index():
return 'HIT'
app.run()
```
### Advanced
You can also add custom properties or measurements to each tracked request by using special decorators.
```python
...
insight = ApplicationInsights(...)
...
@insight.properties
def custom_properties(req: Request, resp: Response):
return {
'req_pragma': req.headers.get('Pragma'),
'resp_charset': resp.charset
}
```
## Contribution
Not open yet due to initial WIP.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for Flask-ApplicationInsights-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82fd0305c7d521c9ff7dbfe7839baaf1c5f60433283a209823304e6381578414 |
|
MD5 | ff5b591db61d6931279bf4610e877be5 |
|
BLAKE2b-256 | dc96a0989de7ed30a85621fbd20eb7e6836fbadeded6847ef8ae95b65102f649 |
Close
Hashes for Flask_ApplicationInsights-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e8118277314f555f5d3680326f5b9e1b2b82b08045e810cb1b9eb65c2e7995e |
|
MD5 | 8b6cdb445156d9e4060eaf9ee5a1ac68 |
|
BLAKE2b-256 | bf5a9478e0a81a92c480da6f22a5435b3183441d3373fc8bbca327561a33aedb |