Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
opentsdb-url
Advanced tools
URL generator for OpenTSDB HTTP data requests.
For use in Node.js,
$ npm install opentsdb-url
For use in the browser, use browserify.
To use the module,
var createFactory = require( 'opentsdb-url' );
A URL generator must be bound to a particular OpenTSDB client instance.
var createClient = require( 'opentsdb-client' );
// Create a new client:
var client = createClient();
// Bind the generator to the client:
var url = createFactory( client );
The instance has the following methods...
Creates a URL template based on the OpenTSDB client configuration. The template contains two parameters: start
and end
.
url.template();
Note: this method does not provide public access to the URL template. Instead, the method returns the current URL generator instance.
Inserts start
and end
times into a template OpenTSDB query string. The start
and end
times are obtained from the bound client instance.
url.create();
// returns '...'
Note: Ensure that you have first generated a template before trying to create a URL.
The motivation for the template
/create
separation is the recognition that start
and end
times are more likely to change than other client
parameters, particularly when periodically polling OpenTSDB for data belonging to the same metric.
var createClient = require( 'opentsdb-client' ),
mQuery = require( 'opentsdb-mquery' ),
createFactory = require( 'opentsdb-url' ),
end = Date.now(),
start = end - 1000,
client,
query,
url;
// Create a new metric query and configure:
query = mQuery();
query.metric( 'cpu.utilization' )
.tags( 'beep', 'boop' );
// Create a new client and configure:
client = createClient();
client.queries( query );
// Bind the client to a URL generator:
url = createFactory( client );
// Create the url template:
url.template();
// Periodically create new URLs...
for ( var i = 0; i < 10; i++ ) {
setTimeout( createURL( i*1000 ), i*1000 );
}
function createURL( offset ) {
var begin = start + offset,
stop = end + offset;
return function onTimeout() {
client.start( begin )
.end( stop );
console.log( url.create() );
};
}
To run the example code from the top-level application directory,
$ 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:
$ 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:
$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ make view-cov
Copyright © 2014. Athan Reines.
FAQs
OpenTSDB HTTP data request URL generator.
We found that opentsdb-url demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.