此项目允许在使用数据分析工具(如numpy)分析结果以进行进一步处理的同时查询application insights分析api。

aianalytics-client的Python项目详细描述


https://badge.fury.io/py/aianalytics-client.svg

此项目允许查询application insights分析api,同时以简单的方式解析结果以进行进一步的处理。Application Insights Analytics是application insights的强大搜索功能,它允许查询applciation insights遥测。 此模块用于其他数据分析包,如numpymatplotlib。查询结果是numpy数组。

Note: this package is not for sending telemetry to the Application Insights serivce. For that you can use the official python sdk repo.

要求

该模块在Python2.7和Python3.5上进行了测试。python 3的旧版本可能也可以工作。

要在Microsoft Visual Studio中打开项目,您需要Python Tools for Visual Studio

安装

要安装最新版本,可以使用pip

$ pip install aianalytics-client

用法

安装后,您可以查询应用程序Insights遥测。这是一些样品。

查询过去24小时的异常并打印它们

fromanalytics.clientimportAnalyticsClientclient=AnalyticsClient('<Your app id goes here>','<You app key goes here>')result=client.query('exceptions | where timestamp > ago(24h) | project timestamp, type, outerMessage')forrowinresult.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]))

查询上周的平均请求持续时间,并使用matplotlib进行绘图

fromanalytics.clientimportAnalyticsClientclient=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')importmatplotlib.pyplotaspltplt.plot(result["timestamp"],result["Duration"])plt.show()

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android ListView显示的数字不超过8位   java什么导致警告“Classpath entry/XXX/XXX.jar将不会导出或发布。可能会导致运行时ClassNotFoundException。”   java使用Spring容器在非Spring对象上调用方法,允许参数连接?   java Android:当另一个手指已经在触摸屏幕时,是否可以处理一次点击?   java Veil加载JFrame上的图像或加载面板   JavaSpring没有为Redis缓存上的记录设置过期时间   java异常:SparkException:任务不可序列化   java Android studio用户注册数据未插入firebase数据库   java在StackPane中的区域图上覆盖节点   java获取活动UI的“会话已过期”消息   java组织。冬眠MappingNotFoundException:资源:*hbm。找不到xml   java Mockito mock在尝试存根包保护的方法时调用实方法实现