Documentation
¶
Index ¶
- Variables
- func SortContainerMetrics(messages []*events.ContainerMetric) []*events.ContainerMetric
- func SortRecent(messages []*events.LogMessage) []*events.LogMessage
- type Consumer
- func (cnsmr *Consumer) Close() error
- func (cnsmr *Consumer) ContainerMetrics(appGuid string, authToken string) ([]*events.ContainerMetric, error)
- func (cnsmr *Consumer) Firehose(subscriptionId string, authToken string, outputChan chan<- *events.Envelope, ...)
- func (cnsmr *Consumer) FirehoseWithoutReconnect(subscriptionId string, authToken string, outputChan chan<- *events.Envelope) error
- func (cnsmr *Consumer) RecentLogs(appGuid string, authToken string) ([]*events.LogMessage, error)
- func (cnsmr *Consumer) SetDebugPrinter(debugPrinter DebugPrinter)
- func (cnsmr *Consumer) SetIdleTimeout(idleTimeout time.Duration)
- func (cnsmr *Consumer) SetOnConnectCallback(cb func())
- func (cnsmr *Consumer) Stream(appGuid string, authToken string, outputChan chan<- *events.Envelope, ...)
- func (cnsmr *Consumer) StreamWithoutReconnect(appGuid string, authToken string, outputChan chan<- *events.Envelope) error
- func (cnsmr *Consumer) TailingLogs(appGuid string, authToken string, outputChan chan<- *events.LogMessage, ...)
- func (cnsmr *Consumer) TailingLogsWithoutReconnect(appGuid string, authToken string, outputChan chan<- *events.LogMessage) error
- type DebugPrinter
- type NullDebugPrinter
Constants ¶
This section is empty.
Variables ¶
var ( // KeepAlive sets the interval between keep-alive messages sent by the client to loggregator. KeepAlive = 25 * time.Second ErrNotOK = errors.New("unknown issue when making HTTP request to Loggregator") ErrNotFound = ErrNotOK // NotFound isn't an accurate description of how this is used; please use ErrNotOK instead ErrBadResponse = errors.New("bad server response") ErrBadRequest = errors.New("bad client request") ErrLostConnection = errors.New("remote server terminated connection unexpectedly") )
Functions ¶
func SortContainerMetrics ¶
func SortContainerMetrics(messages []*events.ContainerMetric) []*events.ContainerMetric
SortContainerMetrics sorts a slice of containerMetrics by InstanceIndex.
The input slice is sorted; the return value is simply a pointer to the same slice.
func SortRecent ¶
func SortRecent(messages []*events.LogMessage) []*events.LogMessage
SortRecent sorts a slice of LogMessages by timestamp. The sort is stable, so messages with the same timestamp are sorted in the order that they are received.
The input slice is sorted; the return value is simply a pointer to the same slice.
Types ¶
type Consumer ¶
noaa.Consumer is deprecated. Use the one in the consumer package.
Consumer represents the actions that can be performed against traffic controller.
func NewConsumer ¶
func NewConsumer(trafficControllerUrl string, tlsConfig *tls.Config, proxy func(*http.Request) (*url.URL, error)) *Consumer
noaa.Consumer is deprecated. Use the one in the consumer package.
NewConsumer creates a new consumer to a traffic controller.
func (*Consumer) Close ¶
noaa.Consumer is deprecated. Use the one in the consumer package.
Close terminates the websocket connection to traffic controller.
func (*Consumer) ContainerMetrics ¶
func (cnsmr *Consumer) ContainerMetrics(appGuid string, authToken string) ([]*events.ContainerMetric, error)
noaa.Consumer is deprecated. Use the one in the consumer package.
ContainerMetrics connects to traffic controller via its 'containermetrics' http(s) endpoint and returns the most recent messages for an app. The returned metrics will be sorted by InstanceIndex.
func (*Consumer) Firehose ¶
func (cnsmr *Consumer) Firehose(subscriptionId string, authToken string, outputChan chan<- *events.Envelope, errorChan chan<- error)
noaa.Consumer is deprecated. Use the one in the consumer package.
Firehose behaves exactly as FirehoseWithoutReconnect, except that it retries 5 times if the connection to the remote server is lost.
func (*Consumer) FirehoseWithoutReconnect ¶
func (cnsmr *Consumer) FirehoseWithoutReconnect(subscriptionId string, authToken string, outputChan chan<- *events.Envelope) error
noaa.Consumer is deprecated. Use the one in the consumer package.
FirehoseWithoutReconnect streams all data. All clients with the same subscriptionId will receive a proportionate share of the message stream. Each pool of clients will receive the entire stream.
If you wish to be able to terminate the listen early, run FirehoseWithoutReconnect in a Goroutine and call Close() when you are finished listening.
Messages are presented in the order received from the loggregator server. Chronological or other ordering is not guaranteed. It is the responsibility of the consumer of these channels to provide any desired sorting mechanism.
func (*Consumer) RecentLogs ¶
noaa.Consumer is deprecated. Use the one in the consumer package.
RecentLogs connects to traffic controller via its 'recentlogs' http(s) endpoint and returns a slice of recent messages. It does not guarantee any order of the messages; they are in the order returned by traffic controller.
The SortRecent method is provided to sort the data returned by this method.
func (*Consumer) SetDebugPrinter ¶
func (cnsmr *Consumer) SetDebugPrinter(debugPrinter DebugPrinter)
noaa.Consumer is deprecated. Use the one in the consumer package.
SetDebugPrinter enables logging of the websocket handshake.
func (*Consumer) SetIdleTimeout ¶
func (*Consumer) SetOnConnectCallback ¶
func (cnsmr *Consumer) SetOnConnectCallback(cb func())
noaa.Consumer is deprecated. Use the one in the consumer package.
SetOnConnectCallback sets a callback function to be called with the websocket connection is established.
func (*Consumer) Stream ¶
func (cnsmr *Consumer) Stream(appGuid string, authToken string, outputChan chan<- *events.Envelope, errorChan chan<- error)
noaa.Consumer is deprecated. Use the one in the consumer package.
Stream behaves exactly as StreamWithoutReconnect, except that it retries 5 times if the connection to the remote server is lost.
func (*Consumer) StreamWithoutReconnect ¶
func (cnsmr *Consumer) StreamWithoutReconnect(appGuid string, authToken string, outputChan chan<- *events.Envelope) error
noaa.Consumer is deprecated. Use the one in the consumer package.
StreamWithoutReconnect listens indefinitely for all log and event messages.
If you wish to be able to terminate the listen early, run StreamWithoutReconnect in a Goroutine and call Close() when you are finished listening.
Messages are presented in the order received from the loggregator server. Chronological or other ordering is not guaranteed. It is the responsibility of the consumer of these channels to provide any desired sorting mechanism.
func (*Consumer) TailingLogs ¶
func (cnsmr *Consumer) TailingLogs(appGuid string, authToken string, outputChan chan<- *events.LogMessage, errorChan chan<- error)
noaa.Consumer is deprecated. Use the one in the consumer package.
TailingLogs behaves exactly as TailingLogsWithoutReconnect, except that it retries 5 times if the connection to the remote server is lost and returns all errors from each attempt on errorChan.
func (*Consumer) TailingLogsWithoutReconnect ¶
func (cnsmr *Consumer) TailingLogsWithoutReconnect(appGuid string, authToken string, outputChan chan<- *events.LogMessage) error
noaa.Consumer is deprecated. Use the one in the consumer package.
TailingLogsWithoutReconnect listens indefinitely for log messages only; other event types are dropped.
If you wish to be able to terminate the listen early, run TailingLogsWithoutReconnect in a Goroutine and call Close() when you are finished listening.
Messages are presented in the order received from the loggregator server. Chronological or other ordering is not guaranteed. It is the responsibility of the consumer of these channels to provide any desired sorting mechanism.
type DebugPrinter ¶
type DebugPrinter interface {
Print(title, dump string)
}
type NullDebugPrinter ¶
type NullDebugPrinter struct { }
func (NullDebugPrinter) Print ¶
func (NullDebugPrinter) Print(title, body string)