record

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 3 Imported by: ? 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 record defines what factorymeter keeps about a line: tickets, changes, CI runs, deploys and the links between them.

A source adapter (GitHub, Linear, Jira) turns what it reads into these records and nothing else. Every metric is computed from records, so a new source needs no change to a metric and a new metric needs no change to a source.

Index

Constants

View Source
const (
	GitHub = "github"
	Linear = "linear"
	Jira   = "jira"
)

Sources.

View Source
const (
	KindTicket = "ticket"
	KindChange = "change"
	KindCIRun  = "ci_run"
	KindDeploy = "deploy"
	KindLink   = "link"
)

Record kinds. They match the names the metric registry uses.

View Source
const (
	ActorUser = "user"
	ActorBot  = "bot"
)

Actor kinds.

View Source
const (
	ChangeOpen   = "open"
	ChangeClosed = "closed"
	ChangeMerged = "merged"
)

Change states.

View Source
const (
	ReviewApproved         = "approved"
	ReviewChangesRequested = "changes_requested"
	ReviewCommented        = "commented"
	ReviewDismissed        = "dismissed"
)

Review states.

View Source
const (
	DeploySuccess = "success"
	DeployFailure = "failure"
	DeployRunning = "running"
	DeployUnknown = "unknown"
)

Deploy outcomes.

View Source
const (
	TicketBacklog   = "backlog"
	TicketUnstarted = "unstarted"
	TicketStarted   = "started"
	TicketDone      = "done"
	TicketCancelled = "cancelled"
)

Ticket states. Every source maps its own workflow onto these five.

View Source
const (
	// LinkCloses ties a change to the ticket it resolves.
	LinkCloses = "closes"
	// LinkMentions ties a change to a ticket it names without resolving it.
	LinkMentions = "mentions"
	// LinkReverts ties a change to the earlier change it reverts.
	LinkReverts = "reverts"
)

Link kinds.

View Source
const SchemaVersion = 1

SchemaVersion is the version of the record layout. The store writes it down and refuses to read a store with a newer one. A new field does not raise it: a file written before the field reads with the field empty. It goes up when a field goes away or comes to mean something else.

Variables

This section is empty.

Functions

func CIRunID

func CIRunID(source, repo string, run int64, attempt int) string

CIRunID builds the id of one attempt of a CI run.

func ChangeID

func ChangeID(source, repo string, number int) string

ChangeID builds the id of a change.

func DeployID

func DeployID(source, repo, via, name string) string

DeployID builds the id of a deploy. via is "deployment" or "release" and name is the deployment number or the release tag.

func SourceName

func SourceName(source string) string

SourceName is how a source is written for a reader.

func SourceOf

func SourceOf(id string) string

SourceOf reads the source back out of a record id.

func TicketID

func TicketID(source, key string) string

TicketID builds the id of a ticket from its key.

Types

type Actor

type Actor struct {
	Login string `json:"login" parquet:"login" doc:"The account name on the source. A GitHub bot keeps its [bot] suffix."`
	Kind  string `json:"kind" parquet:"kind" doc:"What the source says the account is." enum:"user,bot"`
}

Actor is an account on a source.

type CIRun

type CIRun struct {
	Source     string    `json:"source" parquet:"source" doc:"Where the record came from." enum:"github"`
	ID         string    `json:"id" parquet:"id" doc:"Stable id, unique among CI runs: source:owner/repo/run/attempt."`
	Repo       string    `json:"repo" parquet:"repo" doc:"The repository, as owner/name."`
	Workflow   string    `json:"workflow" parquet:"workflow" doc:"The name of the workflow."`
	Event      string    `json:"event" parquet:"event" doc:"What started the run, in the source's words, such as pull_request or push."`
	SHA        string    `json:"sha" parquet:"sha" doc:"The commit the run ran on. It ties the run to a change."`
	Branch     string    `` /* 154-byte string literal not displayed */
	Attempt    int       `json:"attempt" parquet:"attempt" doc:"1 for the first run, more for a run that was started again."`
	Status     string    `json:"status" parquet:"status" doc:"Whether the run has finished, in the source's words."`
	Conclusion string    `` /* 135-byte string literal not displayed */
	CreatedAt  time.Time `json:"created_at" parquet:"created_at,timestamp(microsecond)" doc:"When the run was created."`
	StartedAt  time.Time `json:"started_at" parquet:"started_at,timestamp(microsecond)" doc:"When this attempt started."`
	UpdatedAt  time.Time `` /* 139-byte string literal not displayed */
}

CIRun is one run of a CI workflow on one commit.

type Change

type Change struct {
	Source       string     `json:"source" parquet:"source" doc:"Where the record came from." enum:"github"`
	ID           string     `json:"id" parquet:"id" doc:"Stable id, unique among changes: source:owner/repo#number."`
	Repo         string     `json:"repo" parquet:"repo" doc:"The repository, as owner/name."`
	Number       int        `json:"number" parquet:"number" doc:"The number of the change in its repository."`
	URL          string     `json:"url" parquet:"url" doc:"Link to the change on the source."`
	Title        string     `json:"title" parquet:"title" doc:"The title."`
	Body         string     `json:"body" parquet:"body" doc:"The description. It is read for agent signatures and for ticket keys."`
	Author       Actor      `json:"author" parquet:"author" doc:"The account that opened the change."`
	HeadRef      string     `json:"head_ref" parquet:"head_ref" doc:"The branch the change comes from."`
	BaseRef      string     `json:"base_ref" parquet:"base_ref" doc:"The branch the change goes to."`
	State        string     `json:"state" parquet:"state" doc:"Where the change stands now." enum:"open,closed,merged"`
	Draft        bool       `json:"draft" parquet:"draft" doc:"True while the change is a draft."`
	CreatedAt    time.Time  `json:"created_at" parquet:"created_at,timestamp(microsecond)" doc:"When the change was opened."`
	UpdatedAt    time.Time  `` /* 137-byte string literal not displayed */
	ReadyAt      *time.Time `` /* 154-byte string literal not displayed */
	MergedAt     *time.Time `json:"merged_at" parquet:"merged_at,optional,timestamp(microsecond)" doc:"When the change merged. Null when it has not."`
	MergeSHA     string     `` /* 195-byte string literal not displayed */
	ClosedAt     *time.Time `` /* 136-byte string literal not displayed */
	Additions    int        `json:"additions" parquet:"additions" doc:"Lines added."`
	Deletions    int        `json:"deletions" parquet:"deletions" doc:"Lines deleted."`
	ChangedFiles int        `json:"changed_files" parquet:"changed_files" doc:"Files touched."`
	CommitCount  int        `` /* 141-byte string literal not displayed */
	Commits      []Commit   `json:"commits" parquet:"commits,list" doc:"The commits of the change, oldest first."`
	Reviews      []Review   `json:"reviews" parquet:"reviews,list" doc:"The submitted reviews, oldest first."`
}

Change is a pull request or a merge request.

type Commit

type Commit struct {
	SHA         string         `json:"sha" parquet:"sha" doc:"The commit id."`
	AuthoredAt  time.Time      `json:"authored_at" parquet:"authored_at,timestamp(microsecond)" doc:"When the commit was written."`
	CommittedAt time.Time      `json:"committed_at" parquet:"committed_at,timestamp(microsecond)" doc:"When the commit was last applied. A rebase moves it."`
	Parents     int            `json:"parents" parquet:"parents" doc:"How many parents the commit has. Two or more make it a merge commit."`
	Authors     []CommitAuthor `json:"authors" parquet:"authors,list" doc:"The author and every co-author."`
	Trailers    []Trailer      `json:"trailers" parquet:"trailers,list" doc:"The trailer lines of the commit message, such as Co-Authored-By."`
}

Commit is one commit of a change.

type CommitAuthor

type CommitAuthor struct {
	Login string `json:"login" parquet:"login" doc:"The account the source matched the author to. Empty when it matched none."`
	Email string `json:"email" parquet:"email" doc:"The email on the commit."`
	Name  string `json:"name" parquet:"name" doc:"The name on the commit."`
}

CommitAuthor is an author or a co-author of a commit.

type Deploy

type Deploy struct {
	Source      string     `json:"source" parquet:"source" doc:"Where the record came from." enum:"github"`
	ID          string     `` /* 131-byte string literal not displayed */
	Repo        string     `json:"repo" parquet:"repo" doc:"The repository, as owner/name."`
	Via         string     `json:"via" parquet:"via" doc:"What kind of event this is on the source." enum:"deployment,release"`
	Environment string     `json:"environment" parquet:"environment" doc:"The environment name. Empty for a release."`
	Production  bool       `json:"production" parquet:"production" doc:"True when the environment is production. A release always is."`
	Ref         string     `json:"ref" parquet:"ref" doc:"The branch or tag that was deployed."`
	SHA         string     `json:"sha" parquet:"sha" doc:"The commit that was deployed, when the source gives it."`
	CreatedAt   time.Time  `json:"created_at" parquet:"created_at,timestamp(microsecond)" doc:"When the deploy started."`
	FinishedAt  *time.Time `` /* 154-byte string literal not displayed */
	Outcome     string     `json:"outcome" parquet:"outcome" doc:"How the deploy ended." enum:"success,failure,running,unknown"`
}

Deploy is one deployment to an environment, or one published release.

type Link struct {
	Kind     string `json:"kind" parquet:"kind" doc:"What the link means." enum:"closes,mentions,reverts"`
	From     string `json:"from" parquet:"from" doc:"The id of the change the link starts at."`
	FromKind string `json:"from_kind" parquet:"from_kind" doc:"The kind of the record the link starts at." enum:"change"`
	To       string `json:"to" parquet:"to" doc:"The id of the record the link points at."`
	ToKind   string `json:"to_kind" parquet:"to_kind" doc:"The kind of the record the link points at." enum:"ticket,change"`
	Found    string `json:"found" parquet:"found" doc:"Where the link was read." enum:"source,body,title,branch"`
}

Link ties two records together.

type Review

type Review struct {
	Author      Actor     `json:"author" parquet:"author" doc:"The account that wrote the review."`
	State       string    `json:"state" parquet:"state" doc:"What the review said." enum:"approved,changes_requested,commented,dismissed"`
	SubmittedAt time.Time `json:"submitted_at" parquet:"submitted_at,timestamp(microsecond)" doc:"When the review was submitted."`
}

Review is one submitted review of a change.

type Ticket

type Ticket struct {
	Source    string     `json:"source" parquet:"source" doc:"Where the record came from." enum:"github,linear,jira"`
	ID        string     `` /* 333-byte string literal not displayed */
	Key       string     `json:"key" parquet:"key" doc:"The name people use for the ticket: owner/repo#12 on GitHub, ENG-123 on Linear or Jira."`
	Aliases   []string   `` /* 203-byte string literal not displayed */
	Project   string     `json:"project" parquet:"project" doc:"The repository, team or project the ticket belongs to."`
	URL       string     `json:"url" parquet:"url" doc:"Link to the ticket on the source."`
	Title     string     `json:"title" parquet:"title" doc:"The title."`
	Type      string     `` /* 130-byte string literal not displayed */
	Labels    []string   `json:"labels" parquet:"labels,list" doc:"The labels on the ticket."`
	Author    Actor      `json:"author" parquet:"author" doc:"The account that created the ticket."`
	State     string     `` /* 136-byte string literal not displayed */
	RawState  string     `json:"raw_state" parquet:"raw_state" doc:"The state in the source's own words."`
	CreatedAt time.Time  `json:"created_at" parquet:"created_at,timestamp(microsecond)" doc:"When the ticket was created."`
	UpdatedAt time.Time  `` /* 137-byte string literal not displayed */
	StartedAt *time.Time `` /* 185-byte string literal not displayed */
	DoneAt    *time.Time `` /* 131-byte string literal not displayed */
	ClosedAt  *time.Time `` /* 140-byte string literal not displayed */
	Reopened  int        `json:"reopened" parquet:"reopened" doc:"How many times the ticket went from done back to an open state."`
}

Ticket is an issue on GitHub, Linear or Jira.

type Trailer

type Trailer struct {
	Key   string `json:"key" parquet:"key" doc:"The trailer name, as written."`
	Value string `json:"value" parquet:"value" doc:"The trailer value."`
}

Trailer is one "Key: value" line at the end of a commit message.

Jump to

Keyboard shortcuts

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