<commit_before>var path = require('path');
var packageJSON = require(path.normalize(__dirname + path.sep + '..' + path.sep  + 'package.json'));

// These values are probably good starting points, but you should expect to tweak them for your application
var maxEventLoopDelay    = process.env.eventLoopDelay || 5;
var maxMemoryAlloted     = process.env.maxMemoryAlloted || 200;
var maxResqueQueueLength = process.env.maxResqueQueueLength || 1000;

exports.status = {
  name: 'status',
  description: 'I will return some basic information about the API',

  outputExample:{
    'id':'192.168.2.11',
    'actionheroVersion':'9.4.1',
    'uptime':10469
  },

  run: function(api, data, next){

    /* --- Define Helpers --- */

    var checkRam = function(callback){
      var consumedMemoryMB = Math.round(process.memoryUsage().heapUsed / 1024 / 1024 * 100) / 100;
      data.response.consumedMemoryMB = consumedMemoryMB;
      if(consumedMemoryMB > maxMemoryAlloted){
        data.response.nodeStatus = data.connection.localize('Unhealthy');
        data.response.problems.push(data.connection.localize('Using more than ' + maxMemoryAlloted + 'MB of RAM/HEAP'));
      }

      callback();
    };

    var checkEventLoop = function(callback){
      api.utils.eventLoopDelay(10000, function(error, eventLoopDelay){
        data.response.eventLoopDelay = eventLoopDelay;
        if(eventLoopDelay > maxEventLoopDelay){
          data.response.nodeStatus = data.connection.localize('Node Unhealthy');
          data.response.problems.push(data.connection.localize('EventLoop Blocked for more than ' + maxEventLoopDelay + 'ms'));
        }

        callback();
      });
    };

    var checkResqueQueues = function(callback){
      api.tasks.details(function(error, details){
        if(error){ return callback(error); }
        var length = 0;
        Object.keys(details.queues).forEach(function(q){
          length += details.queues[q].length;
        });

        if(length > maxResqueQueueLength){
          data.response.nodeStatus = data.connection.localize('Node Unhealthy');
          data.response.problems.push(data.connection.localize('Resque Queues over ' + maxResqueQueueLength + ' jobs'));
        }

        callback();
      });
    };

    /* --- Run --- */
<commit_msg>return resque queue length<commit_after>var path = require('path');
var packageJSON = require(path.normalize(__dirname + path.sep + '..' + path.sep  + 'package.json'));

// These values are probably good starting points, but you should expect to tweak them for your application
var maxEventLoopDelay    = process.env.eventLoopDelay || 5;
var maxMemoryAlloted     = process.env.maxMemoryAlloted || 200;
var maxResqueQueueLength = process.env.maxResqueQueueLength || 1000;

exports.status = {
  name: 'status',
  description: 'I will return some basic information about the API',

  outputExample:{
    'id':'192.168.2.11',
    'actionheroVersion':'9.4.1',
    'uptime':10469
  },

  run: function(api, data, next){

    /* --- Define Helpers --- */

    var checkRam = function(callback){
      var consumedMemoryMB = Math.round(process.memoryUsage().heapUsed / 1024 / 1024 * 100) / 100;
      data.response.consumedMemoryMB = consumedMemoryMB;
      if(consumedMemoryMB > maxMemoryAlloted){
        data.response.nodeStatus = data.connection.localize('Unhealthy');
        data.response.problems.push(data.connection.localize('Using more than ' + maxMemoryAlloted + 'MB of RAM/HEAP'));
      }

      callback();
    };

    var checkEventLoop = function(callback){
      api.utils.eventLoopDelay(10000, function(error, eventLoopDelay){
        data.response.eventLoopDelay = eventLoopDelay;
        if(eventLoopDelay > maxEventLoopDelay){
          data.response.nodeStatus = data.connection.localize('Node Unhealthy');
          data.response.problems.push(data.connection.localize('EventLoop Blocked for more than ' + maxEventLoopDelay + 'ms'));
        }

        callback();
      });
    };

    var checkResqueQueues = function(callback){
      api.tasks.details(function(error, details){
        if(error){ return callback(error); }
        var length = 0;
        Object.keys(details.queues).forEach(function(q){
          length += details.queues[q].length;
        });

        data.response.resqueTotalQueueLength = length;

        if(length > maxResqueQueueLength){
          data.response.nodeStatus = data.connection.localize('Node Unhealthy');
          data.response.problems.push(data.connection.localize('Resque Queues over ' + maxResqueQueueLength + ' jobs'));
        }

        callback();
      });
    };

    /* --- Run --- */

{'fraction_non_alphanumeric': 0.13111925814103947, 'fraction_numerical': 0.019409100711667026, 'mean_word_length': 3.068421052631579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4777466', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1300, 'n_words': 269}