keymetrics / pm2-io-apm

PM2.io APM for Node.JS
Apache License 2.0
148 stars 40 forks source link

Metric API v2 #98

Closed vmarchaud closed 6 years ago

vmarchaud commented 6 years ago

@Unitech commented on Wed May 23 2018

var a = io.metric('mon_metric')
var b = io.histogram('mon_histogram')
var c = io.counter('mon_counter')
var d = io.meter('mon_meter')

a.set('value')

/// 2nd way

var e = io.metric({
  name: g_key,
  label: 'my/awesome/metric',
  unit: 'aws',                                                                                                                                                           
  value: function() {
    return gpu_stats[g_key];
   }
})

e.set('val')

// 3rd way (multi metric)

io.metrics([{
  name: g_key,                                                                                                                                                           
  value: function() {
    return gpu_stats[g_key];
   }
}, {
  name: g_key_2,                                                                                                                                                           
  value: function() {
    return gpu_stats[g_key_3];
   }
}])
vmarchaud commented 6 years ago

:+1:

wallet77 commented 6 years ago

Done : https://github.com/keymetrics/pm2-io-apm/pull/99 It will update readme on "documentation" branch !