metrics

package
v0.0.0-...-6680cf1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Metrics data holding and manipulation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpMetricsReporter

type HttpMetricsReporter interface {
	// Reports the HTTP response status code along with the duration.
	HttpClientRequest(sysId string, name string, statusCode int, duration time.Duration)
}

type MetricsReporter

type MetricsReporter interface {
	// Registers application uptime metric
	Uptime()
	SystemMetricsReporter
	RoomMetricsReporter
	HttpMetricsReporter
}

func NewPrometheusReporter

func NewPrometheusReporter() MetricsReporter

type MetricsSession

type MetricsSession interface {
	// Reports metrics based on device data.
	Report(values *model.DataPollResponse, reporter MetricsReporter)
	// Resets all metrics.
	Reset(reporter MetricsReporter)
}

Metrics session data holder.

func NewSession

func NewSession(sysId string, reportConfiguration *config.ReportConfiguration) MetricsSession

Creates a new session to report metrics.

type PrometheusPublisher

type PrometheusPublisher interface {
	io.Closer
	// Starts to listen and serve.
	Start() error
	// Stops serving and listening.
	Stop(context context.Context) error
}

HTTP server

func NewPrometheusPublisher

func NewPrometheusPublisher(port int) PrometheusPublisher

Creates a new server with the given port

type RoomMetricsReporter

type RoomMetricsReporter interface {
	// Reports if the device connection is active or not.
	RoomConnected(sysId string, id string, room string, connected bool)
	// Reports the room temperature.
	RoomTemperature(sysId string, id string, room string, temperature float64)
	// Reports the room dew temperature.
	RoomDewTemperature(sysId string, id string, room string, temperature float64)
	// Reports the room target temperature.
	RoomTargetTemperature(sysId string, id string, room string, temperature float64)
	// Reports the relative humidity.
	RoomHumidity(sysId string, id string, room string, humidity float64)
	// Reports the relay state.
	RoomRelay(sysId string, id string, room string, connected bool)
	// Removes a room from reporting.
	RemoveRoom(sysId string, id string, room string)
}

type SystemMetricsReporter

type SystemMetricsReporter interface {
	// Reports if the device connection is active or not.
	Connected(sysId string, connected bool)
	// Reports the water temperature.
	WaterTemperature(sysId string, temperature float64)
	// Reports the external temperature.
	ExternalTemperature(sysId string, temperature float64)
	// Removes device from reporting.
	RemoveDevice(sysId string)
}

type Timer

type Timer interface {
	// Returns the duration since start.
	End() time.Duration
}

Helper struct to measure time spent.

func NewTimer

func NewTimer() Timer

Creates and starts a new timer.

Jump to

Keyboard shortcuts

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