Microsoft Azure Application Insights integration for Flask.
Project description
# flask_applicationinsights
Flask extension for Microsoft Azure Application Insights.
## Dependencies
- flask>=1.0.2
- applicationinsights==0.11.6
## 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.
## Dependencies
- flask>=1.0.2
- applicationinsights==0.11.6
## 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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9dab2857e4fe5743f9a13a03190f35a89e4ed43c8b80e9ada1ced48847446854 |
|
MD5 | 9d07b8201307eb05301c4999be2b0845 |
|
BLAKE2b-256 | 969922d4909156664000e93ed0ba68eb7ee0818dd277e0d5bbec7c7f4e40727d |
Close
Hashes for Flask_ApplicationInsights-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5ffe8ce91338a02431afa02f8ff957633882fb2f39b01b28b68484806e35e9d |
|
MD5 | c4f820e5551f84605a6232b894e49560 |
|
BLAKE2b-256 | e29a380d62edbf26a75846e42fec313e578b04e6bfec4f8e310df546c4aa1400 |