metrics

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package metrics provides functionality for processing Percona Pillar's metrics.

Index

Constants

View Source
const (

	// InstanceIDKey key name in telemetryFile with host instance ID.
	InstanceIDKey = "instanceId"
)

Variables

This section is empty.

Functions

func CleanupMetricsHistory

func CleanupMetricsHistory(historyDirectoryPath string, keepInterval int) error

CleanupMetricsHistory removes all telemetry files from history directory that are older than threshold. File creation time is taken from file name - it contains unixtime in format: <unixtime>-<random token>.json.

func WriteMetricsToHistory

func WriteMetricsToHistory(historyFile string, platformReport *platformReporter.ReportRequest) error

WriteMetricsToHistory creates a new telemetry history file and writes the content of Percona Platform telemetry request into it. Content is written using JSON format.

Types

type File

type File struct {
	Filename      string
	Timestamp     time.Time
	ProductFamily platformReporter.ProductFamily
	Metrics       map[string]string
}

File struct used for storing parsed Pillar's or host metrics. One object hold info about of metrics file.

func ProcessPGMetrics

func ProcessPGMetrics(path string) ([]*File, error)

ProcessPGMetrics processes PG metrics and returns slice of *File. Each File corresponds to a separate metrics file.

func ProcessPSMDBMetrics

func ProcessPSMDBMetrics(path string) ([]*File, error)

ProcessPSMDBMetrics processes PSMDB metrics and returns slice of *File. Each File corresponds to a separate metrics file.

func ProcessPSMetrics

func ProcessPSMetrics(path string) ([]*File, error)

ProcessPSMetrics processes PS metrics and returns slice of *File. Each File corresponds to a separate metrics file.

func ProcessPXCMetrics

func ProcessPXCMetrics(path string) ([]*File, error)

ProcessPXCMetrics processes PXC metrics and returns slice of *File. Each File corresponds to a separate metrics file.

func ScrapeHostMetrics

func ScrapeHostMetrics(ctx context.Context) *File

ScrapeHostMetrics gathers metrics about host where Telemetry Agent is running. In addition, it checks Percona telemetry file and extracts instanceId value from it.

type Package

type Package struct {
	Name       string            `json:"name"`
	Version    string            `json:"version"`
	Repository PackageRepository `json:"repository"`
}

Package represents a software package with its name and version.

func ScrapeInstalledPackages

func ScrapeInstalledPackages(ctx context.Context) []*Package

ScrapeInstalledPackages scrapes the installed packages on the host and returns a slice of Package structs along with any errors encountered. The function uses the localOS variable to determine the package manager to use.

type PackageRepository

type PackageRepository struct {
	Name      string `json:"name"`
	Component string `json:"component"`
}

PackageRepository represents a repository where a software package is located.

Jump to

Keyboard shortcuts

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