usagemetrics

package
v0.0.0-...-4729a3b Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Package usagemetrics provides logging utility for the operational status of platform agents.

Index

Constants

View Source
const (
	StatusRunning       usagemetrics.Status = "RUNNING"
	StatusStarted       usagemetrics.Status = "STARTED"
	StatusStopped       usagemetrics.Status = "STOPPED"
	StatusConfigured    usagemetrics.Status = "CONFIGURED"
	StatusMisconfigured usagemetrics.Status = "MISCONFIGURED"
	StatusError         usagemetrics.Status = "ERROR"
	StatusInstalled     usagemetrics.Status = "INSTALLED"
	StatusUpdated       usagemetrics.Status = "UPDATED"
	StatusUninstalled   usagemetrics.Status = "UNINSTALLED"
	StatusAction        usagemetrics.Status = "ACTION"
)

The following status values are supported.

View Source
const (
	// GlobalUnknownError is the error id for unknown error.
	GlobalUnknownError = 0
	// GlobalConfigFileReadError is the error id for config file read failure.
	GlobalConfigFileReadError = 1
	// GlobalMalformedConfigFileError is the error id for malformed config file.
	GlobalMalformedConfigFileError = 2
)

Global error codes, the first 50 are reserved for the platform, each integration should start from 51.

View Source
const (
	// GlobalUnknownAction is the action id for unknown action.
	GlobalUnknownAction = 0
)

Global action codes, the first 50 are reserved for the platform, each integration should start from 51.

Variables

UsageLogger is the standard usage logger for the workload agent. We are not using the project exclusion list for the platform agents.

Functions

func Action

func Action(id int)

Action uses the standard Logger to log the ACTION status.

func Configured

func Configured()

Configured uses the standard Logger to log the CONFIGURED status.

func Error

func Error(id int)

Error uses the standard Logger to log the ERROR status. This status is reported at most once per day.

func Installed

func Installed()

Installed uses the standard Logger to log the INSTALLED status.

func LogActionDaily

func LogActionDaily(id int)

LogActionDaily uses the standard logger to log the ACTION once a day. Should be called exactly once for each ACTION code.

func LogRunningDaily

func LogRunningDaily()

LogRunningDaily log that the agent is running once a day.

func Misconfigured

func Misconfigured()

Misconfigured uses the standard Logger to log the MISCONFIGURED status.

func ParseStatus

func ParseStatus(status string) usagemetrics.Status

ParseStatus parses the status string to a Status enum.

func Running

func Running()

Running uses the standard Logger to log the RUNNING status. This status is reported at most once per day.

func SetProperties

func SetProperties(agentName, agentVersion string, logUsageMetrics bool, cp *cpb.CloudProperties)

SetProperties sets the configured agent properties on the standard Logger.

func Started

func Started()

Started uses the standard Logger to log the STARTED status.

func Stopped

func Stopped()

Stopped uses the standard Logger to log the STOPPED status.

func Uninstalled

func Uninstalled()

Uninstalled uses the standard Logger to log the UNINSTALLED status.

func Updated

func Updated(version string)

Updated uses the standard Logger to log the UPDATED status.

Types

This section is empty.

Jump to

Keyboard shortcuts

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