Documentation
¶
Overview ¶
Package usagemetrics provides logging utility for the operational status of platform agents.
Index ¶
- Constants
- Variables
- func Action(id int)
- func Configured()
- func Error(id int)
- func Installed()
- func LogActionDaily(id int)
- func LogRunningDaily()
- func Misconfigured()
- func ParseStatus(status string) usagemetrics.Status
- func Running()
- func SetProperties(agentName, agentVersion string, logUsageMetrics bool, cp *cpb.CloudProperties)
- func Started()
- func Stopped()
- func Uninstalled()
- func Updated(version string)
Constants ¶
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.
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.
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 ¶
var UsageLogger = usagemetrics.NewLogger(nil, nil, clockwork.NewRealClock(), []string{})
UsageLogger is the standard usage logger for the workload agent. We are not using the project exclusion list for the platform agents.
Functions ¶
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 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 Uninstalled ¶
func Uninstalled()
Uninstalled uses the standard Logger to log the UNINSTALLED status.
Types ¶
This section is empty.