postmortems

package module
v0.0.0-...-dbd1c48 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

README

postmortems

GoDoc Go Report Card

Available at https://postmortems.app

This repo means to create a public repository of postmortems with annotated metadata and summaries of public postmortem documents. This repo takes the work in https://github.com/danluu/post-mortems and expands on it, trying to add categories, time data, and room for more in-depth analysis.

If you'd like to contribute, either edit a postmortem file in the data folder, or try to fix an issue.

If you want further process the postmortem metadata files locally, we have a folder with all the metadata in JSON format. Please let us know your findings.

Tool

$ go run ./tool
pm [options...]
Options:
-action     The action we should take.
-dir        The directory with Markdown files for to extract or parse. Defaults to ./data

Actions:
extract     Extract postmortems from the collection and create separate files.
generate    Generate JSON files from the postmortem Markdown files.
new         Create a new postmortem file.
validate    Validate the postmortem files in the directory.
serve       Serve the postmortem files in a small website.

Shoutouts

  • @dastergon for fixing a bunch of bugs, porting hacky Ruby code to Go, and implementing webserver!

If you would like to find postmortem templates from various companies, you can check at the postmortem-templates repository on Github.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Categories is a whitelist of valid categories that a postmortem can have.
	Categories = []string{
		"automation",
		"cascading-failure",
		"cloud",
		"config-change",
		"postmortem",
		"hardware",
		"security",
		"time",
		"undescriptive",
	}

	// Service defines the service this runs in on GCP.
	Service = "postmortems"

	// GCPProject defines the project this code runs in and should log to.
	GCPProject = "icco-cloud"
)

Functions

func CategoriesContain

func CategoriesContain(e string) bool

CategoriesContain takes a string and decides if it is in the category whitelist.

func DnskhWos

func DnskhWos() error

func ExtractPostmortems

func ExtractPostmortems(loc string, dir string) error

ExtractPostmortems reads the collection of postmortems and extracts each postmortem to a separate file.

func GenerateJSON

func GenerateJSON(d string) error

GenerateJSON outputs all content in JSON for parsing by our website.

func ToYaml

func ToYaml(pm *Postmortem) (string, error)

ToYaml transforms a postmortem into yaml for the frontmatter.

Types

type Postmortem

type Postmortem struct {
	UUID        string    `yaml:"uuid"`
	URL         string    `yaml:"url"`
	StartTime   time.Time `yaml:"start_time,omitempty"`
	EndTime     time.Time `yaml:"end_time,omitempty"`
	Categories  []string  `yaml:"categories"`
	Company     string    `yaml:"company"`
	Product     string    `yaml:"product"`
	Description string    `yaml:"-"`
}

Postmortem is a structural representation of a postmortem summary and its metadata.

func New

func New() *Postmortem

New generates a new postmortem with a fresh uuid.

func Parse

func Parse(f io.Reader) (*Postmortem, error)

Parse turns an io stream into a Postmortem type.

func ValidateDir

func ValidateDir(d string) ([]*Postmortem, error)

ValidateDir takes a directory path and validates every file in there.

func ValidateFile

func ValidateFile(filename string) (*Postmortem, error)

ValidateFile takes a file path and validates just that file.

func (*Postmortem) Save

func (pm *Postmortem) Save(dir string) error

Save takes the in-memory representation of the postmortem file and stores it in a file.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳