简体   繁体   English

如何在Librato中创建Apdex分数?

[英]How do I create an Apdex score in Librato?

Say I have a series of request timings and and I want to score them and I have 2 thresholds, 4s and 12s. 假设我有一系列的请求时间,并且想对它们进行评分,并且我有2个阈值,4s和12s。 A request completed in 4s or less gets +1, between 4s and 12s gets +0, and over 12s gets -1. 在4s或更短的时间内完成的请求将获得+1,在4s和12s之间的请求将获得+0,超过12s的请求将获得-1。 I want to sum up the scores and then divide them by the total count of the timings. 我想对分数进行汇总,然后将其除以计时的总次数。 How can I do this in Librato? 如何在Librato中做到这一点?

Currently Librato doesn't offer an Apdex score, but there are ways to get an overview of the request timings. 目前,Librato不提供Apdex评分,但是有一些方法可以大致了解请求时间。

One simple method would be to build a composite metric using the map() function. 一种简单的方法是使用map()函数构建复合指标 This would allow you to break out your metrics request time by host, and visualize the request rate per minute: 这将允许您按主机划分指标请求时间,并可视化每分钟的请求速率:

map({source:"*"},
  rate(s("query-api.rails.request.time", "&", { period: "60", function: "sum" }))
)

If you are wanting a Big Number chart that provides a general idea of the overall request times (as the Apdex score provides) then you could use the following composite metric to display the percentage of hosts reporting under 400 ms: 如果您想要一个大数字图表来提供总体请求时间的一般概念(如Apdex得分所提供的),则可以使用以下复合指标来显示400毫秒内报告的主机的百分比:

scale(
  divide([
  sum(
      map({source:"*"},
          divide([
              filter(s("query-api.rails.request.time", "&", { period:"60", function:"mean" }), {lt: "400", function: "mean"}),
              filter(s("query-api.rails.request.time", "&", { period:"60", function:"mean" }), {lt: "400", function: "mean"})
          ])
      )
  ),
  sum(
      map({source:"*"},
          divide([
              s("query-api.rails.request.time", "&", { period:"60", function:"mean" }),
              s("query-api.rails.request.time", "&", { period:"60", function:"mean" })
          ])
      )
  )
]),
{factor:"100"})

Both of these examples utilize the metric query-api.rails.request.time which comes from librato-rails , but you could substitute this metric with any metric that reports the request time (eg. the front-end collector librato-client ). 这两个示例都利用了来自librato-rails的指标query-api.rails.request.time ,但是您可以将该指标替换为任何报告请求时间的指标(例如,前端收集器librato-client )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM