diagnostics

package
v0.0.0-...-2f6135f Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package diagnostics provides the diagnostics type so that other packages can provide diagnostics without depending on the monitor package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Diagnostics() (*Diagnostics, error)
}

Client is the interface modules implement if they register diagnostics with monitor.

type ClientFunc

type ClientFunc func() (*Diagnostics, error)

The ClientFunc type is an adapter to allow the use of ordinary functions as Diagnostics clients.

func (ClientFunc) Diagnostics

func (f ClientFunc) Diagnostics() (*Diagnostics, error)

Diagnostics calls f().

type Diagnostics

type Diagnostics struct {
	Columns []string
	Rows    [][]interface{}
}

Diagnostics represents a table of diagnostic information. The first value is the name of the columns, the second is a slice of interface slices containing the values for each column, by row. This information is never written to an InfluxDB system and is display-only. An example showing, say, connections follows:

source_ip    source_port       dest_ip     dest_port
182.1.0.2    2890              127.0.0.1   38901
174.33.1.2   2924              127.0.0.1   38902

func NewDiagnostics

func NewDiagnostics(columns []string) *Diagnostics

NewDiagnostic initialises a new Diagnostics with the specified columns.

func RowFromMap

func RowFromMap(m map[string]interface{}) *Diagnostics

RowFromMap returns a new one-row Diagnostics from a map.

func (*Diagnostics) AddRow

func (d *Diagnostics) AddRow(r []interface{})

AddRow appends the provided row to the Diagnostics' rows.

Jump to

Keyboard shortcuts

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