add mappings to better identify what objects individual logs correpond to

This commit is contained in:
Iuri Matias 2019-11-07 13:47:39 -05:00
parent b62f6282a0
commit 3bb28f6e25
4 changed files with 78 additions and 1 deletions

View File

@ -11,6 +11,7 @@
"bootstrap": "^4.3.1",
"fs-extra": "^8.1.0",
"jquery": "^3.4.1",
"lodash.get": "^4.4.2",
"n-readlines": "^1.0.0",
"react": "^16.11.0",
"react-bootstrap": "^1.0.0-beta.14",

View File

@ -35,7 +35,7 @@ class App extends React.PureComponent {
{ name: 'parent', title: 'ParentName'},
{ name: 'summary', title: 'Log', width: 600, hidden: true },
{ name: 'type', title: 'Type' },
{ name: 'name', title: 'Name', width: 350},
{ name: 'name', title: 'Name', width: 450},
{ name: 'inputs_preview', title: 'Inputs'},
{ name: 'outputs_preview', title: 'Outputs'},
{ name: 'timestamp', title: 'Timestamp', hidden: true },

View File

@ -1,3 +1,52 @@
var _get = require('lodash.get');
// map a property depending on type to an identifier
const identifier_mappings = {
request: {
"pipeline:register": "inputs[0].file",
"processes:register": "inputs[0]",
"services:register": "inputs[0]",
"process:logs:register": "inputs[0].processName",
"runcode:whitelist": "inputs[0]",
"runcode:register": "inputs[0]",
"communication:node:register": "inputs[0]",
"blockchain:node:register": "inputs[0]",
"blockchain:node:start": "inputs[0].client",
"whisper:node:register": "inputs[0]",
"blockchain:client:register": "inputs[0]",
"blockchain:api:register": "inputs[1]",
"deployment:deployer:register": "inputs[0]",
"blockchain:client:provider": "inputs[0]",
"embarkjs:plugin:register": "inputs", // multiple relevant params
"embarkjs:console:register": "inputs", // multiple relevant params
"embarkjs:contract:generate": "inputs[0].className", // multiple relevant params
"console:register:helpCmd": "inputs[0].cmdName",
"storage:node:register": "inputs[0]",
"storage:upload:register": "inputs[0]",
"deployment:contract:deploy": "inputs[0].className",
},
trigger_action: {
"deployment:contract:shouldDeploy": "inputs.contract.className",
"deployment:contract:beforeDeploy": "inputs.contract.className",
"deployment:contract:deployed": "inputs.contract.className",
"deployment:contract:undeployed": "inputs.contract.className",
"blockchain:proxy:request": "inputs.reqData.method",
"blockchain:proxy:response": "inputs.reqData.method",
},
action_run: {
"deployment:contract:shouldDeploy": "inputs.contract.className",
"deployment:contract:beforeDeploy": "inputs.contract.className",
"deployment:contract:deployed": "inputs.contract.className",
"deployment:contract:undeployed": "inputs.contract.className",
"blockchain:proxy:request": "inputs.reqData.method",
"blockchain:proxy:response": "inputs.reqData.method",
},
method: {
"deployContract": "inputs.contract.className"
}
}
identifier_mappings.old_request = identifier_mappings.request;
class LogManager {
@ -15,6 +64,10 @@ class LogManager {
let session = Object.values(data).find((x) => x.session === x.id)
return Object.values(data).sort((x) => x.timestamp).map((x) => {
// TODO: should be done on the embark level not on the logger
if (x.name && x.name.indexOf('bound ') > 0) {
x.name = x.name.replace('bound ', ' ')
}
x.timepassed = (x.timestamp - session.timestamp) / 1000.0;
if (data[x.parent_id]) {
if (x.parent_id === session.id && x.module) {
@ -24,6 +77,24 @@ class LogManager {
}
}
if (identifier_mappings[x.type] && identifier_mappings[x.type][x.name]) {
x.name += ` (${_get(x, identifier_mappings[x.type][x.name], "???")})`
} else if (x.type === 'action_run') {
let real_name = x.name.split(" ")[0];
if (identifier_mappings[x.type] && identifier_mappings[x.type][real_name]) {
x.name += ` (${_get(x, identifier_mappings[x.type][real_name], "???")})`
}
}
if (x.name === "blockchain:proxy:request") {
if (x && x.inputs && x.inputs.reqData && x.inputs.reqData.method) {
x.name += ` (${x.inputs.reqData.method})`
} else {
x.name += ` (???)`
}
}
if (x.inputs) {
let params = []
if (Array.isArray(x.inputs)) {

View File

@ -6105,6 +6105,11 @@ lodash.flow@^3.3.0:
resolved "https://registry.yarnpkg.com/lodash.flow/-/lodash.flow-3.5.0.tgz#87bf40292b8cf83e4e8ce1a3ae4209e20071675a"
integrity sha1-h79AKSuM+D5OjOGjrkIJ4gBxZ1o=
lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=
lodash.memoize@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"