view

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 16 Imported by: 1 module, 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 view prints a factorymeter/v1 report for people: as text for a terminal, as Markdown for a job summary or a pull request, and as one HTML page with charts.

It reads the report and nothing else, so anything it shows can also be read out of the JSON. The page follows the line: the verdict, the seven stations side by side, agents next to people, then each station with its history, and last what the numbers stand on.

Index

Constants

View Source
const TrackerKeysNote = "" /* 322-byte string literal not displayed */

TrackerKeysNote says where the keys searched for come from.

Variables

View Source
var HealthRule = fmt.Sprintf("Each station gets the worst of three grades. Load: the share of the hours changes spend on the line that the station holds. %.0f%% or more is watch, %.0f%% or more is strained. Rework: the share of its items that failed or were sent back. %.0f%% or more is watch, %.0f%% or more is strained. Wait: a median wait that got worse than in the window before is watch. A number drawn from too few items is left out.",
	loadWatch*100, loadStrained*100, reworkWatch*100, reworkStrained*100)

HealthRule says in words how a station is graded. The page shows it next to the grades.

Functions

func CSP

func CSP() string

CSP is the content security policy of the page. It lets the page run its own style and its own script, each pinned by its hash, and nothing else: no request to any host, no frame, no form.

func Change

func Change(s *contract.Series) string

Change prints how a value moved: points for a share, percent for the rest.

func Duration added in v0.9.0

func Duration(hours float64) string

Duration prints hours as a person would say them: minutes, hours, days, weeks, months or years, whichever reads shortest.

func HTML

func HTML(w io.Writer, r *contract.Report, opt HTMLOptions) error

HTML writes the report as one page with its charts. The page carries its own style and script and loads nothing: it reads the same offline, from a file, and from "factorymeter serve".

func LightsOut added in v0.4.0

func LightsOut(r *contract.Report) string

LightsOut is the link to the Lights Out simulator, filled in with the numbers of a report. It is empty when the report has none of them.

The numbers ride after the "#". A browser never sends that part of an address to a server, so opening the link shares nothing. The simulator reads them, fills in its form, and takes them out of the address bar. A number the report does not have is left out, and the simulator keeps its own default for it.

func Markdown

func Markdown(w io.Writer, r *contract.Report) error

Markdown prints the report as GitHub-flavoured Markdown.

func Number

func Number(unit string, v *float64) string

Number prints a value in its unit, short enough for a table cell.

func ServedCSP added in v0.8.0

func ServedCSP() string

ServedCSP is the policy of the page serve shows. Its repository menu is a form that asks the same server for the page again, so a form may go there.

func Spark

func Spark(s *contract.Series) string

Spark draws the history of a series, one character per period. A period with nothing counted is a dot.

func Text

func Text(w io.Writer, r *contract.Report) error

Text prints the report for a terminal.

func WriteDrill added in v0.9.0

func WriteDrill(w io.Writer, p *DrillPage) error

WriteDrill writes the page of one number's items. Only an http or https address of an item becomes a link.

Types

type DrillPage added in v0.9.0

type DrillPage struct {
	Name, Station, Target, Value, Period string
	// How says how the number comes from the rows below.
	How string
	// Others names observations no item can be shown for.
	Others, Definition string
	// Back is the address of the line, at the station of the number.
	Back                          string
	ItemHead, WhenHead, ValueHead string
	Rows                          []DrillRow
}

DrillPage lists the items one number of the line was drawn from.

type DrillRow added in v0.9.0

type DrillRow struct {
	Key, URL, Title, Who, When, Value string
	// Dim marks a row that is counted but is not a hit of a share.
	Dim bool
}

DrillRow is one item a number counted.

type Field added in v0.8.0

type Field struct{ Name, Value string }

Field is a name and value a form sends.

type HTMLOptions

type HTMLOptions struct {
	Nav *Nav
}

HTMLOptions sets what the page shows besides the report.

type Link struct {
	Label, URL string
	Current    bool
}

Link is one choice a served page offers: a window or a repository.

type Nav struct {
	Windows []Link
	// Repos is every repository of an owner, Current when it is in the line
	// shown. The menu is a form that asks for the ticked ones.
	Repos []Link
	// RepoLabel names what the line is made of: "All repositories", one
	// name, or "3 of 13 repositories".
	RepoLabel string
	// AllRepos is the address of the whole owner.
	AllRepos string
	// Keep are the other settings of the page, sent again with the form.
	Keep []Field
	// Drill is the address of the items behind a number, with the settings
	// of the page and without the metric. Empty: the page cannot drill.
	Drill string
	// From and Until are the dates of the window, for the date form, and
	// Repos the repositories the form sends again.
	From, Until string
	KeepRepos   []string
	// JSON is the link to the same report as factorymeter/v1 JSON.
	JSON string
}

Nav holds the links that only a served page has. A page written to a file has none: it shows one window and cannot ask for another.

Jump to

Keyboard shortcuts

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