Any way to import external metrics for thresholds?

I’m looking for an automated way to pass/fail a load test based on my service’s resources metrics(ie. cpu/mem util) under load. As far as I can tell, there is no way query/import metrics from an external source to use for thresholds. Am I better off just running the load test with k6, then separately querying and checking service metrics upon completion?

1 Like

Hi @amcghie, Welcome to the forum, and sorry for the slow reply.

I have been meaning to write and post something like the issue I just posted - External Threshold · Issue #3198 · grafana/k6 · GitHub

I meant to write to you that you should probably have thresholds outside of k6, which is mostly what the write-up was about.

But while writing the example and testing it, it turned out that the same mechanic that allows me to query the metrics and then abort based on them. Allows me to also add them as in k6 metrics.

Big Caveats:

  1. this still generates more metrics - both for requests to query the outside system. And because we also emit the gotten metrics as a new metric in k6, which can go to the same output. So definitely don’t make loops of those :wink:
  2. this requires you to be able to query the metric system you want from within k6.
  3. the above gets more and more complicated with more and more variables added.

Hope this helps you and would like your thoughts on this

1 Like