# opc-dataflow-trace

> Operation Center Data Flow Tracing

Latest version **1.1.6** (published 2019-11-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install opc-dataflow-trace
pnpm add opc-dataflow-trace
yarn add opc-dataflow-trace
bun add opc-dataflow-trace
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2019-11-08 |
| First published | 2019-08-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | antony.zhang@cargosmart.com |
| Maintainers | fifahuihua |

## Links

- npm: https://www.npmjs.com/package/opc-dataflow-trace
- npm.io page: https://npm.io/package/opc-dataflow-trace

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [request](https://npm.io/package/request.md) ^2.88.0

## Recent versions

- 1.1.6 (latest) — 2019-11-08
- 1.1.5 — 2019-11-08
- 1.1.2 — 2019-09-30
- 1.1.1 — 2019-09-12
- 1.1.0 — 2019-09-03
- 1.0.9 — 2019-08-27
- 1.0.8 — 2019-08-27
- 1.0.7 — 2019-08-26
- 1.0.6 — 2019-08-23
- 1.0.5 — 2019-08-23
- 1.0.4 — 2019-08-23

## README

# 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

``` 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');
```

## 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___'


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__'

---
_Source: https://npm.io/package/opc-dataflow-trace · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
