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

variable-monitor

v0.1.4

Published

Package for logging object properties over time

Downloads

3

Readme

variable-monitor

Variable-Monitor is a library that allows to log objects properties over time. Variable Monitor exports the logged data in a standardized format, that makes it easy to have it visualized by other visualization libraries.

Installation

npm install variable-monitor

Usage

Logging Objects

import {Monitor} from 'react-monitor-dashboard';

var my_object={
  var1: 12,
  arr1: [1,2,3],
  arr2: [14,5,111]
};

var monitor1=new Monitor("monitor_my_object");
//add new logger for property "var1" of object "my_object", log data at every time step"
monitor1.add({name: "logger_variable_1", obj: my_object, prop: "var1", interval: 1});
//add new logger for property "arr1" of object "my_object", log data every 2 time steps"
monitor1.add({name: "logger_array_1", obj: my_object, prop: "arr1", interval: 2});
//add new logged for property "arr2" of object "my_object", log data every 100 time steps"
monitor1.add({name: "logger_array_2", obj: my_object, prop: "arr2", interval: 100}); 

for(var i=0;i<100;i++){
  my_object.var1=Math.random()*100;
  my_object.arr1.push(Math.random()*10);
  my_object.arr2.push(Math.random()*150);
  
  monitor1.tick(); //call the next time step, log data
}

Retrieving Logged Data

var dataset=monitor1.datset;

Returns an object of the type

{
  name: "monitor_name",
  type: "Dataset",
  data: [
    {
      name: "logged_arr_1",
      type: "Array",
      data: [
        {t:1, id:1, value:12},
        {t:1, id:2, value:166},
        ...
        ]
     },
     ...
     ]
}

Loggers

So far, variable-monitor is able to log only properties of the type "Number" as well as Arrays of numbers. More datatypes will be supported in the future.

TODO List

  • [ ] Variable Watcher that automatically detects when variable is changed and logs the new value
  • [ ] Save to Disk/Database
  • [ ] Logger for Graph data
  • [ ] Logger for