波前波形库

wavefront-pyformance的Python项目详细描述


波前性能

imageimageimagetravis build status

这是一个用于pyformance的插件,它添加了wavefront报告器(通过代理或直接接收)和一个支持主机级标记的抽象。它还包括对波前增量计数器的支持。

要求

支持Python2.7+和Python3.x。

pip install wavefront-pyformance

用法

波前报告器

Wavefront记者支持在主机级别进行标记。在发送到Wavefront之前,传递给报告者的标签将应用于每个度量。

创建波前报告器

您可以创建一个WavefrontProxyReporterWavefrontDirectReporter,如下所示:

importpyformancefromwavefront_pyformanceimportwavefront_reporterreg=pyformance.MetricsRegistry()# report metrics to a Wavefront proxy every 10swf_proxy_reporter=wavefront_reporter.WavefrontProxyReporter(host=host,port=2878,registry=reg,source='wavefront-pyformance-example',tags={'key1':'val1','key2':'val2'},prefix='python.proxy.',reporting_interval=10)wf_proxy_reporter.start()# report metrics directly to a Wavefront server every 10swf_direct_reporter=wavefront_reporter.WavefrontDirectReporter(server=server,token=token,registry=reg,source='wavefront-pyformance-exmaple',tags={'key1':'val1','key2':'val2'},prefix='python.direct.',reporting_interval=10)wf_direct_reporter.start()

冲洗并停止Wavefront Reporter

创建波前报告程序后,start()将使报告程序每隔reporting_interval秒自动报告。 除此之外,您还可以调用report_now()立即执行报告。report_now()在停止报告程序之前,还应按如下方式调用:

wf_reporter.report_now()wf_reporter.stop()

增量计数器

要创建波前增量计数器:

importpyformancefromwavefront_pyformanceimportdeltareg=pyformance.MetricsRegistry()d_0=delta.delta_counter(reg,'requests_delta')d_0.inc(10)

注意:对任何两种类型的度量使用相同的度量名称将导致服务器上只有一个时间序列,从而导致冲突。 一般来说,所有度量名称都应该不同。如果有要作为计数器和增量计数器跟踪的度量,请考虑向其中一个度量添加相关后缀,以区分一个度量名称与另一个度量名称。

波前直方图

创建Wavefront Histogram

importpyformancefromwavefront_pyformanceimportwavefront_histogramreg=pyformance.MetricsRegistry()h_0=wavefront_histogram.wavefront_histogram(reg,'requests_duration')h_0.add(10)

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

推荐PyPI第三方库


热门话题
java JAXB封送字符串,具有xml值,且不转义该值   java ModelMapper转换器不工作   java像HH000412或HCANN000001这样的前缀是什么意思?   验证日期输入修复java。lang.numberformatexception错误   当表具有外键时,java Telosys代码生成失败   如何使所有派生类一起只能实例化一个实例的单例抽象基类?(爪哇)   java如何在非静态服务类中使用广播接收器   java nutch爬虫相对URL问题   使用Jboss DMR下载/保存java附件   Rest模板:无法提取响应:当我们得到xml响应时,没有找到适合响应类型的HttpMessageConverter,没有绑定到JAVA对象   java如何编写可扩展窗格/面板/卡的代码   java是在ITreeViewerListener的treeExpanded()之前调用ContentProvider的getChildren()吗?   java将JComponent添加到小程序窗格   java混淆:使用简单逻辑的Flames程序