getMetrics-2.js 578 B

12345678910111213141516171819202122
  1. const content = `--[[
  2. Get metrics
  3. Input:
  4. KEYS[1] 'metrics' key
  5. KEYS[2] 'metrics data' key
  6. ARGV[1] start index
  7. ARGV[2] end index
  8. ]]
  9. local rcall = redis.call;
  10. local metricsKey = KEYS[1]
  11. local dataKey = KEYS[2]
  12. local metrics = rcall("HMGET", metricsKey, "count", "prevTS", "prevCount")
  13. local data = rcall("LRANGE", dataKey, tonumber(ARGV[1]), tonumber(ARGV[2]))
  14. local numPoints = rcall("LLEN", dataKey)
  15. return {metrics, data, numPoints}
  16. `;
  17. export const getMetrics = {
  18. name: 'getMetrics',
  19. content,
  20. keys: 2,
  21. };
  22. //# sourceMappingURL=getMetrics-2.js.map