简体   繁体   中英

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. A request completed in 4s or less gets +1, between 4s and 12s gets +0, and over 12s gets -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?

Currently Librato doesn't offer an Apdex score, but there are ways to get an overview of the request timings.

One simple method would be to build a composite metric using the map() function. 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:

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 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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