Last9 Golang CDK is a way to emit commonly aggregated metrics straight from your Golang application that serves HTTP traffic.

Why?

Traditional metrics emitters emit, per-path or handler-based metrics. Both these approaches have their drawbacks.

What metrics does CDK emit?

RED Metrics

The very first metrics to be emitted are Rate, Error, and Duration.

httpRequestsDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name: "http_requests_duration_milliseconds",
			Help: "HTTP requests duration per path",
		},
		[]string{
			"per", "hostname", "domain", "method", "program", "status",
			"tenant", "cluster",
		},
	)

Labels Explained

Name Description
hostname current Hostname where the metric is emitted from
program Binary / Process name where the metric is emitted from
per This is the "main" label, which contains the pathname or an identifier that you emit per request.
By default, it is the path pattern if the Mux is one of the supported List and the entire URL Path where Mux does not have a path parameter.
Optionally, this can ALSO be a custom string (Read below for details)
domain domain at which the request was received
method HTTP method
status HTTP Status returned
tenant Optional Field for a multi-tenant application
cluster Optional Field for a multi-cluster deployment

Say more about Tenancy

Most modern SaaS applications end up being multi-tenant or multi-clustered where it's crucial to identify the behavior across each, separately.

CDK honors this need as a first-class property and has reserved two label fields for this purpose. These two are:

Features