1.0.0 • Published 3 years ago

@yogsothothtc/metrics-library v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Metrics Library

Configuration

The library can be configured by placing a file named metlibconfig.json into the root directory of a client project (the directory where its package.json is). This file is optional. The following options can be configured:

metlibconfig.json

{
    "baseURL": "metrics api base url",
    "defaultTimeout": "default timeout in milliseconds"
}

Usage

Metrics API Gateway
To use the metrics API directly, import MetricsAPIGateway:

const { MetricsAPIGateway } from 'metrics-library';

// or 

const { MetricsAPIGateway } = require('metrics-library');

It exposes a number of methods that posting, querying and downloading metrics data. These methods return promises. E.g.:

// CREATE:
MetricsAPIGateway.createScenarioCard(scenarioCard)
    .then(response => console.log(response));

// QUERY: 
MetricsAPIGateway.getScenarioCards(from, to, limit)
    .then(cards => console.log(cards));

// or

MetricsAPIGateway.getScenarioCards(queryParamsObject)
    .then(cards => console.log(cards));

// DOWNLOAD:
MetricsAPIGateway.downloadScenarioCards(queryParamsObject, timeout)
    .then(stream => /* consume the stream */);

Redux Middleware NOT FULLY IMPLEMENTED
The Redux middleware can be imported using

const { reduxMiddleware } from 'metrics-library';

// or

const { reduxMiddleware } = require('metrics-library');

The current implementation provides the necessary infrastructure, but is otherwise mostly a skeleton, pending further clarification of data collection logic. At the moment, it simply logs the action to the console.

1.0.0

3 years ago