metric_export

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2015 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJSONExport

func NewJSONExport() *jsonExport

func NewPrometheusExport

func NewPrometheusExport() *prometheusExport

Types

type MetricExporter

type MetricExporter interface {
	// Prepare should be used for initialization. It is guranteed to be called first, before any another methods.
	Prepare()

	// IncProbeCount increments the probe count of a given probe. It takes the probe name and epoch time (seconds) as args.
	IncProbeCount(string, int64)

	// IncErrorCount increments the error count of a given probe.  It takes the probe name and epoch time (seconds) as args.
	IncProbeErrorCount(string, int64)

	// IncTimeoutCount increments the timeout count of a given probe.  It takes the probe name and epoch time (seconds) as args.
	IncProbeTimeoutCount(string, int64)

	// SetFieldValues function sets the field values during normal times, e.g set the ‘up’ variable to 1 or 0.
	// It takes the probe name, probe response and epoch time (seconds) as args.
	SetFieldValues(string, *modules.ProbeData, int64)

	// SetFieldValuesUnexpected function sets field values during unexpected situations, e.g probe errors/timeouts. For instance
	// one might want to set the ‘up’ variable for a probe which timed out to -1 instead of a 0 or 1.
	// It takes the probe name and epoch time (seconds) as args.
	SetFieldValuesUnexpected(string, int64)

	//MetricHttpHandler returns the http handler to expose the metrics via a given path (e.g /metrics).
	MetricHttpHandler() http.Handler
}

MetricExporter interface is implemented by an exporter which wants to expose the probe metrics in its own format.

type ProbeCount

type ProbeCount struct {
	sync.RWMutex
	Count map[string]TimeValue `json:"probe_count"`
}

type ProbeErrorCount

type ProbeErrorCount struct {
	sync.RWMutex
	ErrorCount map[string]TimeValue `json:"probe_error_count"`
}

type ProbeIsUp

type ProbeIsUp struct {
	sync.RWMutex
	Up map[string]TimeValue `json:"probe_is_up"` // value of 1 is a success while 0 is a failure.
}

type ProbeLatency

type ProbeLatency struct {
	sync.RWMutex
	Latency map[string]TimeValue `json:"probe_latency"`
}

type ProbePayloadSize

type ProbePayloadSize struct {
	sync.RWMutex
	Payload map[string]TimeValue `json:"probe_payload_size"`
}

type ProbeTimeoutCount

type ProbeTimeoutCount struct {
	sync.RWMutex
	TimeoutCount map[string]TimeValue `json:"probe_timeout_count"`
}

type TimeValue added in v0.4.0

type TimeValue struct {
	Value float64 `json:"value"`
	Time  int64   `json:"time"`
}

Jump to

Keyboard shortcuts

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