Help us shape the future of Go! Take the 2026 Go Developer Survey

org

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package org is unit/1: a project as an organisational unit (a team, a division, a company) that reports KPIs, people figures and items to the unit above, takes requests from it, and rolls up the units below it, which it reads over their `rig serve` with a token each.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(p *sdk.Plugin)

Types

type Child

type Child struct {
	URL         string `json:"url"`
	Token       string `json:"token"`
	Env         string `json:"env"`
	Fingerprint string `json:"fingerprint"`
	// Plugin is the name the child serves unit/1 under (default org).
	Plugin string `json:"plugin"`
}

type ChildRow

type ChildRow struct {
	Name         string    `json:"name"`
	Title        string    `json:"title"`
	Layer        int       `json:"layer"`
	Reachable    bool      `json:"reachable"`
	OK           int       `json:"ok"`
	Warn         int       `json:"warn"`
	Err          int       `json:"err"`
	High         int       `json:"high"`
	OpenRequests int       `json:"open_requests"`
	Updated      time.Time `json:"updated"`
	Error        string    `json:"error"`
}

type Config

type Config struct {
	Unit        string   `json:"unit"`
	Title       string   `json:"title"`
	Layer       int      `json:"layer"`
	Parent      string   `json:"parent"`
	Owner       string   `json:"owner"`
	Description string   `json:"description"`
	KPIs        []Metric `json:"kpis"`
	People      []Metric `json:"people"`
	Items       []Feed   `json:"items"`
	// Children are the units below, each a rig serve this unit reads with a token.
	Children map[string]Child `json:"children"`
	// Escalate is the lowest severity of a child's item that shows here too (default high).
	Escalate string `json:"escalate"`
	// Cache is how long a child's answer is kept (default 60s); a child that is down shows its last one.
	Cache string `json:"cache"`
	// Drill lists the roles that may read a child's own figures through this unit; a local caller always may.
	Drill []string `json:"drill"`
	// Expose is what the units above may read or run here, each item to the roles in its to.
	Expose []Exposure `json:"expose"`
}

Config is plugins.org in rig.yaml.

type Exposed added in v1.9.0

type Exposed struct {
	Unit        string   `json:"unit"`
	Name        string   `json:"name"`
	Title       string   `json:"title"`
	Kind        string   `json:"kind"`
	Widget      string   `json:"widget"`
	Refresh     string   `json:"refresh"`
	Description string   `json:"description"`
	Inputs      []Input  `json:"inputs"`
	Origin      string   `json:"origin"`
	From        string   `json:"from"`
	To          []string `json:"to"`
	Error       string   `json:"error"`
}

Exposed is a row of unit.exposed.

type Exposure added in v1.9.0

type Exposure struct {
	Name        string         `json:"name"`
	Title       string         `json:"title"`
	Description string         `json:"description"`
	Source      string         `json:"source"`
	Action      string         `json:"action"`
	From        string         `json:"from"`
	Args        map[string]any `json:"args"`
	Inputs      []Input        `json:"inputs"`
	Widget      string         `json:"widget"`
	Refresh     string         `json:"refresh"`
	// To are the roles that see it (default parent).
	To []string `json:"to"`
}

Exposure is something this unit offers the units above: a source to read, an action to run, or a child's exposure passed up (from: child/name).

type Feed

type Feed struct {
	Kind      string            `json:"kind"`
	Source    string            `json:"source"`
	Args      map[string]any    `json:"args"`
	Transform any               `json:"transform"`
	Map       map[string]string `json:"map"`
	Severity  string            `json:"severity"`
}

Feed turns rows of a local source (incidents, risks in the tracker) into items.

type Goal added in v1.11.0

type Goal struct {
	ID      string    `json:"id"`
	From    string    `json:"from"`
	To      string    `json:"to"`
	By      string    `json:"by"`
	Title   string    `json:"title"`
	KPI     string    `json:"kpi"`
	Target  string    `json:"target"`
	Due     string    `json:"due"`
	Note    string    `json:"note"`
	Status  string    `json:"status"`
	Value   float64   `json:"value"`
	Measure string    `json:"measure"`
	OnTrack string    `json:"on_track"`
	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`
}

Goal is a target a unit above set for this one, tracked against one of its KPIs when KPI names one.

type Info

type Info struct {
	Name        string `json:"name"`
	Title       string `json:"title"`
	Layer       int    `json:"layer"`
	Parent      string `json:"parent"`
	Owner       string `json:"owner"`
	Description string `json:"description"`
}

type Input added in v1.9.0

type Input struct {
	Name        string   `json:"name"`
	Title       string   `json:"title,omitempty"`
	Type        string   `json:"type,omitempty"`
	Description string   `json:"description,omitempty"`
	Required    bool     `json:"required,omitempty"`
	Options     []string `json:"options,omitempty"`
}

Input is an argument a caller may set; a plain string in rig.yaml is its name.

func (*Input) UnmarshalJSON added in v1.9.0

func (in *Input) UnmarshalJSON(b []byte) error

type Item

type Item struct {
	Unit     string    `json:"unit"`
	ID       string    `json:"id"`
	Kind     string    `json:"kind"`
	Title    string    `json:"title"`
	Severity string    `json:"severity"`
	Status   string    `json:"status"`
	Owner    string    `json:"owner"`
	Updated  time.Time `json:"updated"`
	Ref      string    `json:"ref"`
}

type KPI

type KPI struct {
	Unit    string    `json:"unit"`
	Name    string    `json:"name"`
	Title   string    `json:"title"`
	Value   float64   `json:"value"`
	Measure string    `json:"measure"`
	Target  string    `json:"target"`
	Status  string    `json:"status"`
	Updated time.Time `json:"updated"`
	Note    string    `json:"note"`
}

type Metric

type Metric struct {
	Name    string   `json:"name"`
	Title   string   `json:"title"`
	Measure string   `json:"measure"`
	Note    string   `json:"note"`
	Value   *float64 `json:"value"`
	// Source and Args name a local source (gitlab.scm.mrs, a metrics component with query:, ...);
	// Transform is a view transform (filter, group, ...); Since keeps rows whose Time field is newer.
	Source    string         `json:"source"`
	Args      map[string]any `json:"args"`
	Transform any            `json:"transform"`
	Time      string         `json:"time"`
	Since     string         `json:"since"`
	// From: children rolls up the children's figure named KPI (default this one's name).
	From string `json:"from"`
	KPI  string `json:"kpi"`
	// Reduce is count, sum, avg, min, max or last (default count over a source, sum over children).
	Reduce string  `json:"reduce"`
	Field  string  `json:"field"`
	Scale  float64 `json:"scale"`
	// OK and Warn are conditions such as ">= 99.5"; a value meeting neither is err.
	OK   string `json:"ok"`
	Warn string `json:"warn"`
}

Metric is one KPI or people figure: a fixed value, a reduction over a local source's rows, or a roll-up of the same figure across the children.

type Report added in v1.11.0

type Report struct {
	ID      string    `json:"id"`
	Unit    string    `json:"unit"`
	Kind    string    `json:"kind"`
	Title   string    `json:"title"`
	Period  string    `json:"period"`
	Body    string    `json:"body"`
	By      string    `json:"by"`
	Created time.Time `json:"created"`
}

Report is what a unit tells the one above: a weekly status, a release note, a retrospective.

type Request

type Request struct {
	ID      string    `json:"id"`
	From    string    `json:"from"`
	To      string    `json:"to"`
	By      string    `json:"by"`
	Title   string    `json:"title"`
	Body    string    `json:"body"`
	Status  string    `json:"status"`
	Answer  string    `json:"answer"`
	Due     string    `json:"due"`
	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`
}

Jump to

Keyboard shortcuts

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