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']
|
db_password = os.environ['STACKTACH_DB_PASSWORD']
|
||||||
install_dir = os.environ['STACKTACH_INSTALL_DIR']
|
install_dir = os.environ['STACKTACH_INSTALL_DIR']
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = True
|
||||||
TEMPLATE_DEBUG = DEBUG
|
TEMPLATE_DEBUG = DEBUG
|
||||||
|
|
||||||
ADMINS = (
|
ADMINS = (
|
||||||
|
@ -81,7 +81,8 @@ class Timing(models.Model):
|
|||||||
start_raw = models.ForeignKey(RawData, related_name='+', null=True)
|
start_raw = models.ForeignKey(RawData, related_name='+', null=True)
|
||||||
end_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)
|
end_when = models.DecimalField(null=True, max_digits=20, decimal_places=6)
|
||||||
|
|
||||||
diff = 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)."""
|
final .end event (with the same Request ID)."""
|
||||||
request_id = models.CharField(max_length=50, db_index=True)
|
request_id = models.CharField(max_length=50, db_index=True)
|
||||||
lifecycle = models.ForeignKey(Lifecycle)
|
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)
|
start = models.DecimalField(max_digits=20, decimal_places=6)
|
||||||
duration = 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):
|
def do_kpi(request):
|
||||||
yesterday = datetime.datetime.utcnow() - datetime.timedelta(days=1)
|
yesterday = datetime.datetime.utcnow() - datetime.timedelta(days=1)
|
||||||
|
yesterday = dt.dt_to_decimal(yesterday)
|
||||||
trackers = models.RequestTracker.objects.select_related() \
|
trackers = models.RequestTracker.objects.select_related() \
|
||||||
.exclude(last_timing=None) \
|
.exclude(last_timing=None) \
|
||||||
.exclude(start__lt=yesterday) \
|
.exclude(start__lt=yesterday) \
|
||||||
|
@ -87,7 +87,7 @@ def start_kpi_tracking(lifecycle, raw):
|
|||||||
start=raw.when,
|
start=raw.when,
|
||||||
lifecycle=lifecycle,
|
lifecycle=lifecycle,
|
||||||
last_timing=None,
|
last_timing=None,
|
||||||
duration=0.0)
|
duration=str(0.0))
|
||||||
tracker.save()
|
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
|
Until then, we'll take the lazy route and be aware of these
|
||||||
potential fence-post issues."""
|
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:
|
if len(trackers) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -146,7 +147,7 @@ def aggregate(raw):
|
|||||||
|
|
||||||
if not step in ['start', 'end']:
|
if not step in ['start', 'end']:
|
||||||
# Perhaps it's an operation initiated in the API?
|
# Perhaps it's an operation initiated in the API?
|
||||||
start_kpi_tracking(lifecyle, raw)
|
start_kpi_tracking(lifecycle, raw)
|
||||||
return
|
return
|
||||||
|
|
||||||
# We are going to try to track every event pair that comes
|
# We are going to try to track every event pair that comes
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
WORKDIR=/srv/www/stacktach/django/stproject/
|
WORKDIR=/srv/www/stacktach/app
|
||||||
DAEMON=/usr/bin/python
|
DAEMON=/usr/bin/python
|
||||||
ARGS=$WORKDIR/worker/start_workers.py
|
ARGS=$WORKDIR/worker/start_workers.py
|
||||||
PIDFILE=/var/run/stacktach.pid
|
PIDFILE=/var/run/stacktach.pid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user