observer

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Overview

Package observer provides clone monitoring.

Package observer provides clone monitoring.

Package observer provides clone monitoring.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildArtifactFilename added in v2.4.0

func BuildArtifactFilename(artifactType string) string

BuildArtifactFilename builds an artifact filename.

func InitConnection added in v2.4.0

func InitConnection(clone *models.Clone, socketDir string) (*pgx.Conn, error)

InitConnection creates a new connection to the clone database.

func IsAvailableArtifactType added in v2.4.0

func IsAvailableArtifactType(artifactType string) bool

IsAvailableArtifactType checks if artifact type is available.

Types

type Config

type Config struct {
	ReplacementRules map[string]string `yaml:"replacementRules"`
}

Config defines configuration options for observer.

type DBSize added in v2.4.0

type DBSize struct {
	Total       string      `json:"total"`
	Diff        string      `json:"diff"`
	ObjectsStat ObjectsStat `json:"objects_stat"`
}

DBSize represents summary statistics about database size.

type Duration added in v2.4.0

type Duration struct {
	Total            string    `json:"total"`
	StartedAt        time.Time `json:"started_at"`
	FinishedAt       time.Time `json:"finished_at"`
	MaxQueryDuration string    `json:"query_duration_longest"`
}

Duration represents summary statistics about session duration.

type Locks added in v2.4.0

type Locks struct {
	TotalInterval   int `json:"total_interval"`
	WarningInterval int `json:"warning_interval"`
}

Locks represents summary statistics about locks.

type LogErrors added in v2.4.0

type LogErrors struct {
	Count   int    `json:"count"`
	Message string `json:"message"`
}

LogErrors contains details about log errors statistics.

type ObjectsStat added in v2.4.0

type ObjectsStat struct {
	Count               int   `json:"count"`
	RowEstimateSum      int64 `json:"row_estimate_sum"`
	TotalSizeBytesSum   int64 `json:"total_size_bytes_sum"`
	TableSizeBytesSum   int64 `json:"table_size_bytes_sum"`
	IndexesSizeBytesSum int64 `json:"indexes_size_bytes_sum"`
	ToastSizeBytesSum   int64 `json:"toast_size_bytes_sum"`
}

ObjectsStat represents summary statistics about objects size.

type Observer

type Observer struct {
	Platform *platform.Client
	// contains filtered or unexported fields
}

Observer manages observation sessions.

func NewObserver

func NewObserver(dockerClient *client.Client, cfg *Config, platform *platform.Client, pm *pool.Manager) *Observer

NewObserver creates an Observer instance.

func (*Observer) AddObservingClone added in v2.4.0

func (o *Observer) AddObservingClone(cloneID string, port uint, session *ObservingClone)

AddObservingClone adds a new observing session to storage.

func (*Observer) GetCloneLog

func (o *Observer) GetCloneLog(ctx context.Context, port string, obsClone *ObservingClone) ([]byte, error)

GetCloneLog gets clone logs. TODO (akartasov): Split log to chunks.

func (*Observer) GetObservingClone added in v2.4.0

func (o *Observer) GetObservingClone(cloneID string) (*ObservingClone, error)

GetObservingClone returns an observation session from storage.

func (*Observer) RemoveObservingClone added in v2.4.0

func (o *Observer) RemoveObservingClone(cloneID string)

RemoveObservingClone removes an observing clone from storage.

type ObservingClone added in v2.4.0

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

ObservingClone describes an entity containing observability sessions.

func NewObservingClone added in v2.4.0

func NewObservingClone(config types.Config, sudb *pgx.Conn) *ObservingClone

NewObservingClone creates a new observing clone.

func (*ObservingClone) AddArtifact added in v2.4.0

func (c *ObservingClone) AddArtifact(sessionID uint64)

AddArtifact adds a new observation session to storage.

func (*ObservingClone) BuildArtifactPath added in v2.4.0

func (c *ObservingClone) BuildArtifactPath(sessionID uint64, artifactType string) string

BuildArtifactPath generates a full path to the artifact file.

func (*ObservingClone) CheckDuration added in v2.4.0

func (c *ObservingClone) CheckDuration() bool

CheckDuration checks duration of the operation.

func (*ObservingClone) CheckLocks added in v2.4.0

func (c *ObservingClone) CheckLocks() bool

CheckLocks checks long-lasting locks during the operation.

func (*ObservingClone) CheckOverallSuccess added in v2.4.0

func (c *ObservingClone) CheckOverallSuccess() bool

CheckOverallSuccess checks overall success of queries.

func (*ObservingClone) CheckPerformanceRequirements added in v2.4.0

func (c *ObservingClone) CheckPerformanceRequirements() error

CheckPerformanceRequirements checks monitoring data and returns an error if any of performance requires was not satisfied.

func (*ObservingClone) Config added in v2.4.0

func (c *ObservingClone) Config() types.Config

Config returns config of the observing clone.

func (*ObservingClone) CsvFields added in v2.4.0

func (c *ObservingClone) CsvFields() string

CsvFields returns a comma-separated list of available csv fields.

func (*ObservingClone) GetArtifactList added in v2.4.0

func (c *ObservingClone) GetArtifactList() []uint64

GetArtifactList returns available artifact session IDs for the requested clone.

func (*ObservingClone) Init added in v2.4.0

func (c *ObservingClone) Init(clone *models.Clone, sessionID uint64, startedAt time.Time, tags map[string]string) error

Init initializes observation session.

func (*ObservingClone) IsExistArtifacts added in v2.4.0

func (c *ObservingClone) IsExistArtifacts(sessionID uint64) bool

IsExistArtifacts checks if observation session artifacts exist.

func (*ObservingClone) ReadSummary added in v2.4.0

func (c *ObservingClone) ReadSummary(sessionID uint64) ([]byte, error)

ReadSummary reads summary file.

func (*ObservingClone) RunSession added in v2.4.0

func (c *ObservingClone) RunSession() error

RunSession runs observing session.

func (*ObservingClone) Session added in v2.4.0

func (c *ObservingClone) Session() *Session

Session returns the current observability session.

func (*ObservingClone) SetOverallError added in v2.4.0

func (c *ObservingClone) SetOverallError(overallErrors bool)

SetOverallError notes the presence of errors during the session.

func (*ObservingClone) Stop added in v2.4.0

func (c *ObservingClone) Stop() error

Stop stops an observation session.

type ReplacementRule

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

ReplacementRule describes replacement rules.

type Session

type Session struct {
	SessionID  uint64                    `json:"session_id"`
	StartedAt  time.Time                 `json:"started_at"`
	FinishedAt time.Time                 `json:"finished_at"`
	Config     types.Config              `json:"config"`
	Tags       map[string]string         `json:"tags"`
	Artifacts  []string                  `json:"artifacts,omitempty"`
	Result     *models.ObservationResult `json:"result,omitempty"`
	// contains filtered or unexported fields
}

Session describes a session of service monitoring.

func NewSession

func NewSession(sessionID uint64, startedAt time.Time, config types.Config, tags map[string]string) *Session

NewSession creates a new observing session.

func (Session) IsFinished added in v2.4.0

func (s Session) IsFinished() bool

IsFinished checks if the value FinishedAt is zero.

type State added in v2.4.0

type State struct {
	InitialDBSize    int64
	CurrentDBSize    int64
	MaxDBQueryTimeMS float64
	ObjectStat       ObjectsStat
	LogErrors        LogErrors
	OverallError     bool
}

State contains database state of the session.

type SummaryArtifact added in v2.4.0

type SummaryArtifact struct {
	SessionID     uint64    `json:"session_id"`
	CloneID       string    `json:"clone_id"`
	Duration      Duration  `json:"duration"`
	DBSize        DBSize    `json:"db_size"`
	Locks         Locks     `json:"locks"`
	LogErrors     LogErrors `json:"log_errors"`
	ArtifactTypes []string  `json:"artifact_types"`
}

SummaryArtifact represents session summary.

Jump to

Keyboard shortcuts

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