observerapp

package
v0.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrServerCreateFailure   errors.Msg = "failed to create server"
	ErrClientCreateFailure   errors.Msg = "failed to create client"
	ErrObserverCreateFailure errors.Msg = "failed to create observer"
)
View Source
const ConfigValidationError = youlessclient.ConfigValidationError

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App is the youless-observer application which runs an Observer that observes the YouLess device using a youless.Client. It also runs a server to expose health status, build info and metrics endpoints.

func New

func New(conf Config, log zerolog.Logger) (*App, error)

func (*App) Run

func (app *App) Run(ctx context.Context) error

Run the app by starting the internal observer and server.

func (*App) Shutdown

func (app *App) Shutdown(ctx context.Context) error

Shutdown the app by stopping the internal observer and server.

type Config

type Config struct {
	Level         zerolog.Level `env:"LOG_LEVEL" default:"debug"`
	WithTimestamp bool          `env:"LOG_TIMESTAMP" default:"true"`
	Server        server.Config `env:",include"`
	Telemetry     telemetry.Config
	Prometheus    server.PrometheusConfig `env:",include"`
	YouLess       youlessclient.Config    `env:"YOULESS,include"`

	Observer struct {
		youlessobserver.MeterReadingRegisterer
		youlessobserver.PhaseReadingRegisterer
	} `env:",include"`
}

Config is the configuration for App.

func (Config) Validate

func (c Config) Validate() error

Jump to

Keyboard shortcuts

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