How to use the @nearform/clinic-common.getLoggingPaths function in @nearform/clinic-common

To help you get started, we’ve selected a few @nearform/clinic-common 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 nearform / node-clinic-bubbleprof / debug / inspect-dump.js View on Github external
'use strict'
const fs = require('fs')
const inspectpoint = require('inspectpoint')
const analysis = require('../analysis/index.js')
const getLoggingPaths = require('@nearform/clinic-common').getLoggingPaths('bubbleprof')
const SystemInfoDecoder = require('../format/system-info-decoder.js')
const StackTraceDecoder = require('../format/stack-trace-decoder.js')
const TraceEventDecoder = require('../format/trace-event-decoder.js')

// Load data
const paths = getLoggingPaths({ path: process.argv[2] })
const systemInfoReader = fs.createReadStream(paths['/systeminfo'])
  .pipe(new SystemInfoDecoder())
const stackTraceReader = fs.createReadStream(paths['/stacktrace'])
  .pipe(new StackTraceDecoder())
const traceEventReader = fs.createReadStream(paths['/traceevent'])
  .pipe(new TraceEventDecoder())

// Print data
analysis(systemInfoReader, stackTraceReader, traceEventReader)
  .pipe(inspectpoint({ depth: null, colors: true }))
github nearform / node-clinic-doctor / index.js View on Github external
'use strict'

const events = require('events')
const fs = require('fs')
const os = require('os')
const path = require('path')
const pump = require('pump')
const pumpify = require('pumpify')
const stream = require('./lib/destroyable-stream')
const { spawn } = require('child_process')
const Analysis = require('./analysis/index.js')
const Stringify = require('streaming-json-stringify')
const streamTemplate = require('stream-template')
const joinTrace = require('node-trace-log-join')
const getLoggingPaths = require('@nearform/clinic-common').getLoggingPaths('doctor')
const SystemInfoDecoder = require('./format/system-info-decoder.js')
const TraceEventDecoder = require('./format/trace-event-decoder.js')
const ProcessStatDecoder = require('./format/process-stat-decoder.js')
const RenderRecommendations = require('./recommendations/index.js')
const minifyStream = require('minify-stream')
const v8 = require('v8')
const HEAP_MAX = v8.getHeapStatistics().heap_size_limit
const buildJs = require('@nearform/clinic-common/scripts/build-js')
const buildCss = require('@nearform/clinic-common/scripts/build-css')
const mainTemplate = require('@nearform/clinic-common/templates/main')

class ClinicDoctor extends events.EventEmitter {
  constructor (settings = {}) {
    super()

    // define default parameters
github nearform / node-clinic-bubbleprof / injects / logger.js View on Github external
'use strict'

const fs = require('fs')
const makeDir = require('mkdirp')
const asyncHooks = require('async_hooks')
const stackTrace = require('../collect/stack-trace.js')
const systemInfo = require('../collect/system-info.js')
const StackTraceEncoder = require('../format/stack-trace-encoder.js')
const getLoggingPaths = require('@nearform/clinic-common').getLoggingPaths('bubbleprof')

// create dirname
const paths = getLoggingPaths({
  path: process.env.NODE_CLINIC_BUBBLEPROF_DATA_PATH,
  identifier: process.pid
})
makeDir.sync(paths['/'])

// write system file
fs.writeFileSync(paths['/systeminfo'], JSON.stringify(systemInfo(), null, 2))

// setup encoded states file
const encoder = new StackTraceEncoder()
const out = encoder.pipe(
  fs.createWriteStream(paths['/stacktrace'], {
    // Open log file synchronously to ensure that that .write() only
github nearform / node-clinic-doctor / index.js View on Github external
'use strict'

const events = require('events')
const fs = require('fs')
const os = require('os')
const path = require('path')
const pump = require('pump')
const pumpify = require('pumpify')
const stream = require('./lib/destroyable-stream')
const { spawn } = require('child_process')
const Analysis = require('./analysis/index.js')
const Stringify = require('streaming-json-stringify')
const streamTemplate = require('stream-template')
const joinTrace = require('node-trace-log-join')
const getLoggingPaths = require('@nearform/clinic-common').getLoggingPaths('doctor')
const SystemInfoDecoder = require('./format/system-info-decoder.js')
const TraceEventDecoder = require('./format/trace-event-decoder.js')
const ProcessStatDecoder = require('./format/process-stat-decoder.js')
const RenderRecommendations = require('./recommendations/index.js')
const minifyStream = require('minify-stream')
const v8 = require('v8')
const HEAP_MAX = v8.getHeapStatistics().heap_size_limit
const buildJs = require('@nearform/clinic-common/scripts/build-js')
const buildCss = require('@nearform/clinic-common/scripts/build-css')
const mainTemplate = require('@nearform/clinic-common/templates/main')

class ClinicDoctor extends events.EventEmitter {
  constructor (settings = {}) {
    super()

    // define default parameters
github nearform / node-clinic-doctor / injects / sampler.js View on Github external
'use strict'

const fs = require('fs')
const makeDir = require('mkdirp')
const systemInfo = require('../collect/system-info.js')
const ProcessStat = require('../collect/process-stat.js')
const getLoggingPaths = require('@nearform/clinic-common').getLoggingPaths('doctor')
const ProcessStatEncoder = require('../format/process-stat-encoder.js')

// create encoding files and directory
const paths = getLoggingPaths({ path: process.env.NODE_CLINIC_DOCTOR_DATA_PATH, identifier: process.pid })

makeDir.sync(paths['/'])

// write system file
fs.writeFileSync(paths['/systeminfo'], JSON.stringify(systemInfo(), null, 2))

const processStatEncoder = new ProcessStatEncoder()
const out = processStatEncoder.pipe(fs.createWriteStream(paths['/processstat']))

// sample every 10ms
const processStat = new ProcessStat(parseInt(
  process.env.NODE_CLINIC_DOCTOR_SAMPLE_INTERVAL, 10
github nearform / node-clinic-bubbleprof / debug / dprof-dump.js View on Github external
'use strict'
const fs = require('fs')
const analysis = require('../analysis/index.js')
const getLoggingPaths = require('@nearform/clinic-common').getLoggingPaths('bubbleprof')
const SystemInfoDecoder = require('../format/system-info-decoder.js')
const StackTraceDecoder = require('../format/stack-trace-decoder.js')
const TraceEventDecoder = require('../format/trace-event-decoder.js')
const ExtractAggregateNodes = require('./extract-aggregate-nodes.js')
const AggregateNodesToDprof = require('./aggregate-nodes-to-dprof.js')

// Load data
const paths = getLoggingPaths({ path: process.argv[2] })
const systemInfoReader = fs.createReadStream(paths['/systeminfo'])
  .pipe(new SystemInfoDecoder())
const stackTraceReader = fs.createReadStream(paths['/stacktrace'])
  .pipe(new StackTraceDecoder())
const traceEventReader = fs.createReadStream(paths['/traceevent'])
  .pipe(new TraceEventDecoder())

// Print dprof file
github nearform / node-clinic-doctor / test / collect-and-read.js View on Github external
'use strict'

const fs = require('fs')
const async = require('async')
const rimraf = require('rimraf')
const events = require('events')
const ClinicDoctor = require('../index.js')
const getLoggingPaths = require('@nearform/clinic-common').getLoggingPaths('doctor')
const SystemInfoDecoder = require('../format/system-info-decoder.js')
const TraceEventDecoder = require('../format/trace-event-decoder.js')
const ProcessStatDecoder = require('../format/process-stat-decoder.js')

class CollectAndRead extends events.EventEmitter {
  constructor (options, ...args) {
    super()
    const self = this
    const tool = this.tool = new ClinicDoctor(options)

    tool.collect([process.execPath, ...args], function (err, dirname) {
      self.files = getLoggingPaths({ path: dirname })
      if (err) return self.emit('error', err)

      self.noError = true
github nearform / node-clinic-bubbleprof / test / collect-and-read.js View on Github external
'use strict'

const fs = require('fs')
const http = require('http')
const path = require('path')
const async = require('async')
const rimraf = require('rimraf')
const events = require('events')
const endpoint = require('endpoint')
const xsock = require('cross-platform-sock')
const getLoggingPaths = require('@nearform/clinic-common').getLoggingPaths('bubbleprof')
const ClinicBubbleprof = require('../index.js')
const SystemInfoDecoder = require('../format/system-info-decoder.js')
const StackTraceDecoder = require('../format/stack-trace-decoder.js')
const TraceEventDecoder = require('../format/trace-event-decoder.js')

const sock = xsock(path.join(__dirname, 'test-server.sock'))

function waitForFile (filepath, timeout, callback) {
  if (process.platform === 'win32') return setTimeout(callback, timeout)

  fs.access(filepath, function (err) {
    if (!err) return callback(null)
    if (timeout <= 0) {
      return callback(new Error('server did not listen within timeout'))
    }
github nearform / node-clinic-flame / collect / get-logging-paths.js View on Github external
'use strict'

const common = require('@nearform/clinic-common')

module.exports = common.getLoggingPaths('flame', ['/samples', '/inlinedfunctions', '/0x-data/'])
github nearform / node-clinic-bubbleprof / index.js View on Github external
'use strict'

const events = require('events')
const fs = require('fs')
const os = require('os')
const path = require('path')
const pump = require('pump')
const { spawn } = require('child_process')
const analysis = require('./analysis/index.js')
const joinTrace = require('node-trace-log-join')
const getLoggingPaths = require('@nearform/clinic-common').getLoggingPaths('bubbleprof')
const SystemInfoDecoder = require('./format/system-info-decoder.js')
const StackTraceDecoder = require('./format/stack-trace-decoder.js')
const TraceEventDecoder = require('./format/trace-event-decoder.js')
const minifyInline = require('./lib/minify-inline')
const buildJs = require('@nearform/clinic-common/scripts/build-js')
const buildCss = require('@nearform/clinic-common/scripts/build-css')
const mainTemplate = require('@nearform/clinic-common/templates/main')

class ClinicBubbleprof extends events.EventEmitter {
  constructor (settings = {}) {
    super()

    const {
      detectPort = false,
      debug = false,
      dest = null

@nearform/clinic-common

Shared parts between the Clinic.js suite

MIT
Latest version published 4 years ago

Package Health Score

42 / 100
Full package analysis

Similar packages