postgres

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoIncident = "NO_INCIDENT"
)

Variables

This section is empty.

Functions

func ConvertFromPostgresSnapshots

func ConvertFromPostgresSnapshots(snapshots []*Snapshot) []*apiPb.SchedulerSnapshot

func ConvertFromPostgressStatRequests

func ConvertFromPostgressStatRequests(data []*StatRequest) []*apiPb.GetAgentInformationResponse_Statistic

Types

type CPUInfo

type CPUInfo struct {
	gorm.Model
	StatRequestID uint    `gorm:"column:statRequestId"`
	Load          float64 `gorm:"column:load"`
}

type DiskInfo

type DiskInfo struct {
	gorm.Model
	StatRequestID uint    `gorm:"column:statRequestId"`
	Name          string  `gorm:"column:name"`
	Total         uint64  `gorm:"column:total"`
	Free          uint64  `gorm:"column:free"`
	Used          uint64  `gorm:"column:used"`
	UsedPercent   float64 `gorm:"column:usedPercent"`
}

type GroupResult

type GroupResult struct {
	Name         string `gorm:"column:groupName"`
	Count        int64  `gorm:"column:count"`
	SuccessCount int64  `gorm:"column:successCount"`
	Latency      string `gorm:"column:latency"`
	MinTime      string `gorm:"column:minTime"`
	MaxTime      string `gorm:"column:maxTime"`
	LowTime      string `gorm:"column:lowTime"`
}

type Incident

type Incident struct {
	gorm.Model
	IncidentId string             `gorm:"column:incidentId"`
	Status     int32              `gorm:"column:status"`
	RuleId     string             `gorm:"column:ruleId"`
	StartTime  int64              `gorm:"column:startTime"`
	EndTime    int64              `gorm:"column:endTime"`
	Histories  []*IncidentHistory `gorm:"column:history"`
}

type IncidentHistory

type IncidentHistory struct {
	gorm.Model
	IncidentID uint  `gorm:"column:incidentId"`
	Status     int32 `gorm:"column:status"`
	Timestamp  int64 `gorm:"column:time"`
}

type MemoryInfo

type MemoryInfo struct {
	gorm.Model
	StatRequestID uint        `gorm:"column:statRequestId"`
	Mem           *MemoryMem  `gorm:"column:mem"`
	Swap          *MemorySwap `gorm:"column:swap"`
}

type MemoryMem

type MemoryMem struct {
	gorm.Model
	MemoryInfoID uint    `gorm:"column:memoryInfoId"`
	Total        uint64  `gorm:"column:total"`
	Used         uint64  `gorm:"column:used"`
	Free         uint64  `gorm:"column:free"`
	Shared       uint64  `gorm:"column:shared"`
	UsedPercent  float64 `gorm:"column:usedPercent"`
}

type MemorySwap

type MemorySwap struct {
	gorm.Model
	MemoryInfoID uint    `gorm:"column:memoryInfoId"`
	Total        uint64  `gorm:"column:total"`
	Used         uint64  `gorm:"column:used"`
	Free         uint64  `gorm:"column:free"`
	Shared       uint64  `gorm:"column:shared"`
	UsedPercent  float64 `gorm:"column:usedPercent"`
}

type NetInfo

type NetInfo struct {
	gorm.Model
	StatRequestID uint   `gorm:"column:statRequestId"`
	Name          string `gorm:"column:name"`
	BytesSent     uint64 `gorm:"column:bytesSent"`
	BytesRecv     uint64 `gorm:"column:bytesRecv"`
	PacketsSent   uint64 `gorm:"column:packetsSent"`
	PacketsRecv   uint64 `gorm:"column:packetsRecv"`
	ErrIn         uint64 `gorm:"column:errIn"`
	ErrOut        uint64 `gorm:"column:errOut"`
	DropIn        uint64 `gorm:"column:dropIn"`
	DropOut       uint64 `gorm:"column:dropOut"`
}

type Postgres

type Postgres struct {
	Db *gorm.DB
}

func (*Postgres) GetActiveIncidentByRuleId

func (p *Postgres) GetActiveIncidentByRuleId(ruleId string) (*apiPb.Incident, error)

func (*Postgres) GetCPUInfo

func (p *Postgres) GetCPUInfo(agentID string, pagination *apiPb.Pagination, filter *apiPb.TimeFilter) ([]*apiPb.GetAgentInformationResponse_Statistic, int32, error)

func (*Postgres) GetDiskInfo

func (p *Postgres) GetDiskInfo(agentID string, pagination *apiPb.Pagination, filter *apiPb.TimeFilter) ([]*apiPb.GetAgentInformationResponse_Statistic, int32, error)

func (*Postgres) GetIncidentById

func (p *Postgres) GetIncidentById(id string) (*apiPb.Incident, error)

func (*Postgres) GetIncidents

func (p *Postgres) GetIncidents(request *apiPb.GetIncidentsListRequest) ([]*apiPb.Incident, int64, error)

func (*Postgres) GetMemoryInfo

func (p *Postgres) GetMemoryInfo(agentID string, pagination *apiPb.Pagination, filter *apiPb.TimeFilter) ([]*apiPb.GetAgentInformationResponse_Statistic, int32, error)

func (*Postgres) GetNetInfo

func (p *Postgres) GetNetInfo(agentID string, pagination *apiPb.Pagination, filter *apiPb.TimeFilter) ([]*apiPb.GetAgentInformationResponse_Statistic, int32, error)

func (*Postgres) GetSnapshots

func (*Postgres) GetSnapshotsUptime

func (p *Postgres) GetSnapshotsUptime(request *apiPb.GetSchedulerUptimeRequest) (*apiPb.GetSchedulerUptimeResponse, error)

func (*Postgres) GetStatRequest

func (p *Postgres) GetStatRequest(agentID string, pagination *apiPb.Pagination, filter *apiPb.TimeFilter) ([]*apiPb.GetAgentInformationResponse_Statistic, int32, error)

func (*Postgres) GetTransactionByID

func (p *Postgres) GetTransactionByID(request *apiPb.GetTransactionByIdRequest) (*apiPb.TransactionInfo, []*apiPb.TransactionInfo, error)

func (*Postgres) GetTransactionChildren

func (p *Postgres) GetTransactionChildren(transactionId, passedString string) ([]*TransactionInfo, error)

passedString is used in order to prevent cycles

func (*Postgres) GetTransactionGroup

func (p *Postgres) GetTransactionGroup(request *apiPb.GetTransactionGroupRequest) (map[string]*apiPb.TransactionGroup, error)

func (*Postgres) GetTransactionInfo

func (p *Postgres) GetTransactionInfo(request *apiPb.GetTransactionsRequest) ([]*apiPb.TransactionInfo, int64, error)

func (*Postgres) InsertIncident

func (p *Postgres) InsertIncident(data *apiPb.Incident) error

func (*Postgres) InsertSnapshot

func (p *Postgres) InsertSnapshot(data *apiPb.SchedulerResponse) error

func (*Postgres) InsertStatRequest

func (p *Postgres) InsertStatRequest(data *apiPb.Metric) error

func (*Postgres) InsertTransactionInfo

func (p *Postgres) InsertTransactionInfo(data *apiPb.TransactionInfo) error

func (*Postgres) Migrate

func (p *Postgres) Migrate() error

func (*Postgres) UpdateIncidentStatus

func (p *Postgres) UpdateIncidentStatus(id string, status apiPb.IncidentStatus) (*apiPb.Incident, error)

type Snapshot

type Snapshot struct {
	gorm.Model
	SchedulerID   string `gorm:"column:schedulerId"`
	Code          int32  `gorm:"column:code"`
	Type          int32  `gorm:"column:type"`
	Error         string `gorm:"column:error"`
	MetaStartTime int64  `gorm:"column:metaStartTime"`
	MetaEndTime   int64  `gorm:"column:metaEndTime"`
	MetaValue     []byte `gorm:"column:metaValue"`
}

func ConvertToPostgresSnapshot

func ConvertToPostgresSnapshot(request *apiPb.SchedulerResponse) (*Snapshot, error)

type StatRequest

type StatRequest struct {
	gorm.Model
	AgentID    string `gorm:"column:agentID"`
	AgentName  string `gorm:"column:agentName"`
	CPUInfo    []*CPUInfo
	MemoryInfo *MemoryInfo `gorm:"column:memoryInfo"`
	DiskInfo   []*DiskInfo `gorm:"column:diskInfo"`
	NetInfo    []*NetInfo  `gorm:"column:netInfo"`
	Time       time.Time   `gorm:"column:time"`
}

Agent gorm description

func ConvertToPostgressStatRequest

func ConvertToPostgressStatRequest(request *apiPb.Metric) (*StatRequest, error)

type TransactionInfo

type TransactionInfo struct {
	gorm.Model
	TransactionId     string `gorm:"column:transactionId"`
	ApplicationId     string `gorm:"column:applicationId"`
	ParentId          string `gorm:"column:parentId"`
	MetaHost          string `gorm:"column:metaHost"`
	MetaPath          string `gorm:"column:metaPath"`
	MetaMethod        string `gorm:"column:metaMethod"`
	Name              string `gorm:"column:name"`
	StartTime         int64  `gorm:"column:startTime"`
	EndTime           int64  `gorm:"column:endTime"`
	TransactionStatus int32  `gorm:"column:transactionStatus"`
	TransactionType   int32  `gorm:"column:transactionType"`
	Error             string `gorm:"column:error"`
}

type UptimeResult

type UptimeResult struct {
	Count   int64  `gorm:"column:count"`
	Latency string `gorm:"column:latency"`
}

Jump to

Keyboard shortcuts

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