instruments

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	KindCounter   = "counter"
	KindGauge     = "gauge"
	KindHistogram = "histogram"
)

The kinds of an instrument, as Prometheus shows them.

View Source
const Namespace = "osapi"

Namespace is what the Prometheus exporter puts before each name, with an underscore. A Name does not have it.

Variables

View Source
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

func Table

func Table() string

Table is each instrument as a row of a markdown table, for the metrics reference of the docs site: the name that Prometheus shows, the kind, the labels, the component and the doc.

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 All

func All() []Instrument

All are the instruments that osapi records.

func (Instrument) Exported

func (i Instrument) Exported() string

Exported is the name that Prometheus shows: the namespace, then Name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL