languages / ruby / usage / metrics-and-timings

Ruby Usage - Metrics & Timings

Aggregates destroy details, events tell stories. With Timber, logging metrics and timings is simply logging an event. Timber is based on modern big-data principles and can aggregate inordinately large data sets in seconds. Logging events (raw data as it exists), gives you the flexibility in the future to segment and aggregate your data any way you see fit. This is superior to choosing specific paradigms before hand, when you are unsure how you'll need to use your data in the future.

How to use it

Below is a contrived example of timing a background job:

timer = Timber::Timer.start
# ... code to time ..."Processed background job", background_job: {time_ms: timer})

And of course, time_ms can also take a Float or Fixnum:

1"Processed background job", background_job: {time_ms: 45.6})

Lastly, metrics aren't limited to timings. You can capture any metric you want:

1"Credit card charged", credit_card_charge: {amount: 123.23})
  1. Search it with queries like: background_job.time_ms:>500
  2. Alert on it with threshold based alerts
  3. View this log's metadata in the console

Chat with us, just click the talk button in the bottom right of this page.

Chat with us
Sign Up

Log better and solve problems faster, today. Install in under a minute.

Sign Up