Documentation
¶
Overview ¶
Package instruments is each metric that osapi records: its name, kind, unit, labels, the component that records it, and its doc. The code that makes an instrument takes its name and doc from here, and the docs site's metrics reference is written from All. Thus the two cannot differ.
Index ¶
Constants ¶
const ( KindCounter = "counter" KindGauge = "gauge" KindHistogram = "histogram" )
The kinds of an instrument, as Prometheus shows them.
const Namespace = "osapi"
Namespace is what the Prometheus exporter puts before each name, with an underscore. A Name does not have it.
Variables ¶
var ( ComponentUp = Instrument{ Name: "component_up", Kind: KindGauge, Component: "all", Doc: "Whether the component is ready (1) or not (0).", } SubsystemUp = Instrument{ Name: "subsystem_up", Kind: KindGauge, Component: "all", Labels: []string{"subsystem"}, Doc: "Whether a subsystem is healthy (1) or not (0).", } HeartbeatAge = Instrument{ Name: "heartbeat_age_seconds", Kind: KindGauge, Unit: "s", Component: "agent", Doc: "Seconds since last successful heartbeat write.", } JobsCreated = Instrument{ Name: "jobs_created_total", Kind: KindCounter, Component: "controller", Doc: "Total jobs submitted via API.", } JobsProcessed = Instrument{ Name: "jobs_processed_total", Kind: KindCounter, Component: "agent", Labels: []string{"status"}, Doc: "Total jobs processed.", } JobsActive = Instrument{ Name: "jobs_active", Kind: KindGauge, Component: "agent", Doc: "Currently executing jobs.", } JobDuration = Instrument{ Name: "job_duration_seconds", Kind: KindHistogram, Unit: "s", Component: "agent", Doc: "Job execution duration in seconds.", } BehaviorCalls = Instrument{ Name: "behavior_calls_total", Kind: KindCounter, Component: "agent", Labels: []string{ "osapi_behavior_name", "osapi_behavior_method", "osapi_behavior_verb", "osapi_behavior_outcome", }, Doc: "Behavior method calls, by behavior, method and outcome.", } BehaviorDuration = Instrument{ Name: "behavior_duration_seconds", Kind: KindHistogram, Unit: "s", Component: "agent", Labels: []string{"osapi_behavior_name", "osapi_behavior_method", "osapi_behavior_verb"}, Doc: "Behavior method duration in seconds.", } BehaviorChanges = Instrument{ Name: "behavior_changes_total", Kind: KindCounter, Component: "agent", Labels: []string{"osapi_behavior_name", "osapi_behavior_method", "osapi_behavior_verb"}, Doc: "Behavior writes that changed the host.", } )
The instruments, in the order the reference lists them.
Functions ¶
Types ¶
type Instrument ¶
type Instrument struct {
// Name is the instrument's name, without the namespace, such as
// jobs_created_total.
Name string
// Kind is counter, gauge or histogram.
Kind string
// Unit is the unit, such as s, or "".
Unit string
// Labels are the labels of each value, as Prometheus names them.
Labels []string
// Component is what records it: controller, agent, or all.
Component string
// Doc says what it counts or measures.
Doc string
}
Instrument is one metric.
func (Instrument) Exported ¶
func (i Instrument) Exported() string
Exported is the name that Prometheus shows: the namespace, then Name.