Documentation
¶
Overview ¶
Package agent runs readers, writers, and HTTP server.
Index ¶
- type Agent
- func (a *Agent) AuthorizeMiddleware(next http.Handler) http.Handler
- func (a *Agent) DefaultLogrusFieldsForHTTP() logrus.Fields
- func (a *Agent) FlushStatsDMetricsToResultDB(statsInterval time.Duration)
- func (a *Agent) GetByPathHandler(dataType string) http.Handler
- func (a *Agent) GetDataTypePathsHandler() http.Handler
- func (a *Agent) GetExecutorsHandler() http.Handler
- func (a *Agent) GetLogPathsHandler() http.Handler
- func (a *Agent) GetLogsHandler() http.Handler
- func (a *Agent) GetPathsHandler() http.Handler
- func (a *Agent) GetReadersHandler() http.Handler
- func (a *Agent) GetRunByPath(path string) ([]byte, error)
- func (a *Agent) GetWritersHandler() http.Handler
- func (a *Agent) HandleGraphite(dataInBytes []byte)
- func (a *Agent) HandleLog(dataInBytes []byte)
- func (a *Agent) HandleStatsD(dataInBytes []byte)
- func (a *Agent) HeadRootHandler() http.Handler
- func (a *Agent) HttpRouter() *mux.Router
- func (a *Agent) IsAllowed(givenToken string) bool
- func (a *Agent) NewMetricsRegistryForSelf() metrics.Registry
- func (a *Agent) NewTCPClient(addr string) (*net.TCPConn, error)
- func (a *Agent) NewTCPServer(config resourced_config.ITCPServer, name string) (net.Listener, error)
- func (a *Agent) NewUDPServer(config resourced_config.ITCPServer, name string) (*net.UDPConn, error)
- func (a *Agent) Run(config resourced_config.Config) (output []byte, err error)
- func (a *Agent) RunAllForever()
- func (a *Agent) RunExecutorForever(config resourced_config.Config)
- func (a *Agent) RunForever(config resourced_config.Config)
- func (a *Agent) RunLoggerForever(config resourced_config.Config)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { ID string Tags map[string]string AccessTokens []string Configs *resourced_config.Configs GeneralConfig resourced_config.GeneralConfig DbPath string StatsDMetrics metrics.Registry ResultDB *gocache.Cache ExecutorCounterDB *libmap.TSafeMapCounter LiveLogPubSub *pubsub.PubSub LiveLogSubscribers map[string]chan interface{} }
Agent struct carries most of the functionality of ResourceD. It collects information through readers and serve them up as HTTP+JSON.
func (*Agent) AuthorizeMiddleware ¶
AuthorizeMiddleware wraps all other handlers; returns 403 for clients that aren't authorized to connect.
func (*Agent) DefaultLogrusFieldsForHTTP ¶
func (*Agent) FlushStatsDMetricsToResultDB ¶
func (*Agent) GetByPathHandler ¶
GetByPathHandler returns data by a specific path.
func (*Agent) GetDataTypePathsHandler ¶
GetDataTypePathsHandler returns path to all data by type.
func (*Agent) GetExecutorsHandler ¶
GetExecutorsHandler returns all executors data stored in memory.
func (*Agent) GetLogPathsHandler ¶
GetLogPathsHandler returns all log paths.
func (*Agent) GetLogsHandler ¶
GetLogsHandler returns all logs data stored in memory.
func (*Agent) GetPathsHandler ¶
GetPathsHandler returns paths to all data.
func (*Agent) GetReadersHandler ¶
GetReadersHandler returns all readers data stored in memory.
func (*Agent) GetRunByPath ¶
GetRunByPath returns JSON data stored in local storage given path string.
func (*Agent) GetWritersHandler ¶
GetWritersHandler returns all writers data stored in memory.
func (*Agent) HandleGraphite ¶
func (*Agent) HandleStatsD ¶
func (*Agent) HeadRootHandler ¶
HeadRootHandler returns empty body. This is useful for curl -I.
func (*Agent) NewMetricsRegistryForSelf ¶
func (a *Agent) NewMetricsRegistryForSelf() metrics.Registry
func (*Agent) NewTCPClient ¶
NewTCPClient creates a TCP connection.
func (*Agent) NewTCPServer ¶
func (a *Agent) NewTCPServer(config resourced_config.ITCPServer, name string) (net.Listener, error)
NewTCPServer creates a TCP server.
func (*Agent) NewUDPServer ¶
func (a *Agent) NewUDPServer(config resourced_config.ITCPServer, name string) (*net.UDPConn, error)
NewUDPServer creates a UDP server.
func (*Agent) Run ¶
func (a *Agent) Run(config resourced_config.Config) (output []byte, err error)
Run executes a reader/writer/executor/log config.
func (*Agent) RunAllForever ¶
func (a *Agent) RunAllForever()
RunAllForever runs everything in an infinite loop.
func (*Agent) RunExecutorForever ¶
func (a *Agent) RunExecutorForever(config resourced_config.Config)
RunExecutorForever in an infinite loop with a sleep of config.Interval.
func (*Agent) RunForever ¶
func (a *Agent) RunForever(config resourced_config.Config)
RunForever executes Run() in an infinite loop with a sleep of config.Interval.
func (*Agent) RunLoggerForever ¶
func (a *Agent) RunLoggerForever(config resourced_config.Config)