In addition to logs, you can have access to metrics to know how your application behaves. By default, system metrics like CPU and RAM use are available, as well as application-level metrics when available (apache or nginx status for instance).
You can also publish your own metrics if you want (via
For each application, there is a
Metrics tab in the console.
To get a quick overview of the current state of your scalers, the overview pane displays the current CPU, RAM, Disk and Network activity. On supported platforms, you can also have access to requests / second, and GC statistics.
Advanced metrics allow you to access all gathered metrics, on a specified time range.
You can expose custom metrics via
These metrics will be gathered and displayed in advanced view as well.
On some platforms, standard metrics published over
statsd are even integrated on the overview pane.
Metrics published over
statsd are prefixed with
To publish custom metrics, configure to use your client to push to
(it's the default host and port, so it should work with default settings as well).
You can use
node-statsd to publish metrics
// npm install node-statsd const StatsD = require('node-statsd'), client = new StatsD(); // Increment: Increments a stat by a value (default is 1) client.increment('my_counter'); // Gauge: Gauge a stat by a specified amount client.gauge('my_gauge', 123.45);
In Haskell, metrics are usually gathered with EKG.
ekg-statsd allows to push EKG metrics over
If you're using warp, you can use
wai-middleware-metrics to report request distributions (request count,
responses count aggregated by status code,
responses latency distribution).
EKG allows you to have access to GC metrics, make sure you compile your application
"-with-rtsopts=-T -N" to enable profiling.
-- you need the following packages -- ekg-core -- ekg-statsd -- scotty -- wai-middleware-metrics import Control.Monad (when) import Network.Wai.Metrics (WaiMetrics, metrics, registerWaiMetrics) import System.Metrics (newStore, registerGcMetrics) import System.Remote.Monitoring.Statsd (defaultStatsdOptions, forkStatsd) import Web.Scotty handleMetrics :: IO WaiMetrics handleMetrics = do store <- newStore registerGcMetrics store waiMetrics <- registerWaiMetrics store sendMetrics <- maybe False (== "true") <$> lookupEnv "ENABLE_METRICS" when sendMetrics $ do putStrLn "statsd reporting enabled" forkStatsd defaultStatsdOptions store return () return waiMetrics main = do waiMetrics <- handleMetrics scotty 8080 $ do middleware $ metrics waiMetrics get "/" $ html $ "Hello world"