Highlight last trace for OSprofiler html output
Sometime, exception or error occurs, we want to find problems quickly. However, if an output of OSprofiler is long, it will very hard to find where is the last trace that get stuck. This visualization can help us a lot in finding problems in services. Example: https://tovin07.github.io/glance-image-list-highlight.html Change-Id: Iaabb7850db4dfeec8ce38e0ef5264db8122355ef
This commit is contained in:
parent
65a424e457
commit
d0f5aed405
@ -117,6 +117,13 @@
|
||||
return input;
|
||||
};
|
||||
|
||||
vm.isLastTrace = function(started) {
|
||||
if (started >=0 && started == vm.tree[0].info.last_trace_started) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
vm.getWidth = function(data) {
|
||||
var fullDuration = vm.tree[0].info.finished;
|
||||
var duration = (data.info.finished - data.info.started) * 100.0 / fullDuration;
|
||||
@ -208,7 +215,7 @@
|
||||
<script type="text/ng-template" id="tree_item_renderer.html">
|
||||
<div ng-init="hide_children=false">
|
||||
<table class="trace cursor_pointer_on_hover">
|
||||
<tr>
|
||||
<tr ng-class="{'bg-success': vm.isLastTrace(data.info.started)}">
|
||||
<td class="level" style="padding-left: {{::data.level * 5}}px;">
|
||||
<button type="button" class="btn btn-default btn-xs" ng-disabled="data.is_leaf" ng-click="hide_children=!hide_children">
|
||||
<span class="glyphicon glyphicon-{{(data.is_leaf) ? 'cloud' : ((hide_children) ? 'plus': 'minus')}}"></span>
|
||||
|
@ -61,6 +61,8 @@ class Driver(object):
|
||||
self.result = {}
|
||||
self.started_at = None
|
||||
self.finished_at = None
|
||||
# Last trace started time
|
||||
self.last_started_at = None
|
||||
|
||||
def notify(self, info, **kwargs):
|
||||
"""This method will be called on each notifier.notify() call.
|
||||
@ -181,6 +183,8 @@ class Driver(object):
|
||||
self.result[trace_id]["info"]["exception"] = exc
|
||||
else:
|
||||
self.result[trace_id]["info"]["started"] = timestamp
|
||||
if not self.last_started_at or self.last_started_at < timestamp:
|
||||
self.last_started_at = timestamp
|
||||
|
||||
if not self.started_at or self.started_at > timestamp:
|
||||
self.started_at = timestamp
|
||||
@ -235,7 +239,10 @@ class Driver(object):
|
||||
"name": "total",
|
||||
"started": 0,
|
||||
"finished": msec(self.finished_at -
|
||||
self.started_at) if self.started_at else None
|
||||
self.started_at) if self.started_at else None,
|
||||
"last_trace_started": msec(
|
||||
self.last_started_at - self.started_at
|
||||
) if self.started_at else None
|
||||
},
|
||||
"children": self._build_tree(self.result),
|
||||
"stats": stats
|
||||
|
@ -88,7 +88,8 @@ class CeilometerParserTestCase(test.TestCase):
|
||||
"info": {
|
||||
"name": "total",
|
||||
"started": 0,
|
||||
"finished": None
|
||||
"finished": None,
|
||||
"last_trace_started": None
|
||||
},
|
||||
"children": [],
|
||||
"stats": {},
|
||||
@ -402,7 +403,12 @@ class CeilometerParserTestCase(test.TestCase):
|
||||
"exception": "None"},
|
||||
"parent_id": "7253ca8c-33b3-4f84-b4f1-f5a4311ddfa4",
|
||||
"trace_id": "016c97fd-87f3-40b2-9b55-e431156b694b"}],
|
||||
"info": {"finished": 88, "name": "total", "started": 0},
|
||||
"info": {
|
||||
"finished": 88,
|
||||
"name": "total",
|
||||
"started": 0,
|
||||
"last_trace_started": 88
|
||||
},
|
||||
"stats": {"db": {"count": 1, "duration": 20},
|
||||
"wsgi": {"count": 2, "duration": -47}},
|
||||
}
|
||||
|
@ -87,7 +87,8 @@ class MongoDBParserTestCase(test.TestCase):
|
||||
"info": {
|
||||
"name": "total",
|
||||
"started": 0,
|
||||
"finished": None
|
||||
"finished": None,
|
||||
"last_trace_started": None
|
||||
},
|
||||
"children": [],
|
||||
"stats": {},
|
||||
@ -300,7 +301,12 @@ class MongoDBParserTestCase(test.TestCase):
|
||||
"started": 88},
|
||||
"parent_id": "7253ca8c-33b3-4f84-b4f1-f5a4311ddfa4",
|
||||
"trace_id": "016c97fd-87f3-40b2-9b55-e431156b694b"}],
|
||||
"info": {"finished": 88, "name": "total", "started": 0},
|
||||
"info": {
|
||||
"finished": 88,
|
||||
"name": "total",
|
||||
"started": 0,
|
||||
"last_trace_started": 88
|
||||
},
|
||||
"stats": {"db": {"count": 1, "duration": 20},
|
||||
"wsgi": {"count": 3, "duration": 0}}}
|
||||
|
||||
|
@ -89,7 +89,8 @@ class RedisParserTestCase(test.TestCase):
|
||||
"info": {
|
||||
"name": "total",
|
||||
"started": 0,
|
||||
"finished": None
|
||||
"finished": None,
|
||||
"last_trace_started": None
|
||||
},
|
||||
"children": [],
|
||||
"stats": {},
|
||||
@ -305,7 +306,12 @@ class RedisParserTestCase(test.TestCase):
|
||||
"started": 88},
|
||||
"parent_id": "7253ca8c-33b3-4f84-b4f1-f5a4311ddfa4",
|
||||
"trace_id": "016c97fd-87f3-40b2-9b55-e431156b694b"}],
|
||||
"info": {"finished": 88, "name": "total", "started": 0},
|
||||
"info": {
|
||||
"finished": 88,
|
||||
"name": "total",
|
||||
"started": 0,
|
||||
"last_trace_started": 88
|
||||
},
|
||||
"stats": {"db": {"count": 1, "duration": 20},
|
||||
"wsgi": {"count": 3, "duration": 0}}}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user