Application Insights Analytics Client for Python
This project enables quering the Application Insights Analytics API while parsing the results for furthur processing in a simple manner. Application Insights Analytics is a powerful search feature of Application Insights, which allows to query your Applciation Insights telemetry. This module is meant to be used with other data analysis packages, such as numpy and matplotlib. The query result are numpy arrays.
Note: this package is not for sending telemetry to the Application Insights serivce. For that you can use the official python sdk repo.
Requirements
This module was tested on Python 2.7 and Python 3.5. Older versions of Python 3 probably work as well.
For opening the project in Microsoft Visual Studio you will need Python Tools for Visual Studio.
Installation
To install the latest release you can use pip.
$ pip install aianalytics-client
Usage
Once installed, you can query your Application Insights telemetry. Here are a few samples.
Query exceptions from the last 24 hours and print them
from analytics.client import AnalyticsClient
client = AnalyticsClient('<Your app id goes here>', '<You app key goes here>')
result = client.query('exceptions | where timestamp > ago(24h) | project timestamp, type, outerMessage')
for row in result.row_iterator():
print ("at {0} there was an exception of type {1} with message {2}".format(row['timestamp'], row['type'], row['outerMessage']))
# Indexes can also be used instead of column names, e.g.:
print ("at {0} there was an exception of type {1} with message {2}".format(row[0], row[1], row[2]))
Query average request duration from the last week and plot using matplotlib
from analytics.client import AnalyticsClient
client = AnalyticsClient('<Your app id goes here>', '<You app key goes here>')
result = client.query('requests | where timestamp > ago(7d) | summarize Duration = avg(duration/1000) by bin(timestamp, 1h) | order by timestamp asc')
import matplotlib.pyplot as plt
plt.plot(result["timestamp"], result["Duration"])
plt.show()
Metadata
Release files for aianalytics-client 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aianalytics-client-0.1.5.zip | 12.1 kB | Without provenance | Details for aianalytics-client-0.1.5.zip |
Release files / aianalytics-client-0.1.5.zip
| Download URL | aianalytics-client-0.1.5.zip |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
19aab031e128826cb8cdfe84d11f63f59d9ac2564263412cc1abe11420d0a6b2
|
|
BLAKE2b-256 checksum How to use checksums |
672b1a3aadd1c6ee1896ef55ddd5987b539c95e4475c61f580ffd094b0d59885
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for aianalytics-client 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.