Documentation
¶
Overview ¶
Package configuration provides configuration reading capabilities.
Index ¶
- Constants
- Variables
- func ConfigFromFile(path string, read ReadConfigFile) (*cpb.Configuration, error)
- func EnsureConfigExists() error
- func Load(path string, read ReadConfigFile, cloudProps *cpb.CloudProperties) (*cpb.Configuration, error)
- func LogLevelToZapcore(level cpb.Configuration_LogLevel) zapcore.Level
- type MkdirAll
- type ReadConfigFile
- type StatFile
- type WriteConfigFile
Constants ¶
View Source
const ( // AgentName is a short-hand name of the agent. AgentName = `workloadagent` // AgentVersion is the version of the agent. AgentVersion = `1.2` // LinuxConfigPath is the default path to agent configuration file on linux. LinuxConfigPath = `/etc/google-cloud-workload-agent/configuration.json` // WindowsConfigPath is the default path to agent configuration file on linux. WindowsConfigPath = `C:\Program Files\Google\google-cloud-workload-agent\conf\configuration.json` // DefaultOracleDiscoveryFrequency is the default frequency for Oracle discovery. DefaultOracleDiscoveryFrequency = time.Hour // DefaultOracleMetricsFrequency is the default frequency for Oracle metrics collection. DefaultOracleMetricsFrequency = time.Minute // DefaultOracleMetricsMaxThreads is the default maximum number of threads for Oracle metrics collection. DefaultOracleMetricsMaxThreads = 10 // DefaultOracleMetricsQueryTimeout is the default timeout for Oracle metrics queries. DefaultOracleMetricsQueryTimeout = 10 * time.Second // DefaultSQLServerCollectionTimeout is the default timeout for SQL Server Configuration. DefaultSQLServerCollectionTimeout = 10 * time.Second // DefaultSQLServerMaxRetries is the default maximum number of retries for SQL Server Configuration. DefaultSQLServerMaxRetries = 3 // DefaultSQLServerRetryFrequency is the default frequency for retrying SQL Server Configuration. DefaultSQLServerRetryFrequency = time.Hour // DefaultSQLServerCollectionFrequency is the default frequency for SQL Server collection. DefaultSQLServerCollectionFrequency = time.Hour // DefaultSQLServerDBCenterMetricsCollectionFrequency is the default frequency for SQL Server DB Center metrics collection DefaultSQLServerDBCenterMetricsCollectionFrequency = 1 * time.Hour // DefaultRedisPort is the default port for Redis. DefaultRedisPort = 6379 )
Variables ¶
View Source
var ( // AgentBuildChange is the change number that the agent was built at // this will be replaced using "-X github.com/GoogleCloudPlatform/workloadagent/internal/configuration.AgentBuildChange=$CLNUMBER" by the build process AgentBuildChange = `0` )
Functions ¶
func ConfigFromFile ¶
func ConfigFromFile(path string, read ReadConfigFile) (*cpb.Configuration, error)
ConfigFromFile returns the configuration from the given file path.
func EnsureConfigExists ¶
func EnsureConfigExists() error
EnsureConfigExists ensures that the configuration file exists. If the file does not exist, it creates the file and its parent directories.
func Load ¶
func Load(path string, read ReadConfigFile, cloudProps *cpb.CloudProperties) (*cpb.Configuration, error)
Load loads the configuration from a JSON file and applies defaults for missing fields.
func LogLevelToZapcore ¶
func LogLevelToZapcore(level cpb.Configuration_LogLevel) zapcore.Level
LogLevelToZapcore returns the zapcore equivalent of the configuration log level.
Types ¶
type ReadConfigFile ¶
ReadConfigFile abstracts os.ReadFile function for testability.
Click to show internal directories.
Click to hide internal directories.