cfg

package
v0.0.0-...-1ad34fd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogFile string

LogFile represents log file passed through command line argument.

View Source
var LogFormat = "%Date(2006-01-02T15:04:05Z07:00) [%Level] %Msg%n"

LogFormat defines format for logger.

View Source
var ParameterConfigValue = &ParameterConfig{
	SegmentChannel: struct {
		Std int
	}{
		Std: 250,
	},
	Socket: struct {
		BufferSizeKB int
	}{
		BufferSizeKB: 64,
	},
	ReceiverRoutines: 2,
	Processor: struct {
		BatchSize               int
		IdleTimeoutMillisecond  int
		MaxIdleConnPerHost      int
		RequestTimeout          int
		BatchProcessorQueueSize int
	}{
		BatchSize:               50,
		IdleTimeoutMillisecond:  1000,
		MaxIdleConnPerHost:      8,
		RequestTimeout:          2,
		BatchProcessorQueueSize: 20,
	},
}

ParameterConfigValue returns instance of ParameterConfig, initialized with default values.

View Source
var Version = "unknown"

Version number of the X-Ray daemon.

Functions

func ConfigValidation

func ConfigValidation(configPath string)

ConfigValidation validates provided configuration file, invalid configuration will exit the process.

Types

type Config

type Config struct {
	// Maximum buffer size in MB (minimum 3). Choose 0 to use 1% of host memory.
	TotalBufferSizeMB int `yaml:"TotalBufferSizeMB"`

	// Maximum number of concurrent calls to AWS X-Ray to upload segment documents.
	Concurrency int `yaml:"Concurrency"`

	// X-Ray service endpoint to which the daemon sends segment documents.
	Endpoint string `yaml:"Endpoint"`

	// Send segments to AWS X-Ray service in a specific region.
	Region string `yaml:"Region"`

	Socket struct {
		// Address and port on which the daemon listens for UDP packets containing segment documents.
		UDPAddress string `yaml:"UDPAddress"`
		TCPAddress string `yaml:"TCPAddress"`
	} `yaml:"Socket"`

	ProxyServer struct {
		IdleConnTimeout     int
		MaxIdleConnsPerHost int
		MaxIdleConns        int
	}

	// Structure for logging.
	Logging struct {
		// LogRotation, if true, will rotate log after 50 MB size of current log file.
		LogRotation *bool `yaml:"LogRotation"`
		// The log level, from most verbose to least: dev, debug, info, warn, error, prod (default).
		LogLevel string `yaml:"LogLevel"`
		// Logs to the specified file path.
		LogPath string `yaml:"LogPath"`
	} `yaml:"Logging"`

	// Local mode to skip EC2 instance metadata check.
	LocalMode *bool `yaml:"LocalMode"`

	// Amazon Resource Name (ARN) of the AWS resource running the daemon.
	ResourceARN string `yaml:"ResourceARN"`

	// IAM role to upload segments to a different account.
	RoleARN string `yaml:"RoleARN"`

	// Enable or disable TLS certificate verification.
	NoVerifySSL *bool `yaml:"NoVerifySSL"`

	// Upload segments to AWS X-Ray through a proxy.
	ProxyAddress string `yaml:"ProxyAddress"`

	// Daemon configuration file format version.
	Version int `yaml:"Version"`
}

Config defines configuration structure for cli parameters.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns default configuration for X-Ray daemon.

func LoadConfig

func LoadConfig(configFile string) *Config

LoadConfig returns configuration from a valid configFile else default configuration.

type ParameterConfig

type ParameterConfig struct {
	SegmentChannel struct {
		// Size of trace segments channel.
		Std int
	}

	Socket struct {
		// Socket buffer size.
		BufferSizeKB int
	}

	// Number of go routines daemon.poll() to spawn.
	ReceiverRoutines int

	Processor struct {
		// Size of the batch segments processed by Processor.
		BatchSize int

		// Idle timeout in milliseconds used while sending batch segments.
		IdleTimeoutMillisecond int

		// MaxIdleConnPerHost, controls the maximum idle
		// (keep-alive) HTTP connections to keep per-host.
		MaxIdleConnPerHost int

		// Used to set Http client timeout in seconds.
		RequestTimeout          int
		BatchProcessorQueueSize int
	}
}

ParameterConfig is a configuration used by daemon.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL