diff --git a/settings.py b/settings.py index 05068b6..a972fb5 100644 --- a/settings.py +++ b/settings.py @@ -16,7 +16,7 @@ except ImportError: db_password = os.environ['STACKTACH_DB_PASSWORD'] install_dir = os.environ['STACKTACH_INSTALL_DIR'] -DEBUG = False +DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( diff --git a/stacktach/models.py b/stacktach/models.py index f09e3ff..2a5310b 100644 --- a/stacktach/models.py +++ b/stacktach/models.py @@ -81,7 +81,8 @@ class Timing(models.Model): start_raw = models.ForeignKey(RawData, related_name='+', null=True) end_raw = models.ForeignKey(RawData, related_name='+', null=True) - start_when = models.DecimalField(null=True, max_digits=20, decimal_places=6) + start_when = models.DecimalField(null=True, max_digits=20, + decimal_places=6) end_when = models.DecimalField(null=True, max_digits=20, decimal_places=6) diff = models.DecimalField(null=True, max_digits=20, decimal_places=6) @@ -93,7 +94,7 @@ class RequestTracker(models.Model): final .end event (with the same Request ID).""" request_id = models.CharField(max_length=50, db_index=True) lifecycle = models.ForeignKey(Lifecycle) - last_timing = models.ForeignKey(Timing, null=true) + last_timing = models.ForeignKey(Timing, null=True) start = models.DecimalField(max_digits=20, decimal_places=6) duration = models.DecimalField(max_digits=20, decimal_places=6) diff --git a/stacktach/stacky_server.py b/stacktach/stacky_server.py index 127d400..4daeaba 100644 --- a/stacktach/stacky_server.py +++ b/stacktach/stacky_server.py @@ -281,6 +281,7 @@ def do_watch(request, deployment_id): def do_kpi(request): yesterday = datetime.datetime.utcnow() - datetime.timedelta(days=1) + yesterday = dt.dt_to_decimal(yesterday) trackers = models.RequestTracker.objects.select_related() \ .exclude(last_timing=None) \ .exclude(start__lt=yesterday) \ diff --git a/stacktach/views.py b/stacktach/views.py index 042ae0b..f71cecc 100644 --- a/stacktach/views.py +++ b/stacktach/views.py @@ -87,7 +87,7 @@ def start_kpi_tracking(lifecycle, raw): start=raw.when, lifecycle=lifecycle, last_timing=None, - duration=0.0) + duration=str(0.0)) tracker.save() @@ -102,7 +102,8 @@ def update_kpi(lifecycle, timing, raw): Until then, we'll take the lazy route and be aware of these potential fence-post issues.""" - trackers = models.RequestTracker.objects.filter(request_id=raw.request.id) + trackers = models.RequestTracker.objects.\ + filter(request_id=raw.request_id) if len(trackers) == 0: return @@ -146,7 +147,7 @@ def aggregate(raw): if not step in ['start', 'end']: # Perhaps it's an operation initiated in the API? - start_kpi_tracking(lifecyle, raw) + start_kpi_tracking(lifecycle, raw) return # We are going to try to track every event pair that comes diff --git a/worker/stacktach.sh b/worker/stacktach.sh index be51937..e048438 100755 --- a/worker/stacktach.sh +++ b/worker/stacktach.sh @@ -1,6 +1,6 @@ #!/bin/bash -WORKDIR=/srv/www/stacktach/django/stproject/ +WORKDIR=/srv/www/stacktach/app DAEMON=/usr/bin/python ARGS=$WORKDIR/worker/start_workers.py PIDFILE=/var/run/stacktach.pid