mon

package
v1.0.1-0...-20e81f0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	base.Config
}

Config represents monitoring config

type Error

type Error struct {
	Message string
	URL     string
	Created time.Time
}

Error represents an error

type File

type File struct {
	URL      string
	Age      string
	Modified time.Time
	Size     int
}

File represents workflow file

type Request

type Request struct {
	UnprocessedDuration string

	ProcessedURL     string
	ProcessedRecency string

	ErrorRecency string

	ConfigURL  string
	TriggerURL string
	ErrorURL   string
	// contains filtered or unexported fields
}

Request represents monitoring request

func (*Request) Init

func (r *Request) Init() (err error)

Load initialises request

func (*Request) Validate

func (r *Request) Validate() (err error)

Validate check if request is valid

type Response

type Response struct {
	UnprocessedCount int
	MaxDelayInSec    int `json:",omitempty"`
	ProcessCount     int `json:",omitempty"`
	ProcessedBytes   int `json:",omitempty"`
	ErrorCount       int
	Rules            []*RuleInfo `json:",omitempty"`
	Errors           []*Error    `json:",omitempty"`
	Status           string
	Error            string `json:",omitempty"`
	// contains filtered or unexported fields
}

Response represents monitoring response

func NewResponse

func NewResponse() *Response

NewResponse create a response

func (*Response) AddError

func (r *Response) AddError(object storage.Object, message string)

func (*Response) AddProcessed

func (r *Response) AddProcessed(route *config.Rule, object storage.Object)

func (*Response) AddUnprocessed

func (r *Response) AddUnprocessed(now time.Time, route *config.Rule, file storage.Object)

type Routes

type Routes struct {
	Mirrors config.Ruleset
}

Ruleset represents route config

type RuleInfo

type RuleInfo struct {
	base.Info
	ProcessedCount   int
	MaxProcessedSize int
	MinProcessedSize int
	UnprocessedCount int     `json:",omitempty"`
	DelaySec         int     `json:",omitempty"`
	Unprocessed      []*File `json:",omitempty"`
}

RuleInfo represents workflow info with unprocessed files

func NewWorkflow

func NewWorkflow(info base.Info) *RuleInfo

NewWorkflow create a workflow

type Service

type Service interface {
	//Check checks un process file and mirror errors
	Check(context.Context, *Request) *Response
}

Service represents monitoring service

func New

func New(config *Config) Service

New creates monitoring service

func NewFromEnv

func NewFromEnv(envKey string) (Service, error)

NewFromEnv returns singleton service for env key

Jump to

Keyboard shortcuts

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