org

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 18 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"`
}

Config is plugins.org in rig.yaml.

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