npm.io
1.1.6 • Published 7 years ago

opc-dataflow-trace

Licence
ISC
Version
1.1.6
Deps
2
Size
9 kB
Vulns
1
Weekly
0

Data Flow Tracing (DFT)

Data Flow Tracing is a tool to monitor the status of data flow by milestones.

Installation

npm install opc-dataflow-trace

How To Use (sample)

  • Require it in your application
const DFT = require('opc-dataflow-trace');
  • initDataFlow, it will init a dataflow sender
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
DFT.milestone({ 
        traceData: {bkg_num: '443215123'}, 
        opcTracingId: '932837035', 
        milestoneKey: 'SAVE_BR_TO_DB', 
        isPassed: true
    }, 
    'SI submission');

Functions

  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'
  1. 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'