Documentation ¶
Overview ¶
Package opamp contains configurations and protocol implementations to handle OpAmp communication.
Package opamp contains configurations and protocol implementations to handle OpAmp communication.
Index ¶
- Constants
- func ComputeHash(data []byte) []byte
- func DetermineContentType(filePath string) string
- func NoopReloadFunc([]byte) (bool, error)
- func StringKeyValue(key, value string) *protobufs.KeyValue
- func Version() string
- type Client
- type Config
- type ConfigManager
- type DownloadableFileManager
- type ManagedConfig
- type ReloadFunc
- type TLSConfig
Constants ¶
const ( // YAMLContentType content type for .yml or .yaml file YAMLContentType = "text/yaml" // JSONContentType content type for .json file JSONContentType = "text/json" )
Variables ¶
This section is empty.
Functions ¶
func ComputeHash ¶
ComputeHash computes a sha256 hash of the passed in data
func DetermineContentType ¶
DetermineContentType looks at the file extension for the given filepath and returns the content type
func NoopReloadFunc ¶
NoopReloadFunc used as a noop reload function if unsure of how to reload
func StringKeyValue ¶
StringKeyValue converts a string key-value pair into a protobuf.KeyValue struct
Types ¶
type Client ¶
type Client interface { // Connect initiates a connection to the OpAmp server based on the supplied configuration Connect(ctx context.Context) error // Disconnect disconnects from the server Disconnect(ctx context.Context) error }
Client implements a connection with OpAmp enabled server
type Config ¶
type Config struct { Endpoint string `yaml:"endpoint"` SecretKey *string `yaml:"secret_key,omitempty"` AgentID string `yaml:"agent_id"` TLS *TLSConfig `yaml:"tls_config,omitempty"` // Updatable fields Labels *string `yaml:"labels,omitempty"` AgentName *string `yaml:"agent_name,omitempty"` }
Config contains the configuration for the collector to communicate with an OpAmp enabled platform.
func ParseConfig ¶
ParseConfig given a configuration file location will parse the config
func (Config) CmpUpdatableFields ¶
CmpUpdatableFields compares updatable fields for equality
func (Config) GetSecretKey ¶
GetSecretKey returns secret key if set else returns empty string
type ConfigManager ¶
type ConfigManager interface { // AddConfig adds a config to be tracked by the config manager with it's corresponding validator function. AddConfig(configName string, reloader *ManagedConfig) // ComposeEffectiveConfig reads in all config files and calculates the effective config ComposeEffectiveConfig() (*protobufs.EffectiveConfig, error) // ApplyConfigChanges compares the remoteConfig to the existing and applies changes. // Calculates new effective config ApplyConfigChanges(remoteConfig *protobufs.AgentRemoteConfig) (changed bool, err error) }
ConfigManager handles remote configuration of local configs
type DownloadableFileManager ¶
type DownloadableFileManager interface { // FetchAndExtractArchive fetches the archive at the specified URL. // It then checks to see if it matches the expected sha256 sum of the file. // If it matches, the archive is extracted. // If the archive cannot be extracted, downloaded, or verified, then an error is returned. FetchAndExtractArchive(*protobufs.DownloadableFile) error // CleanupArtifacts removes temporary artifacts from previous download/installs CleanupArtifacts() }
DownloadableFileManager handles DownloadableFile's from a PackagesAvailable message
type ManagedConfig ¶
type ManagedConfig struct { // ConfigPath is the path on disk where the configuration lives ConfigPath string // Reload will be called when any changes to this config occur. Reload ReloadFunc // contains filtered or unexported fields }
ManagedConfig is a structure that can manage an on disk config file
func NewManagedConfig ¶
func NewManagedConfig(configPath string, reload ReloadFunc, required bool) (*ManagedConfig, error)
NewManagedConfig creates a new Managed config and computes its hash
func (*ManagedConfig) ComputeConfigHash ¶
func (m *ManagedConfig) ComputeConfigHash() error
ComputeConfigHash reads in the config file, computes the hash for the contents, and saves it on the ManagedConfig.
func (*ManagedConfig) GetCurrentConfigHash ¶
func (m *ManagedConfig) GetCurrentConfigHash() []byte
GetCurrentConfigHash retrieves the current config hash
type ReloadFunc ¶
ReloadFunc is a function that handles reloading a config given the new contents Reload function should return true for changed is the in memory or on disk copy of the config was changed in any way. If neither was altered the changed return value should be false.