Permalink
Browse files

fixes for read limit

  • Loading branch information...
1 parent 354e35e commit 67f5c5df78a75b04dd2d7db004c064b3aa7bcef2 @jurka jurka committed Jul 31, 2011
View
21 gearoscope/apps/dashboard/models.py
@@ -1,5 +1,6 @@
import logging, random
import re
+from django.conf import settings
from django.db import models
from datetime import datetime
@@ -59,7 +60,7 @@ class ServerLogReader(object):
log = []
def __init__(self, reader):
- ServerLogReader.log = reader.tail(10000)
+ ServerLogReader.log = reader.tail(settings.DASHBOARD_LOG_LIMIT)
def get_records_for(self, server):
# TODO: implement server reader
@@ -76,7 +77,7 @@ class GearmanLogReader(object):
sender = 'gearman'
def __init__(self, reader):
- GearmanLogReader.log = reader.tail(10000)
+ GearmanLogReader.log = reader.tail(settings.DASHBOARD_LOG_LIMIT)
def get_summary(self, records):
for record in records:
@@ -124,7 +125,7 @@ class SupervisorLogReader(object):
sender = 'supervisor'
def __init__(self, reader):
- SupervisorLogReader.log = reader.tail(10000)
+ SupervisorLogReader.log = reader.tail(settings.DASHBOARD_LOG_LIMIT)
# print [ i.message for i in SupervisorLogReader.log]
def get_records_for(self, supervisor):
@@ -150,7 +151,7 @@ class ProcessLogReader(object):
sender = 'process'
def __init__(self, reader):
- ProcessLogReader.log = reader.tail(10000)
+ ProcessLogReader.log = reader.tail(settings.DASHBOARD_LOG_LIMIT)
def get_records(self):
@@ -212,15 +213,3 @@ def get_records(self):
return records
-
-
-
-
-
-
-
-
-
-
-
-
View
2 gearoscope/apps/monitor/reader.py
@@ -9,7 +9,7 @@ def tail(self, size, verbosity='info'):
limit = MonitorEntry.LEVELS.index(verbosity.lower())
lines = [entry for entry in lines if entry.code >= limit]
- return lines[:size]
+ return lines[:max(size,len(lines))]
class MonitorEntry(object):
__slots__=('time', 'sender', 'level', 'code', 'message')
View
3 gearoscope/settings.py
@@ -165,3 +165,6 @@
# should have permissions to read/write this file
SONAR_CONFIGURATION_FILE = os.path.join(WORKDIR, 'data', 'sonar.conf')
+# Maximum records to read from sonar log file
+DASHBOARD_LOG_LIMIT = 10000
+
View
7 gearoscope/static/js/script.js
@@ -191,7 +191,6 @@ var queue = {
update: function(){
var qdata = $(this.item).data('queue-data');
-
var counter = $(this.item).data('counter') || 0;
$(this.item)
@@ -202,10 +201,10 @@ var queue = {
// $(this.item).find('.queue_stats .cpu.progress').width(Math.min(Math.max(qdata.cpu_value, 1), 99)+'%');
// $(this.item).find('.queue_stats .memory.progress').width(Math.min(Math.max(qdata.memory_value, 1), 99)+'%');
- var run_points = this.appendPoint($(this.item).data('run_points'), counter, qdata.params.running);
+ var run_points = this.appendPoint($(this.item).data('run_points'), counter, (""+qdata.params.running).replace("\"",''));
$(this.item).data('run_points', run_points);
- var queued_points = this.appendPoint($(this.item).data('queued_points'), counter, qdata.params.queued);
+ var queued_points = this.appendPoint($(this.item).data('queued_points'), counter, (""+qdata.params.queued).replace("\"",''));
$(this.item).data('queued_points', queued_points);
$(this.item).data('counter', counter + 1);
@@ -391,7 +390,7 @@ var requestor = {
init: function(){
requestor.start();
- setInterval(requestor.start, 5000);
+ setInterval(requestor.start, 3000);
}

0 comments on commit 67f5c5d

Please sign in to comment.