Documentation
¶
Overview ¶
Package config implements the configuration for the aggregator..
Index ¶
Constants ¶
View Source
const ( DefaultCZHost = "api.cloudzero.com" DefaultCZSendInterval = 10 * time.Minute DefaultCZSendTimeout = 10 * time.Second DefaultCZRotateInterval = 10 * time.Minute DefaultDatabaseMaxRecords = 1_500_000 DefaultDatabaseCompressionLevel = 8 DefaultDatabaseMaxInterval = 10 * time.Minute DefaultServerPort = 8080 DefaultServerMode = "http" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cloudzero ¶
type Cloudzero struct {
APIKeyPath string `yaml:"api_key_path" env:"API_KEY_PATH" env-description:"path to the API key file"`
RotateInterval time.Duration `yaml:"rotate_interval" default:"10m" env:"ROTATE_INTERVAL" env-description:"interval in hours to rotate API key"`
SendInterval time.Duration `yaml:"send_interval" default:"10m" env:"SEND_INTERVAL" env-description:"interval in seconds to send data"`
SendTimeout time.Duration `yaml:"send_timeout" default:"10s" env:"SEND_TIMEOUT" env-description:"timeout in seconds to send data"`
Host string `yaml:"host" env:"HOST" default:"api.cloudzero.com" env-description:"host to send metrics to"`
UseHTTP bool `yaml:"use_http" env:"USE_HTTP" default:"false" env-description:"use http for client requests instead of https"`
// contains filtered or unexported fields
}
type Database ¶
type Database struct {
StoragePath string `yaml:"storage_path" default:"/cloudzero/data" env:"DATABASE_STORAGE_PATH" env-description:"location where to write database"`
MaxRecords int `yaml:"max_records" default:"1000000" env:"MAX_RECORDS_PER_FILE" env-description:"maximum records per file"`
CompressionLevel int `yaml:"compression_level" default:"8" env:"DATABASE_COMPRESS_LEVEL" env-description:"compression level for database files"`
MaxInterval time.Duration `yaml:"max_interval" default:"10m" env:"MAX_INTERVAL" env-description:"maximum interval to wait before flushing metrics"`
PurgeRules PurgeRules `yaml:"purge_rules"`
}
type Logging ¶
type Logging struct {
Level string `yaml:"level" default:"info" env:"LOG_LEVEL" env-description:"logging level such as debug, info, error"`
}
type Metrics ¶
type Metrics struct {
Cost []filter.FilterEntry `yaml:"cost"`
Observability []filter.FilterEntry `yaml:"observability"`
CostLabels []filter.FilterEntry `yaml:"cost_labels"`
ObservabilityLabels []filter.FilterEntry `yaml:"observability_labels"`
}
type PurgeRules ¶
type Server ¶
type Server struct {
Mode string `yaml:"mode" default:"http" env:"SERVER_MODE" env-description:"server mode such as http, https"`
Port uint `yaml:"port" default:"8080" env:"SERVER_PORT" env-description:"server port"`
Profiling bool `yaml:"profiling" default:"false" env:"SERVER_PROFILING" env-description:"enable profiling"`
}
type Settings ¶
type Settings struct {
// Core Settings
CloudAccountID string `yaml:"cloud_account_id" env:"CLOUD_ACCOUNT_ID" env-description:"CSP account ID"`
Region string `yaml:"region" env:"CSP_REGION" env-description:"cloud service provider region"`
ClusterName string `yaml:"cluster_name" env:"CLUSTER_NAME" env-description:"name of the cluster to monitor"`
Server Server `yaml:"server"`
Logging Logging `yaml:"logging"`
Database Database `yaml:"database"`
Cloudzero Cloudzero `yaml:"cloudzero"`
Metrics Metrics `yaml:"metrics"`
// contains filtered or unexported fields
}
func NewSettings ¶
func (*Settings) GetRemoteAPIBase ¶
GetRemoteAPIBase sanitizes the input host from the config, and returns a standard `url.URL` type to build the query from
func (*Settings) SetRemoteUploadAPI ¶
Click to show internal directories.
Click to hide internal directories.