Last time in were exposing some metrics for a golang application, but exposing the data is useless without having a way to visualise it or even store it somewhere in a location so we can analyze it when needed.

A lot of times it’s useful to expose metrics for your application so you can know what is going on with the application, there are two ways you can do this one it’s either using a pull or a push mechanism.

Golang has a package called expvar that provides a standardized interface to public variables, such as operation counters in servers, and exports these variables via HTTP in a JSON format.

Given an array (list) of intervals as input where each interval has a start and end timestamps. Input array is sorted by starting timestamps. You are required to merge overlapping intervals and return output array (list).