models

package
v0.0.0-...-e416dcb Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB
View Source
var LiveOverview = &Overview{}

Functions

func ConnectDatabase

func ConnectDatabase()

Types

type ConsistencyOverview

type ConsistencyOverview struct {
	Consistent   int `json:"consistent"`
	Inconsistent int `json:"inconsistent"`
}

type CreateServiceInput

type CreateServiceInput struct {
	// Name specifies the name of service
	Name string `json:"name" binding:"required"`

	// Endpoint specifies the endpoint of service
	Endpoint string `json:"endpoint" binding:"required"`

	// UpCodes specifies the comma separated http codes that signify UP status
	UpCodes string `json:"upCodes" binding:"required"`

	// Tags specifies metadata for the service
	Metadata string `json:"metadata"`
}

type DBService

type DBService struct {
	// ID specifies the id of the service
	ID uint `json:"id" gorm:"primary_key"`
	// Name specifies the name of service
	Name string `json:"name"`
	// Endpoint specifies the endpoint of service
	Endpoint string `json:"endpoint"`
	// UpCodes specifies the comma separated http codes that signify UP status
	UpCodes string `json:"upCodes"`
	// Tags specifies metadata for the service
	Metadata string `json:"metadata"`
	// Status specifies the status of the endpoint (up/down)
	Status Status `json:"status"`
	// Metrics specifies json string of the last collected metrics
	Metrics string `json:"metrics"`
	// TimeSeriesMetrics json string of last few iteration metrics
	TimeSeriesMetrics string `json:"timeSeriesMetrics"`
}

func FormatDBSvcMetrics

func FormatDBSvcMetrics(dbSvc DBService, metrics Metrics) DBService

type LatencyOverview

type LatencyOverview struct {
	High int `json:"high"`
	Low  int `json:"low"`
}

type Metrics

type Metrics struct {
	//Timestamp
	Timestamp string `json:"timeStamp"`
	// DNSTime ...
	DNSTime float64 `json:"dnsTime"`
	// ConnectTime ...
	ConnectTime float64 `json:"connectTime"`
	// TLSTime ...
	TLSTime float64 `json:"tlsTime"`
	// TotalTime ...
	TotalTime float64 `json:"totalTime"`
}

Metrics represents a set of metrics

type Overview

type Overview struct {
	StatusOverview      StatusOverview      `json:"status"`
	LatencyOverview     LatencyOverview     `json:"latency"`
	ConsistencyOverview ConsistencyOverview `json:"consistency"`
}

type Service

type Service struct {
	// ID specifies the id of the service
	ID uint `json:"id" gorm:"primary_key"`
	// Name specifies the name of service
	Name string `json:"name"`
	// Endpoint specifies the endpoint of service
	Endpoint string `json:"endpoint"`
	// UpCodes specifies the comma separated http codes that signify UP status
	UpCodes string `json:"upCodes"`
	// Tags specifies metadata for the service
	Metadata string `json:"metadata"`
	// Status specifies the status of the endpoint (up/down)
	Status Status `json:"status"`
	// Metrics specifies the last collected metrics
	Metrics Metrics `json:"metrics"`
	// TimeSeriesMetrics for last few iteration metrics
	TimeSeriesMetrics []Metrics `json:"timeSeriesMetrics"`
}

func DBSvcToSvc

func DBSvcToSvc(dbSvc DBService) Service

type Status

type Status string
const (
	StatusDown Status = "DOWN"
	StatusUp   Status = "UP"
)

type StatusOverview

type StatusOverview struct {
	Up   int `json:"up"`
	Down int `json:"down"`
}

type UpdateServiceInput

type UpdateServiceInput struct {
	// Name specifies the name of service
	Name string `json:"name"`

	// Endpoint specifies the endpoint of service
	Endpoint string `json:"endpoint"`

	// UpCodes specifies the comma separated http codes that signify UP status
	UpCodes string `json:"upCodes"`

	// Tags specifies metadata for the service
	Metadata string `json:"metadata"`
}

Jump to

Keyboard shortcuts

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