Gathering detailed insights and metrics for opentsdb-mquery
Gathering detailed insights and metrics for opentsdb-mquery
Gathering detailed insights and metrics for opentsdb-mquery
Gathering detailed insights and metrics for opentsdb-mquery
npm install opentsdb-mquery
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1 Stars
10 Commits
2 Watching
1 Branches
2 Contributors
Updated on 13 Jun 2017
JavaScript (82.47%)
Makefile (17.53%)
Cumulative downloads
Total Downloads
Last day
-75%
1
Compared to previous day
Last week
-80%
9
Compared to previous week
Last month
-28.6%
90
Compared to previous month
Last year
140.5%
1,688
Compared to previous year
1
5
OpenTSDB metric query factory.
OpenTSDB permits two query types: metric and tsuid.
Metric queries are general queries which return an indeterministic number of timeseries. OpenTSDB implements metric queries by searching for timeseries matching the metric criteria, e.g., metric name
and tag
.
TSUID queries request a specific timeseries having a unique id. Every timeseries has an assigned unique identifier, which is based on metric name
and any tags
.
This module provides a metric query generator.
For use in Node.js,
1$ npm install opentsdb-mquery
For use in the browser, use browserify.
To use the module,
1var createQuery = require( 'opentsdb-mquery' );
To create a new metric query,
1var mQuery = createQuery();
A metric query is configurable and has the following methods...
This method is a setter/getter. If no aggregator
is provided, returns the query aggregator. The default aggregator is avg
. To set a different aggregator
,
1mQuery.aggregator( 'min' );
This method is a setter/getter. If no downsample
function is provided, returns the configured downsample
function. By default, downsampling is turned off (i.e., set to null
). To specify a downsample
function,
1mQuery.downsample( '5s-avg' );
This method is a setter/getter. If no boolean flag is provided, returns the flag indicating whether to return the difference between consecutive data values. By default, the flag is false
. To turn on difference calculation,
1mQuery.rate( true );
Note that rate calculation requires a set of three options.
This method is a setter/getter. If no configuration object is provided, returns the rate options: counter
, counterMax
, resetValue
. counter
must be a boolean; counterMax
must be numeric or null
; and resetValue
must be numeric.
By default,
1var rateOptions = { 2 "counter": false, 3 "counterMax": null, 4 "resetValue": 0 5};
This method is a setter/getter. If no arguments are provided, returns all tag names and their values. If a tag
name is specified, returns the value for that tag. Otherwise, sets a tag
to the specified value
.
1mQuery.tags( 'nid', '*' );
The *
(wildcard) indicates all values for a tag
.
This method deletes a query tag
.
1// Add a tag: 2mQuery.tags( 'nid', '*' ); 3 4// Delete the tag: 5mQuery.dtag( 'nid' );
This method is a setter/getter. If no metric name
is provided, returns the query metric name
. A metric name
is required to encode a metric query. To set a metric name
,
1mQuery.metric( 'mem.utilization' );
1var createQuery = require( 'opentsdb-mquery' ); 2 3var mQuery = createQuery(); 4 5mQuery 6 .aggregator( 'sum' ) 7 .downsample( '5m-avg' ) 8 .rate( false ) 9 .metric( 'mem.utilization' ) 10 .tags( 'nid', '1234,5678' ) 11 .tags( 'name', 'beep,boop' );
To run the example code from the top-level application directory,
1$ node ./examples/index.js
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
1$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
1$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
1$ make view-cov
Copyright © 2014. Athan Reines.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 1/9 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More