How to use the heimdalljs.registerMonitor function in heimdalljs

To help you get started, we’ve selected a few heimdalljs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ember-cli / ember-cli / lib / models / addon.js View on Github external
const semver = require('semver');
const processModulesOnly = require('../broccoli/babel-process-modules-only');
const registryHasPreprocessor = require('../utilities/registry-has-preprocessor');

const BUILD_BABEL_OPTIONS_FOR_PREPROCESSORS = Symbol('BUILD_BABEL_OPTIONS_FOR_PREPROCESSORS');

if (!heimdall.hasMonitor('addon-tree-cache')) {
  heimdall.registerMonitor('addon-tree-cache', function AddonTreeCacheSchema() {
    this.hits = 0;
    this.misses = 0;
    this.adds = 0;
  });
}

if (!heimdall.hasMonitor('cache-key-for-tree')) {
  heimdall.registerMonitor('cache-key-for-tree', function CacheKeyForTreeSchema() {
    this.modifiedMethods = 0;
    this.treeForMethodsOverride = 0;
  });
}

let DEFAULT_TREE_FOR_METHODS = {
  app: 'treeForApp',
  src: 'treeForSrc',
  addon: 'treeForAddon',
  'addon-styles': 'treeForAddonStyles',
  'addon-templates': 'treeForAddonTemplates',
  'addon-test-support': 'treeForAddonTestSupport',
  public: 'treeForPublic',
  styles: 'treeForStyles',
  templates: 'treeForTemplates',
  'test-support': 'treeForTestSupport',
github stefanpenner / async-disk-cache / index.js View on Github external
const renameFile = RSVP.denodeify(fs.rename);
const chmod = RSVP.denodeify(fs.chmod);
const mkdirp = RSVP.denodeify(require('mkdirp'));
const rimraf = RSVP.denodeify(require('rimraf'));
const unlink = RSVP.denodeify(fs.unlink);
const os = require('os');
const debug = require('debug')('async-disk-cache');
const zlib = require('zlib');
const heimdall = require('heimdalljs');
const crypto = require('crypto');

const CacheEntry = require('./lib/cache-entry');
const Metric = require('./lib/metric');

if (!heimdall.hasMonitor('async-disk-cache')) {
  heimdall.registerMonitor('async-disk-cache', function AsyncDiskCacheSchema() {});
}

const username = require('username-sync')();
const tmpdir = path.join(os.tmpdir(), username);

/*
 * @private
 *
 * Defines a function on the given object at the given property name. Wraps
 * the function with metric recording for heimdalljs.
 *
 * @method defineFunction
 * @param Object obj the object on which to define the function
 * @param String name the name to use for the function
 * @param Function fn
 * @returns Void
github ember-cli / ember-cli / lib / models / addon.js View on Github external
const walkSync = require('walk-sync');
const ensurePosixPath = require('ensure-posix-path');
const defaultsDeep = require('ember-cli-lodash-subset').defaultsDeep;
const findAddonByName = require('../utilities/find-addon-by-name');
const heimdall = require('heimdalljs');
const calculateCacheKeyForTree = require('calculate-cache-key-for-tree');
const addonProcessTree = require('../utilities/addon-process-tree');
const emberCLIBabelConfigKey = require('../utilities/ember-cli-babel-config-key');
const semver = require('semver');
const processModulesOnly = require('../broccoli/babel-process-modules-only');
const registryHasPreprocessor = require('../utilities/registry-has-preprocessor');

const BUILD_BABEL_OPTIONS_FOR_PREPROCESSORS = Symbol('BUILD_BABEL_OPTIONS_FOR_PREPROCESSORS');

if (!heimdall.hasMonitor('addon-tree-cache')) {
  heimdall.registerMonitor('addon-tree-cache', function AddonTreeCacheSchema() {
    this.hits = 0;
    this.misses = 0;
    this.adds = 0;
  });
}

if (!heimdall.hasMonitor('cache-key-for-tree')) {
  heimdall.registerMonitor('cache-key-for-tree', function CacheKeyForTreeSchema() {
    this.modifiedMethods = 0;
    this.treeForMethodsOverride = 0;
  });
}

let DEFAULT_TREE_FOR_METHODS = {
  app: 'treeForApp',
  src: 'treeForSrc',

heimdalljs

Structured instrumentation library

MIT
Latest version published 6 years ago

Package Health Score

59 / 100
Full package analysis