healthreporter

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const HealthReportAPIPathV2 = "v2/system/integrations/{{id}}/health-report"

Variables

This section is empty.

Functions

func PeriodicallySendHealthReport

func PeriodicallySendHealthReport(cfg *config.Application, ch intg.Channels, gatedReportInfo *GatedReportInfo)

func SetReportInfoNoBlocking

func SetReportInfoNoBlocking(accountName string, count int, reportInfo InventoryReportInfo, gatedReportInfo *GatedReportInfo)

Types

type AccountK8SInventoryReports

type AccountK8SInventoryReports map[string]InventoryReportInfo

AccountK8SInventoryReports holds per account information about latest inventory reports from the same batch set

func GetAccountReportInfoNoBlocking

func GetAccountReportInfoNoBlocking(gatedReportInfo *GatedReportInfo, cfg *config.Application, _now _Now) AccountK8SInventoryReports

type BatchInfo

type BatchInfo struct {
	BatchIndex    int             `json:"batch_index,omitempty"`    // Index of this inventory report batch item
	SendTimestamp jstime.Datetime `json:"send_timestamp,omitempty"` // Timestamp when the batch was sent, in UTC().Format(time.RFC3339)
	Error         string          `json:"error,omitempty"`          // Any error this batch encountered when sent
}

type GatedReportInfo

type GatedReportInfo struct {
	AccessGate              sync.RWMutex
	AccountInventoryReports AccountK8SInventoryReports
}

GatedReportInfo The go routine that generates the inventory report must inform the go routine that sends health reports about the *latest* sent inventory reports. A buffered channel is FIFO so the earliest inserted items are returned first. No new items can be added when the buffer is full. This means that the information about the latest sent health reports will have to be dropped in such situations. We would rather drop the information about the *oldest* sent health reports. We therefore use a map (key'ed by account) to store information about the latest sent inventory reports This map is shared by the go routine that generates inventory reports and the go routine that sends health reports. Access to the map is coordinated by a mutex.

func GetGatedReportInfo

func GetGatedReportInfo() *GatedReportInfo

type HealthData

type HealthData struct {
	Type    string             `json:"type,omitempty"`    // type of health data
	Version int                `json:"version,omitempty"` // format version
	Errors  HealthReportErrors `json:"errors,omitempty"`  // list of errors
	// Anything below this line is specific to k8s-inventory-agent
	AccountK8sInventoryReports AccountK8SInventoryReports `json:"account_k8s_inventory_reports,omitempty"` // latest inventory reports per account
}

type HealthReport

type HealthReport struct {
	UUID                 string           `json:"uuid,omitempty"`                   // uuid for this health report
	ProtocolVersion      int              `json:"protocol_version,omitempty"`       // protocol version for "common" part of health reporting
	Timestamp            jstime.Datetime  `json:"timestamp,omitempty"`              // timestamp for this health report in UTC().Format(time.RFC3339)
	Uptime               *jstime.Duration `json:"uptime,omitempty"`                 // running time of integration instance
	HealthReportInterval int              `json:"health_report_interval,omitempty"` // time in seconds between health reports
	HealthData           HealthData       `json:"health_data,omitempty"`            // K8s-inventory agent specific health data
}

type HealthReportErrors

type HealthReportErrors []string

type InventoryReportInfo

type InventoryReportInfo struct {
	ReportTimestamp     string      `json:"report_timestamp"`      // Timestamp for the inventory report that was batched
	Account             string      `json:"account_name"`          // Name of account to which the inventory report belongs
	SentAsUser          string      `json:"sent_as_user"`          // User that the inventory report was sent as
	BatchSize           int         `json:"batch_size"`            // Number of batches that the inventory report was sent in
	LastSuccessfulIndex int         `json:"last_successful_index"` // Index of last successfully sent batch, -1 if none
	HasErrors           bool        `json:"has_errors"`            // HasErrors is true if any of the batches had an error, false otherwise
	Batches             []BatchInfo `json:"batches"`               // Information about each inventory report batch
}

Jump to

Keyboard shortcuts

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