Documentation
¶
Index ¶
- Constants
- func CalcRemoteConfigHash(remoteConfig *protobufs.AgentConfigMap) []byte
- type ConnectionInfo
- type ConnectionsCache
- func (c *ConnectionsCache) AddConnection(instanceUid string, conn *ConnectionInfo)
- func (c *ConnectionsCache) CleanupStaleConnections() []ConnectionInfo
- func (c *ConnectionsCache) GetConnection(instanceUid string) (*ConnectionInfo, bool)
- func (c *ConnectionsCache) RecordMessageTime(instanceUid string)
- func (c *ConnectionsCache) RemoveConnection(instanceUid string)
- func (c *ConnectionsCache) RemoveMatchingConnections(podName string, pid int64)
- func (c *ConnectionsCache) UpdateAllConnectionConfigs(connConfigEvaluator func(connInfo *ConnectionInfo) *protobufs.AgentConfigMap)
- func (c *ConnectionsCache) UpdateWorkloadRemoteConfig(workload k8sconsts.PodWorkload, sdkConfig *v1alpha1.SdkConfig) error
Constants ¶
const (
HeartbeatInterval = 30 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func CalcRemoteConfigHash ¶
func CalcRemoteConfigHash(remoteConfig *protobufs.AgentConfigMap) []byte
Types ¶
type ConnectionInfo ¶
type ConnectionInfo struct { Workload k8sconsts.PodWorkload Pod *corev1.Pod ContainerName string Pid int64 InstrumentedAppName string LastMessageTime time.Time ProgrammingLanguage string // config related fields // AgentRemoteConfig is the full remote config opamp message to send to the agent when needed AgentRemoteConfig *protobufs.AgentRemoteConfig RemoteResourceAttributes []configresolvers.ResourceAttribute }
type ConnectionsCache ¶
type ConnectionsCache struct {
// contains filtered or unexported fields
}
Keep all live connections, with information about the connection. The cache is cleaned up periodically to expire opamp clients that are no longer connected reporting data.
func NewConnectionsCache ¶
func NewConnectionsCache() *ConnectionsCache
func (*ConnectionsCache) AddConnection ¶
func (c *ConnectionsCache) AddConnection(instanceUid string, conn *ConnectionInfo)
func (*ConnectionsCache) CleanupStaleConnections ¶
func (c *ConnectionsCache) CleanupStaleConnections() []ConnectionInfo
func (*ConnectionsCache) GetConnection ¶
func (c *ConnectionsCache) GetConnection(instanceUid string) (*ConnectionInfo, bool)
GetConnection returns the connection information for the given OpAMP instanceUid. the returned object is a by-value copy of the connection information, so it can be safely used. To change something in the connection information, use the functions below which are synced and safe.
func (*ConnectionsCache) RecordMessageTime ¶
func (c *ConnectionsCache) RecordMessageTime(instanceUid string)
func (*ConnectionsCache) RemoveConnection ¶
func (c *ConnectionsCache) RemoveConnection(instanceUid string)
func (*ConnectionsCache) RemoveMatchingConnections ¶ added in v1.0.132
func (c *ConnectionsCache) RemoveMatchingConnections(podName string, pid int64)
RemoveMatchingConnections removes all connections that match the given podName and pid. This ensures that outdated connections are cleaned up, such as when a new process is spawned within the same pod (e.g., using os.execl in Python).
func (*ConnectionsCache) UpdateAllConnectionConfigs ¶
func (c *ConnectionsCache) UpdateAllConnectionConfigs(connConfigEvaluator func(connInfo *ConnectionInfo) *protobufs.AgentConfigMap)
how to use this function: it allows you to update remote config keys which will be sent to the agent on next heartbeat. should be used to update general odigos pipeline configs that are shared by all connections. for example: updating the enabled signals configuration. pass it a callback, that will be called for each connection, and should return the new config entries for that connection. entries that are not specified in the returned map will retain their previous value. each key should be updated entirely when specified, partial updates are not supported. the callback should be fast and not block, as it will be called for each connection with the lock held.
func (*ConnectionsCache) UpdateWorkloadRemoteConfig ¶ added in v1.0.99
func (c *ConnectionsCache) UpdateWorkloadRemoteConfig(workload k8sconsts.PodWorkload, sdkConfig *v1alpha1.SdkConfig) error
allow to completely overwrite the remote config for a set of keys for a given workload