npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

transac-redline

v0.2.3

Published

Centralized logging System to monitor business applications

Downloads

8

Readme

transac-redline

Build Status Dependency Status Coverage Status

NPM

transac-redline is a centralized logging system aimed at helping monitoring business applications.

It's a very pragmatic and simple system made of a restful HTTP server based on node.js and mongodb, a HTML single page application written with angularjs and clients (node.js, ruby, python, perl, ...).

Ruby, python, perl clients are not yet available, node's one is the NPM package called 'client-transac-redline'.

The node version is quite new, but the a previous version in ruby was in use for many years in very constraints production environments.

If you have to monitor results of many processes / batches (made in different languages) and you want to identify quickly their states, and in case of failure see why they failed, this tool is for you.

It's neither Nagios nor syslog, it's more business oriented, rather than system, it's a complementary tool for applications support teams.

Usage

npm install transac-redline

Setup params.js like this:

module.exports = {
  http:{
    port: 3002,
  },
  transac: {
    host: 'localhost',
    port: 27017,
    database: 'transacs',
  },
};

Write an express server to mount transac-redline on it:

var transac = require('transac-redline')
  , express = require('express')
  , connect = require('connect')
  , http = require('http')
  , app = express()
  , params = require('./params')
  , httpServer = http.createServer(app);

transac.start(params.transac, function(err, transacApp){
  httpServer.listen(params.http.port, function() {
    console.log("HTTP server listening on port: " + params.http.port);

    app.use(express.bodyParser());
    app.use(connect.logger('short'));
    app.use('/', transacApp);
  });
});

That's all your server is up. Point your brower on "http://localhost:3002/transacs/index.html" an transac again and again ... To initate transacs you need to use one the clients available (see NPM 'client-transac-redline').

All the code above is packaged in the 'server' directory of the distribution.

Concepts

A transac of course, is not a transaction, it's a set of messages associated with a name and a date.

A transac is uniquely defined by:

  • name: Name of the transac
  • valueDate: default to today, but can reference usually a past date. Useful when the processing date of a process is different from the reference date of elements processed.

A transac can be locked: it means system will refuse to execute a new transac with same couple (name, valueDate).

A transac is made of events: ('time', 'type', 'label', 'message'). type belongs to ['info', 'warning', 'error'].

A client can start, commit and abort a transac. All those actions only change transac's state which can be within ['ok', 'warning', 'error'].

A transac can imbricate other transacs on one level: a script is launched many times a day, to avoid to pollute our journal with the same transac's name, we can define just one transac made of all the transacs generated by the script. To do that just start your transac with nested option at true.

API

Server is made of 4 restful requests:

  • POST /transacs to register a transac

    • name: transac's name
    • valueDate: default to today
    • nested: will create a multi-transac, all new post with same valueDate and name will be nested in the same transacname: transac's name
    • valueDate: default to today
    • nested: default false, will create a multi-transac, all new post with same valueDate and name will be nested in the same transac
    • locked: default false, all new post with same valueDate and name will be rejected by client API
    • server: optional, client's server name
    • user: optional, client's user name
    • processId: optional, client's process ID
  • PUT /transacs/:id/events to add an event to transac.id

    • type: ['info', 'warning', 'error', 'commit', 'abort']
    • label
    • message
  • GET /transacs: return JSON list of transacs

  • mode: ['value || 'processing'] to select a query between valueDate and processingTime

  • startDate, endDate: dates range for query

  • GET /transacs/:id: return JSON definition of a transac (could be a simple or multi transac);

TODO

  • add other clients (python, ruby, perl, ...)
  • send emails on abort or error
  • integrate with Nagios