Documentation
¶
Index ¶
Constants ¶
const ( PostRemoteTimeout = 20 * time.Second IdleConnsPerHost = 100 DefaultTimeout = time.Second * 20 MetricsPath = "/csemonitor/metric" EnvProjectID = "CSE_PROJECT_ID" )
constant for the cse-collector
const ( //HeaderUserName is a variable of type string HeaderUserName = "x-user-name" HeaderDomainName = "x-domain-name" ContentType = "Content-Type" Name = "monitor" )
constants for header parameters
Variables ¶
var IsMonitoringConnected bool
IsMonitoringConnected is a boolean to keep an check if there exsist any succeful connection to monitoring Server
var (
MetricServerPath = ""
)
variables for cse-collector
Functions ¶
func InitializeCseCollector ¶
func InitializeCseCollector(config *CseCollectorConfig, r metrics.Registry, app, version, service, env string)
InitializeCseCollector starts the CSE collector in a new Thread
func TransportFor ¶
func TransportFor(tlsconfig *tls.Config) http.RoundTripper
TransportFor creates an transport object with TLS information
Types ¶
type CseCollectorConfig ¶
type CseCollectorConfig struct { // CseMonitorAddr is the http address of the csemonitor server CseMonitorAddr string // Headers for csemonitor server Header http.Header // TickInterval spcifies the period that this collector will send metrics to the server. TimeInterval time.Duration // Config structure to configure a TLS client for sending Metric data TLSConfig *tls.Config }
CseCollectorConfig is a struct to keep monitoring information
type CseMonitorClient ¶
type CseMonitorClient struct { Header http.Header URL string Client *httpclient.URLClient }
CseMonitorClient is an object for storing client information
func NewCseMonitorClient ¶
func NewCseMonitorClient(header http.Header, url string, tlsConfig *tls.Config, version string) (*CseMonitorClient, error)
NewCseMonitorClient creates an new client for monitoring
func (*CseMonitorClient) PostMetrics ¶
func (cseMonitorClient *CseMonitorClient) PostMetrics(monitorData MonitorData) (err error)
PostMetrics is a functions which sends the monintoring data to monitoring Server
type InterfaceInfo ¶
type InterfaceInfo struct { Name string `json:"name"` Desc string `json:"desc"` QPS float64 `json:"qps"` Latency int `json:"latency"` L995 int `json:"l995"` L99 int `json:"l99"` L90 int `json:"l90"` L75 int `json:"l75"` L50 int `json:"l50"` L25 int `json:"l25"` L5 int `json:"l5"` Rate float64 `json:"rate"` Total int64 `json:"total"` Failure int64 `json:"failure"` ShortCircuited int64 `json:"shortCircuited"` IsCircuitBreakerOpen bool `json:"circuitBreakerOpen"` SemaphoreRejected int64 `json:"semaphoreRejected"` ThreadPoolRejected int64 `json:"threadPoolRejected"` CountTimeout int64 `json:"countTimeout"` FailureRate float64 `json:"failureRate"` // contains filtered or unexported fields }
InterfaceInfo is an object which store the monitoring information of a particular interface
type MonitorData ¶
type MonitorData struct { AppID string `json:"appId"` Version string `json:"version"` Name string `json:"name"` Environment string `json:"environment"` Instance string `json:"instance"` Thread int `json:"thread"` Customs map[string]interface{} `json:"customs"` // ? Interfaces []*InterfaceInfo `json:"interfaces"` CPU float64 `json:"cpu"` Memory map[string]interface{} `json:"memory"` ServiceID string `json:"serviceId"` InstanceID string `json:"instanceId"` }
MonitorData is an object which stores the monitoring information for an application
func NewMonitorData ¶
func NewMonitorData() *MonitorData
NewMonitorData creates a new monitoring object
type Reporter ¶
type Reporter struct { Registry metrics.Registry CseMonitorAddr string Header http.Header Interval time.Duration Percentiles []float64 TLSConfig *tls.Config // contains filtered or unexported fields }
Reporter is a struct to store the registry address and different monitoring information