node-clinic-doctor icon indicating copy to clipboard operation
node-clinic-doctor copied to clipboard

collect data for a production process?

Open ianstormtaylor opened this issue 4 years ago • 3 comments

Hello, Clinic is awesome!

I have a potentially related question. Is there a way to use the tools in Clinic to collect data in a production app on an ongoing basis?

My use case is that I'd like to add system/process monitoring info to logging events and traces. Right now it seems like to collect all of the CPU, event loop, memory, etc. data would require cobbling together a bunch of unrelated NPM packages that each specialize in one part, and aren't necessarily well documented as to their impact on a production service.

I think it would be awesome if Clinic extracted out the sampling logic is has and made it reusable for a production service. (Maybe this already exists?) I'm imaging something like:

// PSEUDOCODE!
import { Collector } from '@nearform/collector'

const collector = new Collector({ sampleInterval: 100 })

function somePlaceInMyProductionService() {
  sendTrace({
    ...myStuff,
    process: {
      cpu: collector.cpu,
      memory: collector.memory,
      // ...
    }
  })
}

This way I in production I'm able to access the same metrics as I use when debugging using the Clinic CLI tools. And I trust the data and that it doesn't have a high impact because I trust the Clinic team knows what they are doing, and I'm not having to cobble together weird other NPM packages.

My thought process is I'd like to get the same kinds of nice data that Heroku's "Metrics" dashboards provide out of the box, but in other monitoring tools like Honeycomb, etc. that I use daily.

Does this make sense? I'm not a monitoring pro so I might be making bad assumptions.

Thanks for reading!

ianstormtaylor avatar Nov 13 '19 02:11 ianstormtaylor