此项目允许在使用数据分析工具(如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 Play Framework 2.1中的简单搜索?   java:Springbeans的真正工作原理   java不能从字符串中提取数字   不同管道中的java共享ExecutionHandler   在Java中,如何为扩展comparator的类实现多个comparator方法?   通用混沌Java   java问题:从自定义类获取要添加到驱动程序类的形状   java如何利用HikariCP和Hibernate?   eclipse如何执行Java应用程序?   用户界面Java Swing:如何将JLabel的文本绑定到JTable选定行中的列?   java替换JPanel元素而不添加到面板的末尾?   java Sets根据action命令在按钮组中选择了特定的jradiobutton   在java中如何将从控制台添加的字符串中的元素添加到列表中   处理未在浏览器上运行的Java签名小程序   java如何在我的安卓应用程序中单击任意按钮时禁用音频音调?   编码如何在Java中将十六进制转换为utf8编码的字符串   java JSF Spring安全集成问题   java如何更正Oracle for Windows中的字符?   java Spark结构化流媒体:当前批次落后   java Hibernate根据最匹配的条件排序结果