Documentation
¶
Index ¶
Constants ¶
const ( VMTypeStandard = "standard" VMTypeVmss = "vmss" NetworkPluginAzure = "azure" NetworkPluginKubenet = "kubenet" NetworkPluginNone = "none" NetworkPolicyAzure = "azure" NetworkPolicyCalico = "calico" NetworkPolicyNone = "none" LoadBalancerBasic = "basic" LoadBalancerStandard = "standard" VMSizeStandardDc2s = "Standard_DC2s" VMSizeStandardDc4s = "Standard_DC4s" DefaultLinuxUser = "azureuser" DefaultCloudName = "AzurePublicCloud" AzureChinaCloud = "AzureChinaCloud" AzureGermanCloud = "AzureGermanCloud" AzureUSGovernmentCloud = "AzureUSGovernmentCloud" AksCustomCloudName = "akscustom" AzureStackCloud = "AzureStackCloud" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventLevel ¶
type EventLevel string
EventLevel represents the severity level of a guest agent event.
const ( // EventLevelInformational indicates a successful operation or informational message. EventLevelInformational EventLevel = "Informational" // EventLevelError indicates a failure or error condition. EventLevelError EventLevel = "Error" )
type EventLogger ¶
type EventLogger struct {
Dir string
}
EventLogger writes guest agent events to a directory.
func NewEventLogger ¶
func NewEventLogger(dir string) *EventLogger
NewEventLogger creates an EventLogger that writes to the specified directory.
func (*EventLogger) Events ¶
func (l *EventLogger) Events() []GuestAgentEvent
Events reads all guest agent event files from the directory. Events are returned in filename order (which corresponds to creation time since filenames are nanosecond timestamps). This method is primarily useful for testing.
func (*EventLogger) LogEvent ¶
func (l *EventLogger) LogEvent(taskName, message string, eventLevel EventLevel, startTime, endTime time.Time)
LogEvent creates an event file for the Azure VM guest agent.
The implementation follows the established bash pattern used across the codebase for event contents, with one intentional divergence in the filename scheme:
- Filename: Uses current time in nanoseconds to ensure uniqueness. Most bash event emitters use millisecond-based filenames (e.g., `date +%s%3N`); this implementation uses nanoseconds for greater collision resistance.
- Timestamp: Event start time in format "2006-01-02 15:04:05.000"
- OperationId: Event end time in format "2006-01-02 15:04:05.000"
- Message: Includes timing information (startTime, endTime, durationMs)
type GuestAgentEvent ¶
type GuestAgentEvent struct {
Timestamp string `json:"Timestamp"`
OperationId string `json:"OperationId"`
Version string `json:"Version"`
TaskName string `json:"TaskName"`
EventLevel string `json:"EventLevel"`
Message string `json:"Message"`
EventPid string `json:"EventPid"`
EventTid string `json:"EventTid"`
}
GuestAgentEvent represents an event to be logged for the Azure VM guest agent.