How to use the librato-node.measure function in librato-node

To help you get started, we’ve selected a few librato-node 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 ello / webapp / src / server / iso.js View on Github external
res.redirect(location)
            break
          case 'render':
            console.log(`[${requestId}][render] Rendering ISO response (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.success', 1)
            res.send(body)
            saveResponseToCache(cacheKey, body, postIds, postTokens, streamKind, streamId)
            break
          case 'error':
            console.log(`[${requestId}][render] Rendering error response (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.error', 1)
            res.status(500).end()
            break
          case '404':
            console.log(`[${requestId}][render] Rendering 404 response (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.404', 1)
            res.status(404).end()
            break
          default:
            console.log(`[${requestId}][render] Received unrecognized response (took ${new Date() - startTime}ms)`)
            console.log(JSON.stringify(result))
            librato.measure('webapp.server.render.error', 1)
            // Fall through
            res.status(500).end()
        }
        clearTimeout(renderTimeout)
      }
      const jobFailedCallback = (errorMessage) => {
github ello / webapp / src / server / iso.js View on Github external
saveResponseToCache(cacheKey, body, postIds, postTokens, streamKind, streamId)
            break
          case 'error':
            console.log(`[${requestId}][render] Rendering error response (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.error', 1)
            res.status(500).end()
            break
          case '404':
            console.log(`[${requestId}][render] Rendering 404 response (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.404', 1)
            res.status(404).end()
            break
          default:
            console.log(`[${requestId}][render] Received unrecognized response (took ${new Date() - startTime}ms)`)
            console.log(JSON.stringify(result))
            librato.measure('webapp.server.render.error', 1)
            // Fall through
            res.status(500).end()
        }
        clearTimeout(renderTimeout)
      }
      const jobFailedCallback = (errorMessage) => {
github ello / webapp / src / server / iso.js View on Github external
const jobFailedCallback = (errorMessage) => {
        libratoDone()
        console.log(`[${requestId}][render] Job failed (took ${new Date() - startTime}ms)`, JSON.stringify(errorMessage))
        res.send(indexStr)
        librato.measure('webapp.server.render.timeout', 1)
        clearTimeout(renderTimeout)
      }
github ello / webapp / src / server / iso.js View on Github external
const jobCompleteCallback = (result) => {
        libratoDone()
        const { type, location, body, postIds, postTokens, streamKind, streamId } = (result || {})
        switch (type) {
          case 'redirect':
            console.log(`[${requestId}][render] Redirecting to ${location} (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.redirect', 1)
            res.redirect(location)
            break
          case 'render':
            console.log(`[${requestId}][render] Rendering ISO response (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.success', 1)
            res.send(body)
            saveResponseToCache(cacheKey, body, postIds, postTokens, streamKind, streamId)
            break
          case 'error':
            console.log(`[${requestId}][render] Rendering error response (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.error', 1)
            res.status(500).end()
            break
          case '404':
            console.log(`[${requestId}][render] Rendering 404 response (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.404', 1)
github ello / webapp / src / server / entrypoint-queue.js View on Github external
const renderTimeout = setTimeout(() => {
      console.log(`[${requestId}] Render timed out after ${renderProcessTimeout}s; killing child process.`)
      librato.measure('webapp.server.render.timeout.child_process', 1)
      if (child) {
        child.kill('SIGKILL')
      }
      done(null)
    }, renderProcessTimeout * 1000)
github ello / webapp / src / server / iso.js View on Github external
const jobCompleteCallback = (result) => {
        libratoDone()
        const { type, location, body, postIds, postTokens, streamKind, streamId } = (result || {})
        switch (type) {
          case 'redirect':
            console.log(`[${requestId}][render] Redirecting to ${location} (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.redirect', 1)
            res.redirect(location)
            break
          case 'render':
            console.log(`[${requestId}][render] Rendering ISO response (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.success', 1)
            res.send(body)
            saveResponseToCache(cacheKey, body, postIds, postTokens, streamKind, streamId)
            break
          case 'error':
            console.log(`[${requestId}][render] Rendering error response (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.error', 1)
            res.status(500).end()
            break
          case '404':
            console.log(`[${requestId}][render] Rendering 404 response (took ${new Date() - startTime}ms)`)
            librato.measure('webapp.server.render.404', 1)
            res.status(404).end()
            break
          default:
            console.log(`[${requestId}][render] Received unrecognized response (took ${new Date() - startTime}ms)`)
            console.log(JSON.stringify(result))
github ello / webapp / src / server / entrypoint-queue.js View on Github external
queue.inactiveCount((err, total) => {
    if (!err) {
      librato.measure('kue.inactive.count', total)
    }
  })
  queue.activeCount((err, total) => {
github ello / webapp / src / server / entrypoint-queue.js View on Github external
queue.completeCount((err, total) => {
    if (!err) {
      librato.measure('kue.complete.count', total)
    }
  })
}, 30 * 1000);
github ello / webapp / src / server / entrypoint-queue.js View on Github external
queue.activeCount((err, total) => {
    if (!err) {
      librato.measure('kue.active.count', total)
    }
  })
  queue.failedCount((err, total) => {
github ello / webapp / src / server / entrypoint-queue.js View on Github external
queue.failedCount((err, total) => {
    if (!err) {
      librato.measure('kue.failed.count', total)
    }
  })
  queue.completeCount((err, total) => {

librato-node

A node.js client for Librato Metrics (http://metrics.librato.com/)

MIT
Latest version published 4 years ago

Package Health Score

46 / 100
Full package analysis