wwrmi

package
v2.8.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// SysStatsCountThresholdDefault default is 10
	SysStatsCountThresholdDefault = 10
	// SysStatsTimeThresholdDefault default is every minute
	SysStatsTimeThresholdDefault = 60 * 1000
	// SyStatsMaxSysStatsMaxBufferDefault default is 100
	SysStatsMaxBufferDefault = 100
)

Variables

This section is empty.

Functions

func New_logBufferFIFO

func New_logBufferFIFO(maxsize uint32) (ret *logBufferFIFO)

func New_statsFIFO

func New_statsFIFO(maxsize uint32) (ret *statsFIFO)

func TargetCB

func TargetCB(err *greasego.GreaseError, data *greasego.TargetCallbackData)

This is a target callback to assign to the grease subsystem.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is primary connection object for connecting to the RMI API server This is a system wide singleton

func GetMainClient

func GetMainClient(config *ClientConfig) (client *Client, err error)

func NewClient

func NewClient(config *ClientConfig) (ret *Client, err error)

NewClient creates a new client object to the Symphony API server

func (*Client) Read

func (client *Client) Read(p []byte) (copied int, err error)

Read implements the io.Reader interface for a FIFO storing the logBuffer objects

func (*Client) StartWorkers

func (client *Client) StartWorkers() (err error)

StartWorkers starts any IO workers, and will not return until all workers are confirmed as started

func (*Client) StopWorkers

func (client *Client) StopWorkers()

StopWorkers stops any worker routines of the client. The client cane effectively be lost garabage collected afterwards

func (*Client) SubmitLogs

func (client *Client) SubmitLogs(data *greasego.TargetCallbackData, godata []byte) (err error)

func (*Client) Valid

func (client *Client) Valid() bool

type ClientConfig

type ClientConfig struct {
	// The RootCA option should be a PEM encoded root ca chain
	// Use this if the server's TLS certificate is not signed
	// by a certificate authority in the default list. If the
	// server is signed by a certificate authority in the default
	// list it can be omitted.
	RootCA       []byte // will be converted to byte array
	RootCAString string `yaml:"root_ca"`

	// The ServerName is also only required if the root ca chain
	// is not in the default list. This option should be omitted
	// if RootCA is not specified. It should match the common name
	// of the server's certificate.
	ServerName string `yaml:"server_name"`
	// This option can be used in place of the RootCA and ServerName
	// for servers that are not signed by a well known certificate
	// authority. It will skip the authentication for the server. It
	// is not recommended outside of a test environment.
	NoValidate bool `yaml:"no_validate"`
	// This option turns off encryption entirely
	// it is only for testing
	NoTLS bool `yaml:"no_tls"`
	// This is the PEM encoded SSL client certificate. This is required
	// for all https based client connections. It provides the relay identity
	// to the server
	ClientCertificate       []byte
	ClientCertificateString string `yaml:"client_cert"`
	// This is the PEM encoded SSL client private key. This is required
	// for all https based client connections.
	ClientKey       []byte
	ClientKeyString string `yaml:"client_key"`
	// This is the hostname or IP address of the Symphony server
	Host string `yaml:"host"`
	// This is the port of the Symphony server
	Port int `yaml:"port"`
	// UrlLogEndpoint will override the settings of host and port if set
	// for the remote logging endpoints
	// the default is https://[Host]/relay-logs/logs
	UrlLogsEndpoint string `yaml:"url_logs"`
	// UrlStatsEndpoint will override the settings of host and port if set
	// for the remote system stats history
	// the default is https://[Host]/relay-stats/stats_obj
	UrlStatsEndpoint string `yaml:"url_stats"`

	// If this flag is set, client library logging will be printed
	//EnableLogging bool
	// number of buffers to hold. Remember, grease lib also holds its own buffers, so this sould be minimal
	// (optional)
	//NumBuffers uint32 `yaml:"num_buffers"`
	// MaxBuffers is the max number of the said buffers
	MaxBuffers uint32 `yaml:"max_buffers"`
	// If true, then system stats are not sent to Symphony
	DisableSysStats bool `yaml:"disable_sys_stats"`
	// BufferSize is the size of each of these buffers in bytes
	//BufferSize uint32 `yaml:"buffer_size"`
	// SendSizeThreshold is the amount of bytes being held before the
	// worker will start sending
	SendSizeThreshold uint32 `yaml:"send_size_threshold"`
	// SendTimeThreshold is the amount of time in milliseconds before the worker
	// will start sending logs
	SendTimeThreshold uint32 `yaml:"send_time_threshold"`
	// SysStatsCountThreshold is the threshold where we will send stats
	SysStatsCountThreshold uint32 `yaml:"sys_stats_count_threshold"`
	// SysStatsTimeThreshold is the max amount of time which will go by before
	// we will send stats to the API. This is in ms
	SysStatsTimeThreshold uint32 `yaml:"sys_stats_time_threshold"`
	// SysStatsMaxBuffer is the max amount of sys_stats we will hold in memory before dropping
	SysStatsMaxBuffer uint32 `yaml:"sys_stats_max_buffer"`
}

type ClientError

type ClientError struct {
	StatusCode int
	Status     string
}

func (*ClientError) Error

func (err *ClientError) Error() string

Jump to

Keyboard shortcuts

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