Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

GADGETS-32: call trace gadget.

  • Loading branch information...
commit ffca6ba142028ea5c3d40f6564070b6b913d2e83 1 parent b299cea
@jeffyu jeffyu authored
View
2  gadget-web/src/main/java/org/overlord/gadgets/web/client/widgets/TabLayout.java
@@ -142,6 +142,8 @@ public void insertTab(String pageId, String tabTitle, Widget widget) {
tabsBar.add(addTabAnchorItem);
+ updateUserCurrentPageId(Long.valueOf(pageId));
+
hidePrompt(promptId);
}
View
1  gadget-web/src/main/webapp/WEB-INF/classes/import.sql
@@ -4,7 +4,6 @@ INSERT INTO GS_USER_GROUP(`USER_ID`, `GROUP_ID`) VALUES(1, 1);
INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Response Time','Red Hat','jeffyu@overlord.com','Response Time Gadget','http://localhost:8080/gadgets/rt-gadget/thumbnail.png','http://localhost:8080/gadgets/rt-gadget/gadget.xml');
-INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Currency Converter','Google','info@tofollow.com','currency converter widget','http://www.gstatic.com/ig/modules/currency_converter/currency_converter_content/en_us-thm.cache.png','http://www.gstatic.com/ig/modules/currency_converter/currency_converter_v2.xml');
INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Situation Gadget','Red Hat','jeffyu@overlord.com','Situation Gadget','http://localhost:8080/gadgets/situation-gadget/thumbnail.png','http://localhost:8080/gadgets/situation-gadget/gadget.xml');
INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Service Call Gadget','Red Hat','jeffyu@overlord.com','Service Call Gadget','http://localhost:8080/gadgets/calltrace-gadget/thumbnail.png','http://localhost:8080/gadgets/calltrace-gadget/gadget.xml');
INSERT INTO GS_GADGET(`GADGET_TITLE`,`GADGET_AUTHOR`,`GADGET_AUTHOR_EMAIL`,`GADGET_DESCRIPTION`,`GADGET_THUMBNAIL_URL`,`GADGET_URL`) VALUES('Service Overview Gadget','Red Hat','jeffyu@overlord.com','Service Overview Gadget','http://localhost:8080/gadgets/so-gadget/thumbnail.png','http://localhost:8080/gadgets/so-gadget/gadget.xml');
View
55 gadgets/src/main/webapp/calltrace-gadget/calltrace.json
@@ -1,43 +1,12 @@
-{
- "tasks":[
- {
- "type":"Call",
- "component":"TestComponent",
- "operation":"TestOperation",
- "fault":"TestFault",
- "request":"<request/>",
- "response":"<response/>",
- "requestLatency":1,
- "responseLatency":2,
- "tasks":[
- {
- "type":"Task",
- "description":"This is task 1",
- "duration":50,"percentage":25
- },{
- "type":"Call",
- "component":"OtherComponent",
- "operation":"OtherOp",
- "request":"<req2/>",
- "tasks":[
- {
- "type":"Task",
- "description":"This is task 3",
- "duration":100,
- "percentage":100
- }
- ],
- "duration":100,
- "percentage":50
- },{
- "type":"Task",
- "description":"This is task 2",
- "duration":50,
- "percentage":25
- }
- ],
- "duration":56,
- "percentage":100
- }
- ]
-}
+{"tasks":
+ [{"type":"Call","component":"TestService1","operation":"op1","request":"<op1/>","response":"<op1/>","properties":{"trader":"Fred Bloggs","customer":"Acme Inc"},"duration":2000,"status":"Warning", "percentage":100},
+ {"type":"Task","description":"Assign var1","properties":{"name":"var1"},"duration":100,"percentage":5},
+ {"type":"Task","description":"Evaluate expr1","properties":{"expression":"a + b"},"duration":100,"percentage":5},
+ {"type":"Call","component":"TestService2","operation":"op2","request":"<op2/>","response":"<op2/>","requestLatency":10,"responseLatency":10,
+ "tasks":[{"type":"Task","description":"Store var31","properties":{"name":"var31","value":"xyz"},"duration":680,"percentage":100}],"properties":{"customer":"Acme Inc"},"duration":700,"percentage":35},
+
+ {"type":"Call","component":"TestService3","operation":"op3","request":"<op3/>","response":"<op3/>","fault":"TestFault","requestLatency":10,"responseLatency":10,
+ "tasks":[
+ {"type":"Task","description":"Store var41","properties":{"name":"var41","value":"abc"},"duration":340,"percentage":50},{"type":"Task","description":"Store var42","properties":{"name":"var42","value":"ghj"},"duration":340,"percentage":50}],"properties":{"trader":"Fred Bloggs"},"duration":700,"status":"Fail","percentage":35},
+
+ {"type":"Task","description":"Store var1","duration":100,"percentage":5}]}
View
76 gadgets/src/main/webapp/calltrace-gadget/gadget.xml
@@ -2,12 +2,10 @@
<Module>
<ModulePrefs title="Call Trace" description="Call Trace gadget"
author="Jeff Yu" author_email="jeff.yuchang@gmail.com">
- <Require feature="views"/>
- <Require feature="setprefs"/>
<Require feature="tabs"/>
</ModulePrefs>
<UserPref name="serviceUrl" display_name="Service URL:"
- default_value="http://localhost:8080/overlord-bam/acm/query" />
+ default_value="http://localhost:8080/overlord-bam-services/call/trace/instance?correlation=test" />
<UserPref name="refreshCycle" display_name="Refresh Interval(sec):"
default_value="30" datatype="enum">
<EnumValue value="30" />
@@ -20,13 +18,15 @@
<Content type="html"><![CDATA[
<style type="text/css">
#tree {width:90%;}
- #detail {border:1px solid #69C; border-collapse: collapse;font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; font-size: 9pt;margin:10px;}
+ #detail {width:90%; border:1px solid #69C; border-collapse: collapse;font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; font-size: 9pt;margin:10px;}
#detail thead th {font-weight: normal;font-size: 9pt; color:#039;border-bottom: 1px dashed #69C; text-align: left;}
- #detail tbody td {text-align: left;vertical-align: top;color: #669; padding: 2px 2px; }
- #detail tbody th {text-align: right;vertical-align: top;color: #669; padding: 2px 2px; }
+ #detail tbody td {text-align:left; font-size:9pt; vertical-align: top;color: #669; padding: 2px 2px; }
+ #detail tbody th {text-align: right; font-size:9pt; vertical-align: top;color: #669; padding: 2px 2px; }
+ .detail-properties {border-bottom: 1px dashed #69C; font-size:9pt; }
</style>
<link href="skin/ui.dynatree.css" rel="stylesheet" type="text/css">
+ <link href="tabs.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>
<script type="text/javascript" src="jquery-ui.custom.min.js"></script>
@@ -34,10 +34,12 @@
<script type="text/javascript">
+ var tabset;
+
function makeJSONRequest(){
- var restUrl = "http://localhost:8080/gadgets/calltrace-gadget/calltrace.json";
- var params = {};
var prefs = new gadgets.Prefs();
+ var restUrl = prefs.getString("serviceUrl");
+ var params = {};
params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
params[gadgets.io.RequestParameters.REFRESH_INTERVAL] = prefs.getInt("refreshCycle");
params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.GET;
@@ -47,6 +49,9 @@
function updateResponse(response) {
var data = response.data;
+ if (response.data == undefined) {
+ return ;
+ }
var treeData = new Array(data.tasks.length);
for(var i = 0; i < treeData.length; i++) {
var task = data.tasks[i];
@@ -54,7 +59,7 @@
}
initialiseTree(treeData);
- $("#detail").hide();
+ //$("#detail").hide();
}
function convertJsonToTreeData(task) {
@@ -84,6 +89,11 @@
treeObject['duration'] = task.duration;
treeObject['percentage'] = task.percentage;
treeObject['type'] = task.type;
+ treeObject['addClass'] = '';
+ }
+
+ if (task.properties != undefined) {
+ treeObject['properties'] = task.properties;
}
if (task.tasks != undefined) {
@@ -108,7 +118,8 @@
}
function showTheDetail(node) {
- $("#detail").show();
+ //$("#detail").show();
+ tabset.setSelectedTab(1);
var properties = ['type', 'component', 'operation', 'request', 'response', 'fault', 'requestLatency', 'responseLatency', 'duration', 'percentage'];
var thedata = node.data;
deleteRows();
@@ -118,6 +129,16 @@
insertRow([theProperty + " :" , thedata[theProperty]]);
}
}
+
+ if (thedata.properties != undefined) {
+ insertPropertiesTitle();
+ for (var pname in thedata.properties) {
+ if (thedata.properties.hasOwnProperty(pname)) {
+ insertRow([pname + ":", thedata.properties[pname]]);
+ }
+ }
+ }
+
}
function deleteRows() {
@@ -137,6 +158,7 @@
theHead = document.createElement("TH");
theHead.innerHTML = data[0];
+ theHead.setAttribute("width", "35%");
theRow.appendChild(theHead);
theCell = document.createElement("TD");
@@ -154,19 +176,29 @@
else return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
+ function insertPropertiesTitle() {
+ var theBody, theRow, theCell;
+ theBody = document.getElementById("detail-body");
+ theRow = document.createElement("TR");
+ theBody.appendChild(theRow);
+
+ theCell = document.createElement("TD");
+ theCell.setAttribute("colspan", "2");
+ theCell.setAttribute("class", "detail-properties");
+ theCell.innerHTML = "Properties";
+ theRow.appendChild(theCell);
+ }
+
function loadData() {
- var prefs, refreshInterval, tabset, theName;
+ var prefs, refreshInterval;
prefs = new gadgets.Prefs();
refreshInterval = prefs.getInt("refreshCycle")
- theName = getViewName();
- window.alert(theName);
- if (theName == "home") {
- tabset = new gadgets.TabSet();
- tabset.alignTabs('left');
- tabset.addTab("Call Trace Tree", {contentContainer:document.getElementById("tree")});
- tabset.addTab("Summary", {contentContainer:document.getElementById("detail")});
- window.alert("done");
- }
+
+ tabset = new gadgets.TabSet();
+ tabset.alignTabs('left');
+ tabset.addTab("Call Trace Tree", {contentContainer:document.getElementById("tree")});
+ tabset.addTab("Summary", {contentContainer:document.getElementById("detail")});
+
makeJSONRequest();
setInterval(makeJSONRequest, refreshInterval * 1000);
}
@@ -181,8 +213,8 @@
<div id="tree"></div>
<div id="detail">
- <table style="width:100%" summary="Summary">
- <thead><tr><th width="30%">Summary</th><th></th></tr></thead>
+ <table style="width:95%" summary="Summary">
+ <thead><tr><th colspan="2">Summary</th></tr></thead>
<tbody id="detail-body">
</tbody>
</table>
View
BIN  gadgets/src/main/webapp/calltrace-gadget/thumbnail.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  gadgets/src/main/webapp/so-gadget/gadget.xml
@@ -24,7 +24,6 @@
params[gadgets.io.RequestParameters.REFRESH_INTERVAL] = prefs.getInt("refreshCycle");
restUrl = prefs.getString("serviceUrl");
-
if (getViewName() == "default") {
restUrl = restUrl + "?width=300";
}
Please sign in to comment.
Something went wrong with that request. Please try again.