instrumentation

package
v0.0.0-...-301923a Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2019 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The driver names that we accept
	DriverLogfile = "logfile"
	DriverElastic = "elastic"
	DriverStdout  = "stdout"
)
View Source
const (
	// We'll only hold this many docs in memory (they're still written to logs ASAP)
	MonitorMaxDocsHeld = 50
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

Parent struct that handles writing to all child MonitorOutput(s)

func NewMonitor

func NewMonitor(outs ...MonitorOutput) (*Monitor, error)

Create and return a new Monitor

Kicks off child routine to write new log messages

func (*Monitor) Err

func (m *Monitor) Err(err error, msg string, opts ...Opt)

Log an error message

func (*Monitor) Log

func (m *Monitor) Log(msg string, opts ...Opt)

Write given doc to all output(s) Since this is intended for logging, no errors due to being unable to log should cause failures.

func (*Monitor) Start

func (m *Monitor) Start(settings *WebserverConfig) error

Kick off the sub routines that run int the Monitor

  • routines to write to log(s)
  • routine to reply to http requests

func (*Monitor) Stop

func (m *Monitor) Stop()

Pull down the Monitor & all outputs

func (*Monitor) Warn

func (m *Monitor) Warn(msg string, opts ...Opt)

Log a warning message

type MonitorOutput

type MonitorOutput interface {
	Log(*event)
	Close()
}

Represents somewhere to write stats / log documents to

func Connect

func Connect(settings *Settings) (MonitorOutput, error)

Return a connect function for the given settings, or err if it can't be found

type Opt

type Opt func(*event)

func InFunc

func InFunc(msg string) Opt

Set InFunc value

func IsCreate

func IsCreate() Opt

func IsDelete

func IsDelete() Opt

func IsFind

func IsFind() Opt

Record the kind of function call we're making

func IsPublish

func IsPublish() Opt

func IsPublished

func IsPublished() Opt

func IsUpdate

func IsUpdate() Opt

func KeyValues

func KeyValues(in map[string]interface{}) Opt

Set KeyValues - helpful for logging named variables to make log clearer

func Note

func Note(args ...interface{}) Opt

Set Note value

func TargetCollection

func TargetCollection() Opt

func TargetItem

func TargetItem() Opt

Set what kind of obj we're targeting (trying to find, create, delete etc)

func TargetLink() Opt

func TargetResource

func TargetResource() Opt

func TargetVersion

func TargetVersion() Opt

func Time

func Time(t int64) Opt

Set Time (time taken in nano seconds) value

type Settings

type Settings struct {
	// What will be used to write the log
	Driver string

	// What host / location the log should go to
	Location string

	// Where in the given location the log should go
	Target string
}

Settings for some form of logging output

type WebserverConfig

type WebserverConfig struct {
	Port           int
	EndpointHealth string
}

Config for monitor's webserver

Jump to

Keyboard shortcuts

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