Operation Center Data Flow Tracing
npm install opc-dataflow-trace```
npm install opc-dataflow-trace
* Require it in your application
` javascript`
const DFT = require('opc-dataflow-trace');
* initDataFlow, it will init a dataflow sender
` javascript`
DFT.initDataFlow({
appKey: '3495f290-ceb7-11e9-a993-8f573bffb7d3',
serverUrl: 'http://DFT_server/api/milestone/tracing',
needPrintSuccessLog: true
},
null,
'SI submission');
* send milestone to DFT server
` javascript``
DFT.milestone({
traceData: {bkg_num: '443215123'},
opcTracingId: '932837035',
milestoneKey: 'SAVE_BR_TO_DB',
isPassed: true
},
'SI submission');
1. initDataFlow(options, logger, dataFlowName = '__default__')
Parameters | Type | Description | Mandatory | Default value
------------|----------------|-------------|------------ | ----------
options |Object | detail as below | Y | -
options.appKey | String | an unique appKey generated by DFT server for your data flow | Y | -
options.serverUrl | String | DFT server URL | Y | -
options.proxy | String | if you need a proxy to DFT server | N | -
options.needPrintSuccessLog | Boolean | output the success log after send milestone | N | -
logger | String | use your logger to re-direct the success log| N | 'console'
dataFlowName| String | must keep it same as the dataFlowName in below 'milestone' function|N | '___default___'
2. milestone(data, dataFlowName = '__default__')
Parameters | Type | Description | Mandatory | Default value
------------|----------------|-------------|------------ | ----------
data| Object | detail as below | Y | -
data.traceData | Object/String | You can post some data for better trouble shooting, such as bkg_num | N | -
data.opcTracingId | String | an unique id from your application. make sure it must be unique| Y | -
data.milestoneKey | String | a milestone code which align between dev team & opc team | Y | -
data.isPassed | Boolean | specify whether this milestone/step is successfully proceed by your application | Y | false
dataFlowName| String | must keep it same as the dataFlowName in above 'initDataFlow' function| N | '__default__'