Documentation ¶
Index ¶
- Constants
- func AppName() string
- func AppType() int32
- func GetDefaultLogDir() string
- func InitConfig(configPath string) error
- func InitializeLogConfig(logDir string, usePid bool) (err error)
- func LoadFromYamlFile(filePath string) error
- func LogBaseDir() string
- func LogUsePid() bool
- func MetricLogFlushIntervalSec() uint32
- func MetricLogMaxFileAmount() uint32
- func MetricLogSingleFileMaxSize() uint64
- func SystemStatCollectIntervalMs() uint32
- func UseCacheTime() bool
- type Entity
- type LogConfig
- type MetricLogConfig
- type SentinelConfig
- type StatConfig
- type SystemStatConfig
Constants ¶
View Source
const ( // UnknownProjectName represents the "default" value // that indicates the project name is absent. UnknownProjectName = "unknown_go_service" ConfFilePathEnvKey = "SENTINEL_CONFIG_FILE_PATH" AppNameEnvKey = "SENTINEL_APP_NAME" AppTypeEnvKey = "SENTINEL_APP_TYPE" LogDirEnvKey = "SENTINEL_LOG_DIR" LogNamePidEnvKey = "SENTINEL_LOG_USE_PID" DefaultConfigFilename = "sentinel.yml" DefaultAppType int32 = 0 DefaultMetricLogFlushIntervalSec uint32 = 1 DefaultMetricLogSingleFileMaxSize uint64 = 1024 * 1024 * 50 DefaultMetricLogMaxFileAmount uint32 = 8 DefaultSystemStatCollectIntervalMs uint32 = 1000 )
Variables ¶
This section is empty.
Functions ¶
func GetDefaultLogDir ¶
func GetDefaultLogDir() string
func InitConfig ¶
InitConfig loads general configuration from the given file.
func InitializeLogConfig ¶
func LoadFromYamlFile ¶
func LogBaseDir ¶
func LogBaseDir() string
func LogUsePid ¶
func LogUsePid() bool
LogUsePid returns whether the log file name contains the PID suffix.
func MetricLogFlushIntervalSec ¶
func MetricLogFlushIntervalSec() uint32
func MetricLogMaxFileAmount ¶
func MetricLogMaxFileAmount() uint32
func MetricLogSingleFileMaxSize ¶
func MetricLogSingleFileMaxSize() uint64
func SystemStatCollectIntervalMs ¶
func SystemStatCollectIntervalMs() uint32
func UseCacheTime ¶ added in v0.4.0
func UseCacheTime() bool
Types ¶
type Entity ¶
type Entity struct { // Version represents the format version of the entity. Version string Sentinel SentinelConfig }
func NewDefaultConfig ¶
func NewDefaultConfig() *Entity
NewDefaultConfig creates a new default config entity.
type LogConfig ¶
type LogConfig struct { // Dir represents the log directory path. Dir string // UsePid indicates whether the filename ends with the process ID (PID). UsePid bool `yaml:"usePid"` // Metric represents the configuration items of the metric log. Metric MetricLogConfig }
LogConfig represent the configuration of logging in Sentinel.
type MetricLogConfig ¶
type MetricLogConfig struct { SingleFileMaxSize uint64 `yaml:"singleFileMaxSize"` MaxFileCount uint32 `yaml:"maxFileCount"` FlushIntervalSec uint32 `yaml:"flushIntervalSec"` }
MetricLogConfig represents the configuration items of the metric log.
type SentinelConfig ¶
type SentinelConfig struct { App struct { // Name represents the name of current running service. Name string // Type indicates the classification of the service (e.g. web service, API gateway). Type int32 } // Log represents configuration items related to logging. Log LogConfig // Stat represents configuration items related to statistics. Stat StatConfig // UseCacheTime indicates whether to cache time(ms) UseCacheTime bool `yaml:"useCacheTime"` }
SentinelConfig represent the general configuration of Sentinel.
type StatConfig ¶
type StatConfig struct {
System SystemStatConfig `yaml:"system"`
}
StatConfig represents the configuration items of statistics.
type SystemStatConfig ¶
type SystemStatConfig struct { // CollectIntervalMs represents the collecting interval of the system metrics collector. CollectIntervalMs uint32 `yaml:"collectIntervalMs"` }
SystemStatConfig represents the configuration items of system statistics.
Click to show internal directories.
Click to hide internal directories.