Documentation ¶
Overview ¶
Package usagemetrics provides logging utility for the operational status of Google Cloud Agents.
Index ¶
- type AgentProperties
- type CloudProperties
- type Logger
- func (l *Logger) Action(id int)
- func (l *Logger) Configured()
- func (l *Logger) DailyLogRunningStarted()
- func (l *Logger) Error(id int)
- func (l *Logger) Installed()
- func (l *Logger) IsDailyLogRunningStarted() bool
- func (l *Logger) LastCalled(s Status) time.Time
- func (l *Logger) LogStatus(s Status, v string)
- func (l *Logger) Misconfigured()
- func (l *Logger) Running()
- func (l *Logger) SetAgentProps(ap *AgentProperties)
- func (l *Logger) SetCloudProps(cp *CloudProperties)
- func (l *Logger) Started()
- func (l *Logger) Stopped()
- func (l *Logger) Uninstalled()
- func (l *Logger) Updated(version string)
- type Status
- type TimeSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentProperties ¶
type AgentProperties struct { Name string Version string LogUsageMetrics bool LogUsagePrefix string LogUsageOptional string // optional string to be added to the usage log: "UsageLogPrefix/AgentName/AgentVersion[/OptionalString]/Status" }
AgentProperties contains the properties of the agent used by UsageMetrics library.
type CloudProperties ¶
type CloudProperties struct { ProjectID string Zone string InstanceName string ProjectNumber string Image string InstanceID string }
CloudProperties contains the properties of the cloud instance used by UsageMetrics library.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
A Logger is used to report the status of the agent to an internal metadata server.
func NewLogger ¶
func NewLogger(agentProps *AgentProperties, cloudProps *CloudProperties, timeSource TimeSource, projectExclusions []string) *Logger
NewLogger creates a new Logger with an initialized hash map of Status to a last called timestamp.
func (*Logger) DailyLogRunningStarted ¶
func (l *Logger) DailyLogRunningStarted()
DailyLogRunningStarted logs the RUNNING status.
func (*Logger) IsDailyLogRunningStarted ¶
IsDailyLogRunningStarted returns true if DailyLogRunningStarted was previously called.
func (*Logger) LastCalled ¶
LastCalled returns the last time a status was called.
func (*Logger) Misconfigured ¶
func (l *Logger) Misconfigured()
Misconfigured logs the MISCONFIGURED status.
func (*Logger) SetAgentProps ¶
func (l *Logger) SetAgentProps(ap *AgentProperties)
SetAgentProps sets the agent properties
func (*Logger) SetCloudProps ¶
func (l *Logger) SetCloudProps(cp *CloudProperties)
SetCloudProps sets the cloud properties and ensures that dependent fields are kept in sync.
func (*Logger) Uninstalled ¶
func (l *Logger) Uninstalled()
Uninstalled logs the UNINSTALLED status.
type Status ¶
type Status string
Status enumerates the supported usage logging statuses.
const ( StatusRunning Status = "RUNNING" StatusStarted Status = "STARTED" StatusStopped Status = "STOPPED" StatusConfigured Status = "CONFIGURED" StatusMisconfigured Status = "MISCONFIGURED" StatusError Status = "ERROR" StatusInstalled Status = "INSTALLED" StatusUpdated Status = "UPDATED" StatusUninstalled Status = "UNINSTALLED" StatusAction Status = "ACTION" )
The following status values are supported.