minimal

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Show cluster and its nodes config, one line per node
	ShowConfigCluster = show.Cluster(
		showConfigCluster,
		showConfigNode,
		func(c types.Cluster) ([]types.Node, []types.Node) { return c.Writer, c.Reader },
	)

	// Show all instances in region and its configuration
	ShowConfigRegion = show.Prefix[types.Region](
		fmt.Sprintf("%2s %-17s %-6s %-15s %3s %7s %8s %-6s %-2s %s\n", "AZ", "ENGINE", "VSN", "INSTANCE", "CPU", "MEM", "STORAGE", "TYPE", "RO", "NAME"),
	).FMap(
		show.Region[types.Region](
			ShowConfigCluster,
			showConfigNode,
			func(sr types.Region) ([]types.Cluster, []types.Node) { return sr.Clusters, sr.Nodes },
		),
	)
)
View Source
var (
	// show a symbol (NONE, PASS, WARN, FAIL) before label
	ShowHealthSymbol = show.FromShow[types.StatusCode](
		func(code types.StatusCode) ([]byte, error) {
			text := show.StatusIcon(code)
			return []byte(text), nil
		},
	)

	// Show health status of node and all failed rules
	// STATUS       % UNIT           MIN            AVG            MAX	 ID CHECK
	// FAILED   5.55% iops          0.56          11.53          44.80	 D3: storage i/o latency
	// WARNED  96.19%  tps          4.17           4.49           5.37	 P4: db transactions (xact_commit)
	// FAILED 100.00%    %          1.99           0.18           0.06	 P5: sql efficiency
	//
	// ❌ FAIL example-database
	//
	ShowHealthNode = show.Printer2[types.StatusNode, []types.Status, types.StatusNode]{
		A: show.Prefix[[]types.Status](
			fmt.Sprintf("%6s %7s %4s %14s %14s %14s\t%3s %s\n", "STATUS", "%", "UNIT", "MIN", "AVG", "MAX", "ID", "CHECK"),
		).FMap(show.Seq[types.Status]{T: showHealthRule}),
		B: showHealthNodeWithSymbol,
		UnApply2: func(sn types.StatusNode) ([]types.Status, types.StatusNode) {
			return sn.Checks, sn
		},
	}

	// Show health of cluster and its nodes, one line per node
	ShowHealthCluster = show.Cluster(
		showHealthCluster,
		show.Prefix[types.StatusNode]("     ").FMap(showHealthNode),
		func(sc types.StatusCluster) ([]types.StatusNode, []types.StatusNode) { return sc.Writer, sc.Reader },
	)

	// Show health of region and its objects
	ShowHealthRegion = show.Printer2[types.StatusRegion, types.StatusRegion, types.StatusRegion]{
		A: showHealthRegionMembers,
		B: showHealthRegion,
		UnApply2: func(sr types.StatusRegion) (types.StatusRegion, types.StatusRegion) {
			return sr, sr
		},
	}

	// Show enhanced health of region and its objects
	ShowHealthRegionWithRules = show.Printer2[types.StatusRegion, types.StatusRegion, types.StatusRegion]{
		A: showHealthRegionMembersWithRules,
		B: showHealthRegion,
		UnApply2: func(sr types.StatusRegion) (types.StatusRegion, types.StatusRegion) {
			return sr, sr
		},
	}
)
View Source
var (

	// Show stats about node
	ShowValueNode = show.Prefix[types.StatusNode](
		fmt.Sprintf("%s %14s %14s %14s\n", "UNIT", "MIN", "AVG", "MAX"),
	).FMap(
		show.Printer2[types.StatusNode, []types.Status, types.StatusNode]{
			A:        show.Seq[types.Status]{T: showValueRule},
			B:        showInfoNode,
			UnApply2: func(sn types.StatusNode) ([]types.Status, types.StatusNode) { return sn.Checks, sn },
		},
	)
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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