fixed up a bunch of little gotchas. kpi working
This commit is contained in:
parent
65eae46ac3
commit
03c5a51527
@ -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 = (
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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) \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user