Documentation
¶
Overview ¶
Package model provides domain models for the opampcommander application.
Index ¶
- Constants
- Variables
- func ConvertConnIDToString(id any) string
- type Agent
- func (a *Agent) ApplyConnectionSettings(opamp *AgentOpAMPConnectionSettings, ...) error
- func (a *Agent) ApplyRemoteConfig(agentRemoteConfigName string, agentConfigFile AgentConfigFile) error
- func (a *Agent) ConnectedServerID() (string, error)
- func (a *Agent) GetCondition(conditionType AgentConditionType) *AgentCondition
- func (a *Agent) HasInstanceUID() bool
- func (a *Agent) HasNewInstanceUID() bool
- func (a *Agent) HasNewPackages() bool
- func (a *Agent) HasPendingServerMessages() bool
- func (a *Agent) HasRemoteConfig() bool
- func (a *Agent) IsConditionTrue(conditionType AgentConditionType) bool
- func (a *Agent) IsConnected(_ context.Context) bool
- func (a *Agent) IsOpAMPConnectionSettingsSupported() bool
- func (a *Agent) IsOtherConnectionSettingsSupported() bool
- func (a *Agent) IsOwnLogsSupported() bool
- func (a *Agent) IsOwnMetricsSupported() bool
- func (a *Agent) IsOwnTracesSupported() bool
- func (a *Agent) IsRemoteConfigSupported() bool
- func (a *Agent) IsRestartSupported() bool
- func (a *Agent) MarkConnected(triggeredBy string)
- func (a *Agent) MarkDisconnected(triggeredBy string)
- func (a *Agent) NeedFullStateCommand() bool
- func (a *Agent) NewInstanceUID() []byte
- func (a *Agent) RecordLastReported(by *Server, lastReportedAt time.Time, sequenceNum uint64)
- func (a *Agent) ReportAvailableComponents(availableComponents *AgentAvailableComponents) error
- func (a *Agent) ReportCapabilities(capabilities *agent.Capabilities) error
- func (a *Agent) ReportComponentHealth(health *AgentComponentHealth) error
- func (a *Agent) ReportConnectionSettingsStatus(status *AgentConnectionSettingsStatus) error
- func (a *Agent) ReportCustomCapabilities(capabilities *AgentCustomCapabilities) error
- func (a *Agent) ReportDescription(desc *agent.Description) error
- func (a *Agent) ReportEffectiveConfig(config *AgentEffectiveConfig) error
- func (a *Agent) ReportPackageStatuses(status *AgentPackageStatuses) error
- func (a *Agent) ReportRemoteConfigStatus(status *AgentRemoteConfigStatus) error
- func (a *Agent) SetCondition(conditionType AgentConditionType, status AgentConditionStatus, ...)
- func (a *Agent) SetLogsConnectionSettings(endpoint string, opts ...ConnectionOption) error
- func (a *Agent) SetMetricsConnectionSettings(endpoint string, opts ...ConnectionOption) error
- func (a *Agent) SetOpAMPConnectionSettings(endpoint string, opts ...ConnectionOption) error
- func (a *Agent) SetOtherConnectionSettings(name, endpoint string, opts ...ConnectionOption) error
- func (a *Agent) SetRestartRequired(requiredAt time.Time) error
- func (a *Agent) SetTracesConnectionSettings(endpoint string, opts ...ConnectionOption) error
- func (a *Agent) ShouldBeRestarted() bool
- func (a *Agent) UpdateLastCommunicationInfo(now time.Time, connection *Connection)
- type AgentAvailableComponents
- type AgentCertificate
- type AgentComponentHealth
- type AgentCondition
- type AgentConditionStatus
- type AgentConditionType
- type AgentConfigFile
- type AgentConfigMap
- type AgentConnectionSettingsStatus
- type AgentCustomCapabilities
- type AgentEffectiveConfig
- type AgentGroup
- func (ag *AgentGroup) GetCreatedAt() *time.Time
- func (ag *AgentGroup) GetCreatedBy() string
- func (ag *AgentGroup) GetDeletedAt() *time.Time
- func (ag *AgentGroup) GetDeletedBy() *string
- func (ag *AgentGroup) HasAgentConnectionConfig() bool
- func (ag *AgentGroup) IsDeleted() bool
- func (ag *AgentGroup) MarkDeleted(deletedAt time.Time, deletedBy string)
- type AgentGroupAgentRemoteConfig
- type AgentGroupConnectionConfig
- type AgentGroupMetadata
- type AgentGroupSpec
- type AgentGroupStatus
- type AgentMetadata
- type AgentOpAMPConnectionSettings
- type AgentOption
- func WithAvailableComponents(availableComponents *AgentAvailableComponents) AgentOption
- func WithCapabilities(capabilities *agent.Capabilities) AgentOption
- func WithComponentHealth(componentHealth *AgentComponentHealth) AgentOption
- func WithCustomCapabilities(customCapabilities *AgentCustomCapabilities) AgentOption
- func WithDescription(description *agent.Description) AgentOption
- func WithEffectiveConfig(effectiveConfig *AgentEffectiveConfig) AgentOption
- func WithPackageStatuses(packageStatuses *AgentPackageStatuses) AgentOption
- type AgentOtherConnectionSettings
- type AgentPackage
- type AgentPackageMetadata
- type AgentPackageSpec
- type AgentPackageStatus
- type AgentPackageStatusEntry
- type AgentPackageStatusEnum
- type AgentPackageStatuses
- type AgentRemoteConfig
- type AgentRemoteConfigMetadata
- type AgentRemoteConfigResourceStatus
- type AgentRemoteConfigSpec
- type AgentRemoteConfigStatus
- type AgentRestartInfo
- type AgentSelector
- type AgentSpec
- type AgentSpecPackage
- type AgentSpecRemoteConfig
- type AgentStatus
- type AgentTelemetryConnectionSettings
- type Attributes
- type Certificate
- type CertificateMetadata
- type CertificateSpec
- type CertificateStatus
- type ComponentDetails
- type Condition
- type ConditionStatus
- type ConditionType
- type Connection
- type ConnectionInfo
- func (ci *ConnectionInfo) HasConnectionSettings() bool
- func (ci *ConnectionInfo) OpAMP() *AgentOpAMPConnectionSettings
- func (ci *ConnectionInfo) OtherConnections() map[string]AgentOtherConnectionSettings
- func (ci *ConnectionInfo) OwnLogs() *AgentTelemetryConnectionSettings
- func (ci *ConnectionInfo) OwnMetrics() *AgentTelemetryConnectionSettings
- func (ci *ConnectionInfo) OwnTraces() *AgentTelemetryConnectionSettings
- func (ci *ConnectionInfo) SetOpAMP(settings AgentOpAMPConnectionSettings) error
- func (ci *ConnectionInfo) SetOtherConnection(name string, settings AgentOtherConnectionSettings) error
- func (ci *ConnectionInfo) SetOwnLogs(settings AgentTelemetryConnectionSettings) error
- func (ci *ConnectionInfo) SetOwnMetrics(settings AgentTelemetryConnectionSettings) error
- func (ci *ConnectionInfo) SetOwnTraces(settings AgentTelemetryConnectionSettings) error
- type ConnectionOption
- type ConnectionOptionFunc
- type ConnectionSettingsStatus
- type ConnectionType
- type Host
- type ListOptions
- type ListResponse
- type OpAMPConnectionSettings
- type OtherConnectionSettings
- type RemoteConfigStatus
- type Server
- func (s *Server) Clone() *Server
- func (s *Server) GetCondition(conditionType ConditionType) *Condition
- func (s *Server) GetRegisteredAt() *time.Time
- func (s *Server) GetRegisteredBy() string
- func (s *Server) IsAlive(now time.Time, timeout time.Duration) bool
- func (s *Server) IsConditionTrue(conditionType ConditionType) bool
- func (s *Server) MarkRegistered(reason string)
- func (s *Server) SetCondition(conditionType ConditionType, status ConditionStatus, reason, message string)
- type TelemetryConnectionSettings
Constants ¶
const ( AgentPackageStatusEnumInstalled = 0 AgentPackageStatusEnumInstallPending = 1 AgentPackageStatusEnumInstalling = 2 AgentPackageStatusEnumInstallFailed = 3 AgentPackageStatusEnumDownloading = 4 )
AgentPackageStatusEnum values The AgentPackageStatusEnum enum is defined in the opamp protocol.
const ( // OpAMPPollingInterval is a polling interval for OpAMP. // ref. https://github.com/minuk-dev/opampcommander/issues/8 OpAMPPollingInterval = 30 * time.Second )
Variables ¶
var ( // ErrUnsupportedRemoteConfigContentType is returned when the remote config content type is not supported. ErrUnsupportedRemoteConfigContentType = errors.New("unsupported remote config content type") // ErrUnsupportedAgentOperation is returned when the agent does not support the requested operation. ErrUnsupportedAgentOperation = errors.New("unsupported agent operation") )
Functions ¶
func ConvertConnIDToString ¶ added in v0.0.15
ConvertConnIDToString converts the connection ID to a string.
Types ¶
type Agent ¶
type Agent struct {
Metadata AgentMetadata
Spec AgentSpec
Status AgentStatus
}
Agent is a domain model to control opamp agent by opampcommander.
func NewAgent ¶ added in v0.1.22
func NewAgent(instanceUID uuid.UUID, opts ...AgentOption) *Agent
NewAgent creates a new agent with the given instance UID. It initializes all fields with default values. You can optionally pass AgentOption functions to customize the agent.
func (*Agent) ApplyConnectionSettings ¶ added in v0.1.26
func (a *Agent) ApplyConnectionSettings( opamp *AgentOpAMPConnectionSettings, ownMetrics *AgentTelemetryConnectionSettings, ownLogs *AgentTelemetryConnectionSettings, ownTraces *AgentTelemetryConnectionSettings, otherConnections map[string]AgentOtherConnectionSettings, ) error
ApplyConnectionSettings applies connection settings to the agent from agent group.
func (*Agent) ApplyRemoteConfig ¶ added in v0.0.2
func (a *Agent) ApplyRemoteConfig( agentRemoteConfigName string, agentConfigFile AgentConfigFile, ) error
ApplyRemoteConfig applies a remote config to the agent.
func (*Agent) ConnectedServerID ¶ added in v0.1.22
ConnectedServerID returns the server the agent is currently connected to.
func (*Agent) GetCondition ¶ added in v0.1.24
func (a *Agent) GetCondition(conditionType AgentConditionType) *AgentCondition
GetCondition returns the condition of the specified type.
func (*Agent) HasInstanceUID ¶ added in v0.1.24
HasInstanceUID checks if the agent has a valid instance UID.
func (*Agent) HasNewInstanceUID ¶ added in v0.1.24
HasNewInstanceUID checks if there is a new instance UID to inform the agent.
func (*Agent) HasNewPackages ¶ added in v0.1.28
HasNewPackages checks if there are new packages available for the agent.
func (*Agent) HasPendingServerMessages ¶ added in v0.1.22
HasPendingServerMessages checks if there are any pending server messages for the agent.
func (*Agent) HasRemoteConfig ¶ added in v0.1.24
HasRemoteConfig checks if the agent has remote configuration to apply.
func (*Agent) IsConditionTrue ¶ added in v0.1.24
func (a *Agent) IsConditionTrue(conditionType AgentConditionType) bool
IsConditionTrue checks if the specified condition type is true.
func (*Agent) IsConnected ¶ added in v0.1.22
IsConnected checks if the agent is currently connected.
func (*Agent) IsOpAMPConnectionSettingsSupported ¶ added in v0.1.26
IsOpAMPConnectionSettingsSupported checks if the agent supports OpAMP connection settings.
func (*Agent) IsOtherConnectionSettingsSupported ¶ added in v0.1.26
IsOtherConnectionSettingsSupported checks if the agent supports other connection settings.
func (*Agent) IsOwnLogsSupported ¶ added in v0.1.26
IsOwnLogsSupported checks if the agent supports reporting its own logs.
func (*Agent) IsOwnMetricsSupported ¶ added in v0.1.26
IsOwnMetricsSupported checks if the agent supports reporting its own metrics.
func (*Agent) IsOwnTracesSupported ¶ added in v0.1.26
IsOwnTracesSupported checks if the agent supports reporting its own traces.
func (*Agent) IsRemoteConfigSupported ¶ added in v0.1.24
IsRemoteConfigSupported checks if the agent supports remote configuration.
func (*Agent) IsRestartSupported ¶ added in v0.1.26
IsRestartSupported checks if the agent supports restart command.
func (*Agent) MarkConnected ¶ added in v0.1.24
MarkConnected marks the agent as connected and updates the connection condition.
func (*Agent) MarkDisconnected ¶ added in v0.1.24
MarkDisconnected marks the agent as disconnected and updates the connection condition.
func (*Agent) NeedFullStateCommand ¶ added in v0.1.24
NeedFullStateCommand checks if the agent needs to send a ReportFullState command.
func (*Agent) NewInstanceUID ¶ added in v0.1.24
NewInstanceUID returns the new instance UID to inform the agent.
func (*Agent) RecordLastReported ¶ added in v0.1.22
RecordLastReported updates the last communicated time and server of the agent.
func (*Agent) ReportAvailableComponents ¶
func (a *Agent) ReportAvailableComponents(availableComponents *AgentAvailableComponents) error
ReportAvailableComponents is a method to report the available components of the agent.
func (*Agent) ReportCapabilities ¶ added in v0.0.15
func (a *Agent) ReportCapabilities(capabilities *agent.Capabilities) error
ReportCapabilities is a method to report the capabilities of the agent.
func (*Agent) ReportComponentHealth ¶
func (a *Agent) ReportComponentHealth(health *AgentComponentHealth) error
ReportComponentHealth is a method to report the component health of the agent.
func (*Agent) ReportConnectionSettingsStatus ¶ added in v0.1.26
func (a *Agent) ReportConnectionSettingsStatus(status *AgentConnectionSettingsStatus) error
ReportConnectionSettingsStatus is a method to report the connection settings status of the agent.
func (*Agent) ReportCustomCapabilities ¶
func (a *Agent) ReportCustomCapabilities(capabilities *AgentCustomCapabilities) error
ReportCustomCapabilities is a method to report the custom capabilities of the agent.
func (*Agent) ReportDescription ¶
func (a *Agent) ReportDescription(desc *agent.Description) error
ReportDescription is a method to report the description of the agent.
func (*Agent) ReportEffectiveConfig ¶
func (a *Agent) ReportEffectiveConfig(config *AgentEffectiveConfig) error
ReportEffectiveConfig is a method to report the effective configuration of the agent.
func (*Agent) ReportPackageStatuses ¶
func (a *Agent) ReportPackageStatuses(status *AgentPackageStatuses) error
ReportPackageStatuses is a method to report the package statuses of the agent.
func (*Agent) ReportRemoteConfigStatus ¶
func (a *Agent) ReportRemoteConfigStatus(status *AgentRemoteConfigStatus) error
ReportRemoteConfigStatus is a method to report the remote configuration status of the agent.
func (*Agent) SetCondition ¶ added in v0.1.24
func (a *Agent) SetCondition( conditionType AgentConditionType, status AgentConditionStatus, triggeredBy, message string, )
SetCondition sets or updates a condition in the agent's status.
func (*Agent) SetLogsConnectionSettings ¶ added in v0.1.26
func (a *Agent) SetLogsConnectionSettings(endpoint string, opts ...ConnectionOption) error
SetLogsConnectionSettings sets logs connection settings for the agent.
func (*Agent) SetMetricsConnectionSettings ¶ added in v0.1.26
func (a *Agent) SetMetricsConnectionSettings(endpoint string, opts ...ConnectionOption) error
SetMetricsConnectionSettings sets metrics connection settings for the agent.
func (*Agent) SetOpAMPConnectionSettings ¶ added in v0.1.26
func (a *Agent) SetOpAMPConnectionSettings(endpoint string, opts ...ConnectionOption) error
SetOpAMPConnectionSettings sets OpAMP connection settings for the agent.
func (*Agent) SetOtherConnectionSettings ¶ added in v0.1.26
func (a *Agent) SetOtherConnectionSettings(name, endpoint string, opts ...ConnectionOption) error
SetOtherConnectionSettings sets other connection settings for the agent.
func (*Agent) SetRestartRequired ¶ added in v0.1.24
SetRestartRequired sets the restart required information for the agent.
func (*Agent) SetTracesConnectionSettings ¶ added in v0.1.26
func (a *Agent) SetTracesConnectionSettings(endpoint string, opts ...ConnectionOption) error
SetTracesConnectionSettings sets traces connection settings for the agent.
func (*Agent) ShouldBeRestarted ¶ added in v0.1.24
ShouldBeRestarted checks if the agent should be restarted to apply a command that requires a restart.
func (*Agent) UpdateLastCommunicationInfo ¶ added in v0.1.22
func (a *Agent) UpdateLastCommunicationInfo(now time.Time, connection *Connection)
UpdateLastCommunicationInfo updates the last communication info of the agent.
type AgentAvailableComponents ¶
type AgentAvailableComponents struct {
Components map[string]ComponentDetails
Hash []byte
}
AgentAvailableComponents is a map of available components.
type AgentCertificate ¶ added in v0.1.28
AgentCertificate represents a certificate used by an agent for secure communications.
type AgentComponentHealth ¶
type AgentComponentHealth struct {
// Set to true if the Agent is up and healthy.
Healthy bool
// Timestamp since the Agent is up
StartTime time.Time
// Human-readable error message if the Agent is in erroneous state. SHOULD be set when healthy==false.
LastError string
// Component status represented as a string.
// The status values are defined by agent-specific semantics and not at the protocol level.
Status string
// The time when the component status was observed.
StatusTime time.Time
// A map to store more granular, sub-component health.
// It can nest as deeply as needed to describe the underlying system.
ComponentHealthMap map[string]AgentComponentHealth
}
AgentComponentHealth is a domain model to control opamp agent component health.
type AgentCondition ¶ added in v0.1.24
type AgentCondition struct {
// Type is the type of the condition.
Type AgentConditionType
// LastTransitionTime is the last time the condition transitioned.
LastTransitionTime time.Time
// Status is the status of the condition.
Status AgentConditionStatus
// Reason is the identifier of the user or system that triggered the condition.
Reason string
// Message is a human readable message indicating details about the condition.
Message string
}
AgentCondition represents a condition of an agent.
type AgentConditionStatus ¶ added in v0.1.24
type AgentConditionStatus string
AgentConditionStatus represents the status of an agent condition.
const ( // AgentConditionStatusTrue represents a true condition status. AgentConditionStatusTrue AgentConditionStatus = "True" // AgentConditionStatusFalse represents a false condition status. AgentConditionStatusFalse AgentConditionStatus = "False" // AgentConditionStatusUnknown represents an unknown condition status. AgentConditionStatusUnknown AgentConditionStatus = "Unknown" )
type AgentConditionType ¶ added in v0.1.24
type AgentConditionType string
AgentConditionType represents the type of an agent condition.
const ( // AgentConditionTypeConnected represents the condition when the agent is connected. AgentConditionTypeConnected AgentConditionType = "Connected" // AgentConditionTypeHealthy represents the condition when the agent is healthy. AgentConditionTypeHealthy AgentConditionType = "Healthy" // AgentConditionTypeConfigured represents the condition when the agent has been configured. AgentConditionTypeConfigured AgentConditionType = "Configured" // AgentConditionTypeRegistered represents the condition when the agent has been registered. AgentConditionTypeRegistered AgentConditionType = "Registered" )
type AgentConfigFile ¶
type AgentConfigFile struct {
// The body field contains the raw bytes of the configuration file.
// The content, format and encoding of the raw bytes is Agent type-specific and is outside the concerns of OpAMP
// protocol.
Body []byte
// content_type is an optional field. It is a MIME Content-Type that describes what's contained in the body field,
// for example "text/yaml". The content_type reported in the Effective Configuration in the Agent's status report may
// be used for example by the Server to visualize the reported configuration nicely in a UI.
ContentType string
}
AgentConfigFile is a configuration file.
type AgentConfigMap ¶
type AgentConfigMap struct {
// The config_map field of the AgentConfigSet message is a map of configuration files, where keys are file names.
ConfigMap map[string]AgentConfigFile
}
AgentConfigMap is a map of configuration files.
type AgentConnectionSettingsStatus ¶ added in v0.1.26
type AgentConnectionSettingsStatus struct {
LastConnectionSettingsHash []byte
Status ConnectionSettingsStatus
ErrorMessage string
}
AgentConnectionSettingsStatus is the status of the connection settings.
type AgentCustomCapabilities ¶
type AgentCustomCapabilities struct {
Capabilities []string
}
AgentCustomCapabilities is a list of custom capabilities that the Agent supports.
type AgentEffectiveConfig ¶
type AgentEffectiveConfig struct {
ConfigMap AgentConfigMap
}
AgentEffectiveConfig is the effective configuration of the agent.
type AgentGroup ¶ added in v0.1.24
type AgentGroup struct {
Metadata AgentGroupMetadata
Spec AgentGroupSpec
Status AgentGroupStatus
}
AgentGroup represents a group of agents with their associated metadata.
func NewAgentGroup ¶ added in v0.1.24
func NewAgentGroup( name string, attributes Attributes, createdAt time.Time, createdBy string, ) *AgentGroup
NewAgentGroup creates a new instance of AgentGroup with the provided name, attributes, createdAt timestamp, and createdBy identifier.
func (*AgentGroup) GetCreatedAt ¶ added in v0.1.24
func (ag *AgentGroup) GetCreatedAt() *time.Time
GetCreatedAt returns the timestamp when the agent group was created.
func (*AgentGroup) GetCreatedBy ¶ added in v0.1.24
func (ag *AgentGroup) GetCreatedBy() string
GetCreatedBy returns the identifier of the user or system that created the agent group.
func (*AgentGroup) GetDeletedAt ¶ added in v0.1.24
func (ag *AgentGroup) GetDeletedAt() *time.Time
GetDeletedAt returns the timestamp when the agent group was deleted.
func (*AgentGroup) GetDeletedBy ¶ added in v0.1.24
func (ag *AgentGroup) GetDeletedBy() *string
GetDeletedBy returns the identifier of the user or system that deleted the agent group.
func (*AgentGroup) HasAgentConnectionConfig ¶ added in v0.1.28
func (ag *AgentGroup) HasAgentConnectionConfig() bool
HasAgentConnectionConfig returns true if the agent group has connection configuration.
func (*AgentGroup) IsDeleted ¶ added in v0.1.24
func (ag *AgentGroup) IsDeleted() bool
IsDeleted returns true if the agent group is marked as deleted.
func (*AgentGroup) MarkDeleted ¶ added in v0.1.24
func (ag *AgentGroup) MarkDeleted(deletedAt time.Time, deletedBy string)
MarkDeleted marks the agent group as deleted by setting deletedAt and adding a deleted condition.
type AgentGroupAgentRemoteConfig ¶ added in v0.1.28
type AgentGroupAgentRemoteConfig struct {
// AgentRemoteConfigName is the name of a standalone remote configuration resource.
AgentRemoteConfigName *string
// AgentRemoteConfigSpec is the remote configuration to be applied to agents in this group.
AgentRemoteConfigSpec *AgentRemoteConfigSpec
// AgentRemoteConfigRef is a reference to a standalone remote configuration resource.
AgentRemoteConfigRef *string
}
AgentGroupAgentRemoteConfig represents a remote configuration for agents in the group.
type AgentGroupConnectionConfig ¶ added in v0.1.28
type AgentGroupConnectionConfig struct {
OpAMPConnection *OpAMPConnectionSettings
OwnMetrics *TelemetryConnectionSettings
OwnLogs *TelemetryConnectionSettings
OwnTraces *TelemetryConnectionSettings
OtherConnections map[string]OtherConnectionSettings
}
AgentGroupConnectionConfig represents connection settings for agents in the group.
type AgentGroupMetadata ¶ added in v0.1.24
type AgentGroupMetadata struct {
// Name is the name of the agent group.
Name string
// Attributes is a map of attributes associated with the agent group.
Attributes Attributes
// CreatedAt is the timestamp when the agent group was created.
CreatedAt time.Time
// DeletedAt is the timestamp when the agent group was soft deleted.
// If is zero, the agent group is not deleted.
DeletedAt time.Time
}
AgentGroupMetadata represents metadata information for an agent group.
type AgentGroupSpec ¶ added in v0.1.24
type AgentGroupSpec struct {
// Priority is the priority of the agent group.
// When multiple agent groups match an agent, the one with the highest priority is applied.
Priority int
// Selector is a set of criteria used to select agents for the group.
Selector AgentSelector
// AgentRemoteConfig is a single remote configuration (for API compatibility).
// Deprecated: Use AgentRemoteConfigs for multiple configs.
AgentRemoteConfig *AgentGroupAgentRemoteConfig
// AgentRemoteConfigs is a list of remote configurations for the agent group.
AgentRemoteConfigs []AgentGroupAgentRemoteConfig
// AgentConnection settings for agents in this group.
AgentConnectionConfig *AgentGroupConnectionConfig
}
AgentGroupSpec represents the specification of an agent group.
type AgentGroupStatus ¶ added in v0.1.24
type AgentGroupStatus struct {
// NumAgents is the total number of agents in the agent group.
// NumAgents = NumConnectedAgents + NumNotConnectedAgents
NumAgents int
// NumConnectedAgents is the number of connected agents in the agent group.
// NumConnectedAgents = NumHealthyAgents + NumUnhealthyAgents
NumConnectedAgents int
// NumHealthyAgents is the number of healthy agents in the agent group.
NumHealthyAgents int
// NumUnhealthyAgents is the number of unhealthy agents in the agent group.
NumUnhealthyAgents int
// NumNotConnectedAgents is the number of not connected agents in the agent group.
NumNotConnectedAgents int
// Conditions is a list of conditions that apply to the agent group.
Conditions []Condition
}
AgentGroupStatus represents the status of an agent group.
type AgentMetadata ¶ added in v0.1.22
type AgentMetadata struct {
// InstanceUID is a unique identifier for the agent instance.
// It is generated by the agent and should not change between restarts of the agent.
InstanceUID uuid.UUID
// Description is a agent description defined in the opamp protocol.
// It is set by the agent and should not change between restarts of the agent.
// It can be changed by the agent at any time.
Description agent.Description
// Capabilities is a agent capabilities defined in the opamp protocol.
Capabilities agent.Capabilities
// CustomCapabilities is a list of custom capabilities that the Agent supports.
CustomCapabilities AgentCustomCapabilities
}
AgentMetadata is a domain model to control opamp agent metadata.
func (*AgentMetadata) IsComplete ¶ added in v0.1.22
func (am *AgentMetadata) IsComplete() bool
IsComplete checks if all required metadata fields are populated. Returns true if the agent has reported its description and capabilities.
type AgentOpAMPConnectionSettings ¶ added in v0.1.28
type AgentOpAMPConnectionSettings struct {
DestinationEndpoint string
Headers map[string][]string
Certificate *AgentCertificate
}
AgentOpAMPConnectionSettings represents OpAMP connection settings for an agent.
type AgentOption ¶ added in v0.1.22
type AgentOption func(*Agent)
AgentOption is a function that configures an Agent.
func WithAvailableComponents ¶ added in v0.1.22
func WithAvailableComponents(availableComponents *AgentAvailableComponents) AgentOption
WithAvailableComponents sets the agent available components.
func WithCapabilities ¶ added in v0.1.22
func WithCapabilities(capabilities *agent.Capabilities) AgentOption
WithCapabilities sets the agent capabilities.
func WithComponentHealth ¶ added in v0.1.22
func WithComponentHealth(componentHealth *AgentComponentHealth) AgentOption
WithComponentHealth sets the agent component health.
func WithCustomCapabilities ¶ added in v0.1.22
func WithCustomCapabilities(customCapabilities *AgentCustomCapabilities) AgentOption
WithCustomCapabilities sets the agent custom capabilities.
func WithDescription ¶ added in v0.1.22
func WithDescription(description *agent.Description) AgentOption
WithDescription sets the agent description.
func WithEffectiveConfig ¶ added in v0.1.22
func WithEffectiveConfig(effectiveConfig *AgentEffectiveConfig) AgentOption
WithEffectiveConfig sets the agent effective config.
func WithPackageStatuses ¶ added in v0.1.22
func WithPackageStatuses(packageStatuses *AgentPackageStatuses) AgentOption
WithPackageStatuses sets the agent package statuses.
type AgentOtherConnectionSettings ¶ added in v0.1.28
type AgentOtherConnectionSettings struct {
DestinationEndpoint string
Headers map[string][]string
Certificate *AgentCertificate
}
AgentOtherConnectionSettings represents other connection settings for an agent.
type AgentPackage ¶ added in v0.1.28
type AgentPackage struct {
Metadata AgentPackageMetadata
Spec AgentPackageSpec
Status AgentPackageStatus
}
AgentPackage represents an agent package resource.
func (*AgentPackage) MarkAsCreated ¶ added in v0.1.28
func (a *AgentPackage) MarkAsCreated(createdAt time.Time, createdBy string)
MarkAsCreated marks the agent package as created by setting the CreatedAt timestamp.
func (*AgentPackage) MarkAsDeleted ¶ added in v0.1.28
func (a *AgentPackage) MarkAsDeleted(deletedAt time.Time, deletedBy string)
MarkAsDeleted marks the agent package as deleted by setting the DeletedAt timestamp.
type AgentPackageMetadata ¶ added in v0.1.28
type AgentPackageMetadata struct {
Name string
Attributes Attributes
// CreatedAt is the timestamp when the agent package was created.
CreatedAt time.Time
// DeletedAt is the timestamp when the agent package was soft deleted.
// If nil, the agent package is not deleted.
DeletedAt *time.Time
}
AgentPackageMetadata represents the metadata of an agent package.
type AgentPackageSpec ¶ added in v0.1.28
type AgentPackageSpec struct {
PackageType string
Version string
DownloadURL string
ContentHash []byte
Signature []byte
Headers map[string]string
Hash []byte
}
AgentPackageSpec represents the specification of an agent package.
type AgentPackageStatus ¶
type AgentPackageStatus struct {
Conditions []Condition
}
AgentPackageStatus represents the status of an agent package.
type AgentPackageStatusEntry ¶ added in v0.1.28
type AgentPackageStatusEntry struct {
Name string
AgentHasVersion string
AgentHasHash []byte
ServerOfferedVersion string
Status AgentPackageStatusEnum
ErrorMessage string
}
AgentPackageStatusEntry is the status of a package.
type AgentPackageStatusEnum ¶
type AgentPackageStatusEnum int32
AgentPackageStatusEnum is an enum that represents the status of a package.
type AgentPackageStatuses ¶
type AgentPackageStatuses struct {
Packages map[string]AgentPackageStatusEntry
ServerProvidedAllPackgesHash []byte
ErrorMessage string
}
AgentPackageStatuses is a map of package statuses.
type AgentRemoteConfig ¶ added in v0.1.26
type AgentRemoteConfig struct {
Metadata AgentRemoteConfigMetadata
Spec AgentRemoteConfigSpec
Status AgentRemoteConfigResourceStatus
}
AgentRemoteConfig represents a standalone remote configuration resource. This is different from AgentRemoteConfig in agentgroup.go which is embedded in AgentGroup.
func (*AgentRemoteConfig) IsDeleted ¶ added in v0.1.28
func (arc *AgentRemoteConfig) IsDeleted() bool
IsDeleted returns true if the agent remote config is marked as deleted.
func (*AgentRemoteConfig) MarkDeleted ¶ added in v0.1.28
func (arc *AgentRemoteConfig) MarkDeleted(deletedAt time.Time, deletedBy string)
MarkDeleted marks the agent remote config as deleted by adding a deleted condition.
type AgentRemoteConfigMetadata ¶ added in v0.1.28
type AgentRemoteConfigMetadata struct {
Name string
Attributes Attributes
CreatedAt time.Time
DeletedAt *time.Time
}
AgentRemoteConfigMetadata contains metadata for the agent remote config resource.
type AgentRemoteConfigResourceStatus ¶ added in v0.1.28
type AgentRemoteConfigResourceStatus struct {
Conditions []Condition
}
AgentRemoteConfigResourceStatus contains the status of the agent remote config resource.
type AgentRemoteConfigSpec ¶ added in v0.1.28
type AgentRemoteConfigSpec struct {
// Value is the configuration content.
Value []byte
// ContentType is the MIME type of the configuration content.
ContentType string
}
AgentRemoteConfigSpec contains the specification for the agent remote config resource.
type AgentRemoteConfigStatus ¶
type AgentRemoteConfigStatus struct {
LastRemoteConfigHash []byte
Status RemoteConfigStatus
ErrorMessage string
LastUpdatedAt time.Time
}
AgentRemoteConfigStatus is the status of the remote configuration.
type AgentRestartInfo ¶ added in v0.1.24
type AgentRestartInfo struct {
// RequiredRestartedAt is the time when the agent is required to be
// restarted to apply a command that requires a restart.
RequiredRestartedAt time.Time
}
AgentRestartInfo is a domain model to control opamp agent restart information.
func (*AgentRestartInfo) ShouldBeRestarted ¶ added in v0.1.24
func (a *AgentRestartInfo) ShouldBeRestarted(agentStartTime time.Time) bool
ShouldBeRestarted checks if the agent should be restarted to apply a command that requires a restart.
type AgentSelector ¶ added in v0.1.22
type AgentSelector struct {
// IdentifyingAttributes is a map of identifying attributes used to select agents.
IdentifyingAttributes map[string]string
// NonIdentifyingAttributes is a map of non-identifying attributes used to select agents.
NonIdentifyingAttributes map[string]string
}
AgentSelector defines the criteria for selecting agent.
type AgentSpec ¶ added in v0.1.22
type AgentSpec struct {
// NewInstanceUID is a new instance UID to inform the agent of its new identity.
NewInstanceUID uuid.UUID
// RestartInfo contains information about agent restart.
RestartInfo *AgentRestartInfo
// ConnectionInfo is the connection information for the agent.
ConnectionInfo *ConnectionInfo
// RemoteConfig is the remote configuration for the agent.
RemoteConfig *AgentSpecRemoteConfig
// PackagesAvailable is the packages available for the agent.
PackagesAvailable *AgentSpecPackage
}
AgentSpec is a domain model to control opamp agent spec.
type AgentSpecPackage ¶ added in v0.1.28
type AgentSpecPackage struct {
// Packages is a list of package names available for the agent.
Packages []string
}
AgentSpecPackage represents the package specification for an agent.
type AgentSpecRemoteConfig ¶ added in v0.1.28
type AgentSpecRemoteConfig struct {
ConfigMap AgentConfigMap
}
AgentSpecRemoteConfig represents the remote config specification for an agent.
type AgentStatus ¶ added in v0.1.22
type AgentStatus struct {
RemoteConfigStatus AgentRemoteConfigStatus
ConnectionSettingsStatus AgentConnectionSettingsStatus
EffectiveConfig AgentEffectiveConfig
PackageStatuses AgentPackageStatuses
ComponentHealth AgentComponentHealth
AvailableComponents AgentAvailableComponents
// Conditions is a list of conditions that apply to the agent.
// WARNING: Do NOT use Conditions for MongoDB queries or aggregations.
// The Conditions field can be null which causes MongoDB aggregation errors
// (e.g., $anyElementTrue's argument must be an array, but is null).
// Use the following indexed fields instead:
// - Connected (bool): for connection status queries
// - ComponentHealth.Healthy (bool): for health status queries
Conditions []AgentCondition
Connected bool
ConnectionType ConnectionType
SequenceNum uint64
LastReportedAt time.Time
// LastReportedTo is the ID of the server the agent last reported to.
// When you want to get Server object, use `GetServerByID` function from ServerUsecase.
LastReportedTo string
}
AgentStatus is a domain model to control opamp agent status.
type AgentTelemetryConnectionSettings ¶ added in v0.1.28
type AgentTelemetryConnectionSettings struct {
DestinationEndpoint string
Headers map[string][]string
Certificate *AgentCertificate
}
AgentTelemetryConnectionSettings represents telemetry connection settings for an agent.
type Attributes ¶ added in v0.1.24
Attributes represents a map of attributes for the agent group.
func OfAttributes ¶ added in v0.1.24
func OfAttributes(attributes map[string]string) Attributes
OfAttributes creates an Attributes instance from a map of attributes.
type Certificate ¶ added in v0.1.28
type Certificate struct {
Metadata CertificateMetadata
Spec CertificateSpec
Status CertificateStatus
}
Certificate represents a TLS certificate used for secure communications.
func (*Certificate) MarkAsDeleted ¶ added in v0.1.28
func (c *Certificate) MarkAsDeleted(deletedAt time.Time, deletedBy string)
MarkAsDeleted marks the certificate as deleted.
func (*Certificate) ToAgentCertificate ¶ added in v0.1.28
func (c *Certificate) ToAgentCertificate() *AgentCertificate
ToAgentCertificate converts the certificate to an AgentCertificate.
type CertificateMetadata ¶ added in v0.1.28
type CertificateMetadata struct {
Name string
Attributes Attributes
// CreatedAt is the timestamp when the certificate was created.
CreatedAt time.Time
// DeletedAt is the timestamp when the certificate was soft deleted.
// If zero, the certificate is not deleted.
DeletedAt time.Time
}
CertificateMetadata represents metadata information for a certificate.
type CertificateSpec ¶ added in v0.1.28
CertificateSpec represents the specification of a certificate.
type CertificateStatus ¶ added in v0.1.28
type CertificateStatus struct {
Conditions []Condition
}
CertificateStatus represents the status of a certificate.
type ComponentDetails ¶
type ComponentDetails struct {
Metadata map[string]string
SubComponentMap map[string]ComponentDetails
}
ComponentDetails is a details of a component.
type Condition ¶ added in v0.1.24
type Condition struct {
// Type is the type of the condition.
Type ConditionType
// LastTransitionTime is the last time the condition transitioned.
LastTransitionTime time.Time
// Status is the status of the condition.
Status ConditionStatus
// Reason is the identifier of the user or system that triggered the condition.
Reason string
// Message is a human readable message indicating details about the condition.
Message string
}
Condition represents a condition of an agent group.
type ConditionStatus ¶ added in v0.1.24
type ConditionStatus string
ConditionStatus represents the status of a condition.
const ( // ConditionStatusTrue represents a true condition status. ConditionStatusTrue ConditionStatus = "True" // ConditionStatusFalse represents a false condition status. ConditionStatusFalse ConditionStatus = "False" // ConditionStatusUnknown represents an unknown condition status. ConditionStatusUnknown ConditionStatus = "Unknown" )
type ConditionType ¶ added in v0.1.24
type ConditionType string
ConditionType represents the type of a condition.
const ( // ConditionTypeCreated represents the condition when the agent group was created. ConditionTypeCreated ConditionType = "Created" // ConditionTypeUpdated represents the condition when the agent group was updated. ConditionTypeUpdated ConditionType = "Updated" // ConditionTypeDeleted represents the condition when the agent group was deleted. ConditionTypeDeleted ConditionType = "Deleted" // ConditionTypeAlive represents the condition when the server is alive. ConditionTypeAlive ConditionType = "Alive" )
type Connection ¶
type Connection struct {
// Key is the unique identifier for the connection.
// It should be unique across all connections to use as a key in a map.
// Normally, it is [types.Connection] by OpAMP.
ID any
// Type is the type of the connection.
Type ConnectionType
// UID is the unique identifier for the connection.
// It is used to identify the connection in the database.
UID uuid.UUID
// InstanceUID is id of the agent.
InstanceUID uuid.UUID
// LastCommunicatedAt is the last time the connection was communicated with.
LastCommunicatedAt time.Time
}
Connection represents a connection to an agent. This is a pure domain model containing only metadata about the connection. The actual WebSocket connection object is managed separately by the WebSocketRegistry.
func NewConnection ¶
func NewConnection(id any, typ ConnectionType) *Connection
NewConnection creates a new Connection instance with the given ID and type.
func (*Connection) IDString ¶ added in v0.0.15
func (conn *Connection) IDString() string
IDString returns a string value In some cases, a unique string id instead of any type.
func (*Connection) IsAlive ¶
func (conn *Connection) IsAlive(now time.Time) bool
IsAlive returns true if the connection is alive.
func (*Connection) IsAnonymous ¶ added in v0.0.15
func (conn *Connection) IsAnonymous() bool
IsAnonymous returns true if the connection is anonymous.
func (*Connection) IsManaged ¶ added in v0.0.15
func (conn *Connection) IsManaged() bool
IsManaged returns true if the connection is managed.
func (*Connection) SetInstanceUID ¶ added in v0.1.22
func (conn *Connection) SetInstanceUID(instanceUID uuid.UUID)
SetInstanceUID sets the instance UID of the connection.
type ConnectionInfo ¶ added in v0.1.26
ConnectionInfo represents connection information for the agent.
func NewConnectionInfo ¶ added in v0.1.26
func NewConnectionInfo( opamp *AgentOpAMPConnectionSettings, ownMetrics *AgentTelemetryConnectionSettings, ownLogs *AgentTelemetryConnectionSettings, ownTraces *AgentTelemetryConnectionSettings, otherConnections map[string]AgentOtherConnectionSettings, ) (*ConnectionInfo, error)
NewConnectionInfo creates a new ConnectionInfo with the given settings.
func (*ConnectionInfo) HasConnectionSettings ¶ added in v0.1.26
func (ci *ConnectionInfo) HasConnectionSettings() bool
HasConnectionSettings checks if there are any connection settings configured.
func (*ConnectionInfo) OpAMP ¶ added in v0.1.26
func (ci *ConnectionInfo) OpAMP() *AgentOpAMPConnectionSettings
OpAMP returns the OpAMP connection settings.
func (*ConnectionInfo) OtherConnections ¶ added in v0.1.26
func (ci *ConnectionInfo) OtherConnections() map[string]AgentOtherConnectionSettings
OtherConnections returns the other connection settings.
func (*ConnectionInfo) OwnLogs ¶ added in v0.1.26
func (ci *ConnectionInfo) OwnLogs() *AgentTelemetryConnectionSettings
OwnLogs returns the own logs connection settings.
func (*ConnectionInfo) OwnMetrics ¶ added in v0.1.26
func (ci *ConnectionInfo) OwnMetrics() *AgentTelemetryConnectionSettings
OwnMetrics returns the own metrics connection settings.
func (*ConnectionInfo) OwnTraces ¶ added in v0.1.26
func (ci *ConnectionInfo) OwnTraces() *AgentTelemetryConnectionSettings
OwnTraces returns the own traces connection settings.
func (*ConnectionInfo) SetOpAMP ¶ added in v0.1.26
func (ci *ConnectionInfo) SetOpAMP(settings AgentOpAMPConnectionSettings) error
SetOpAMP sets the OpAMP connection settings.
func (*ConnectionInfo) SetOtherConnection ¶ added in v0.1.26
func (ci *ConnectionInfo) SetOtherConnection(name string, settings AgentOtherConnectionSettings) error
SetOtherConnection sets the other connection settings.
func (*ConnectionInfo) SetOwnLogs ¶ added in v0.1.26
func (ci *ConnectionInfo) SetOwnLogs(settings AgentTelemetryConnectionSettings) error
SetOwnLogs sets the own logs connection settings.
func (*ConnectionInfo) SetOwnMetrics ¶ added in v0.1.26
func (ci *ConnectionInfo) SetOwnMetrics(settings AgentTelemetryConnectionSettings) error
SetOwnMetrics sets the own metrics connection settings.
func (*ConnectionInfo) SetOwnTraces ¶ added in v0.1.26
func (ci *ConnectionInfo) SetOwnTraces(settings AgentTelemetryConnectionSettings) error
SetOwnTraces sets the own traces connection settings.
type ConnectionOption ¶ added in v0.1.26
type ConnectionOption interface {
// contains filtered or unexported methods
}
ConnectionOption is a function option for configuring connection settings.
func WithCertificate ¶ added in v0.1.26
func WithCertificate(certificate *AgentCertificate) ConnectionOption
WithCertificate sets the certificate for the connection.
func WithHeaders ¶ added in v0.1.26
func WithHeaders(headers map[string][]string) ConnectionOption
WithHeaders sets the headers for the connection.
type ConnectionOptionFunc ¶ added in v0.1.26
type ConnectionOptionFunc func(*connectionSettings)
ConnectionOptionFunc is a function that implements ConnectionOption.
type ConnectionSettingsStatus ¶ added in v0.1.26
type ConnectionSettingsStatus int32
ConnectionSettingsStatus represents the status of connection settings.
const ( // ConnectionSettingsStatusUnset means status is not set. ConnectionSettingsStatusUnset ConnectionSettingsStatus = 0 // ConnectionSettingsStatusApplied means connection settings have been applied. ConnectionSettingsStatusApplied ConnectionSettingsStatus = 1 // ConnectionSettingsStatusApplying means connection settings are being applied. ConnectionSettingsStatusApplying ConnectionSettingsStatus = 2 // ConnectionSettingsStatusFailed means applying connection settings failed. ConnectionSettingsStatusFailed ConnectionSettingsStatus = 3 )
type ConnectionType ¶ added in v0.1.22
type ConnectionType int
ConnectionType represents the type of the connection.
const ( // ConnectionTypeUnknown is the unknown type. ConnectionTypeUnknown ConnectionType = iota // ConnectionTypeHTTP is the HTTP type. ConnectionTypeHTTP // ConnectionTypeWebSocket is the WebSocket type. ConnectionTypeWebSocket )
func ConnectionTypeFromString ¶ added in v0.1.24
func ConnectionTypeFromString(s string) ConnectionType
ConnectionTypeFromString converts a string to a ConnectionType.
func (ConnectionType) String ¶ added in v0.1.22
func (ct ConnectionType) String() string
String returns the string representation of the ConnectionType.
type ListOptions ¶ added in v0.1.9
ListOptions is a struct that holds options for listing resources.
type ListResponse ¶ added in v0.1.9
ListResponse is a generic struct that represents a paginated response for listing resources.
type OpAMPConnectionSettings ¶ added in v0.1.26
type OpAMPConnectionSettings struct {
DestinationEndpoint string
Headers map[string][]string
CertificateName *string
}
OpAMPConnectionSettings represents OpAMP connection settings.
type OtherConnectionSettings ¶ added in v0.1.26
type OtherConnectionSettings struct {
DestinationEndpoint string
Headers map[string][]string
CertificateName *string
}
OtherConnectionSettings represents other connection settings.
type RemoteConfigStatus ¶ added in v0.1.22
type RemoteConfigStatus int32
RemoteConfigStatus is generated from agentToServer of OpAMP.
const ( // RemoteConfigStatusUnset means status is not set. RemoteConfigStatusUnset RemoteConfigStatus = 0 // RemoteConfigStatusApplied means remote config has been applied. RemoteConfigStatusApplied RemoteConfigStatus = 1 // RemoteConfigStatusApplying means remote config is being applied. RemoteConfigStatusApplying RemoteConfigStatus = 2 // RemoteConfigStatusFailed means applying remote config failed. RemoteConfigStatusFailed RemoteConfigStatus = 3 )
RemoteConfigStatus constants.
func (RemoteConfigStatus) String ¶ added in v0.1.22
func (s RemoteConfigStatus) String() string
String returns the string representation of the status.
type Server ¶ added in v0.1.22
type Server struct {
// ID is the unique identifier for the server.
ID string
// LastHeartbeatAt is the last time the server sent a heartbeat.
LastHeartbeatAt time.Time
// Conditions is a list of conditions that apply to the server.
Conditions []Condition
}
Server represents a server that an agent communicates with. It contains the server's unique identifier and liveness information.
func (*Server) GetCondition ¶ added in v0.1.24
func (s *Server) GetCondition(conditionType ConditionType) *Condition
GetCondition returns the condition of the specified type.
func (*Server) GetRegisteredAt ¶ added in v0.1.24
GetRegisteredAt returns the time when the server was registered.
func (*Server) GetRegisteredBy ¶ added in v0.1.24
GetRegisteredBy returns the reason/actor who registered the server.
func (*Server) IsAlive ¶ added in v0.1.22
IsAlive returns true if the server is alive based on the heartbeat timeout. A server is considered alive if its last heartbeat was within the timeout period.
func (*Server) IsConditionTrue ¶ added in v0.1.24
func (s *Server) IsConditionTrue(conditionType ConditionType) bool
IsConditionTrue checks if the specified condition type is true.
func (*Server) MarkRegistered ¶ added in v0.1.24
MarkRegistered marks the server as registered.
func (*Server) SetCondition ¶ added in v0.1.24
func (s *Server) SetCondition(conditionType ConditionType, status ConditionStatus, reason, message string)
SetCondition sets or updates a condition in the server's status.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agent provides domain models for the agent
|
Package agent provides domain models for the agent |
|
Package serverevent defines server-to-server event models.
|
Package serverevent defines server-to-server event models. |
|
Package vo provides value objects vo package does not have any dependencies on other packages except the standard library
|
Package vo provides value objects vo package does not have any dependencies on other packages except the standard library |