Documentation
¶
Overview ¶
Package kubismus makes it simple to embed a status page in your web service. Using D3 and Cubism, events are stored and then rendered on a dynamic display.
Index ¶
- Constants
- func Define(reading string, op Op, DisplayName string)
- func GetMetrics(name string, op Op) []float64
- func GetNotes() []note
- func HandleHTTP()
- func HttpRequestMetric(reading string, h http.Handler) http.Handler
- func HttpResponseMetric(reading string, h http.Handler) http.Handler
- func Metric(reading string, count int32, value float64)
- func Note(name, value string)
- func ReleaseMetrics(m []float64)
- func ReleaseNotes(n []note)
- func ServeHTTP(w http.ResponseWriter, r *http.Request)
- func Setup(title, image string)
- type Op
Constants ¶
const (
// DefaultPath is the default path on the URL to get to the Kubismus display.
DefaultPath = "/kubismus/"
)
Variables ¶
This section is empty.
Functions ¶
func Define ¶
Define defines a metric with a given operation and display name. This allows you to provide a different name for the count, average, or sum - and control which are displayed.
func GetMetrics ¶
GetMetrics returns a list of values for a metric.
func HandleHTTP ¶
func HandleHTTP()
HandleHTTP registers an HTTP handler for kubismus on the default path. It is still necessary to invoke http.Serve(), typically in a go statement.
func HttpRequestMetric ¶
HttpRequestMetric returns a handler that logs a metric for the incoming content length after invoking the handler h.
func HttpResponseMetric ¶
HttpResponseMetric returns a handler that logs a metric for the response content length after invoking the handler h
func Metric ¶
Metric records a count and total value for a given reading. count should be 1 unless you are providing summed data for multiple events as the value. For instance, you can send the total bytes read for 3 files at one time.
func ReleaseMetrics ¶
func ReleaseMetrics(m []float64)
ReleaseMetrics returns the slice of values to the leaky buffer, if possible. While not required, using it reduces work for the garbage collector.
func ReleaseNotes ¶
func ReleaseNotes(n []note)
ReleaseNotes returns the slice to the leaky buffer, if possible.