Documentation ¶
Overview ¶
Package output contains interfaces and implementations for Butler Outputs, which are responsible for delivering Butler protobufs to LogDog collection endpoints.
Output instance implementations must be goroutine-safe. The Butler may elect to output multiple messages at the same time.
The package current provides the following implementations:
- pubsub: Write logs to Google Cloud Pub/Sub.
- log: (Debug/testing) data is dumped to the installed Logger instance.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntryRecord ¶
type EntryRecord struct { // Streams is a map of a given stream to its record. Streams map[types.StreamPath]*StreamEntryRecord }
EntryRecord is a record of which log entries have been sent for a given stream.
type EntryTracker ¶
type EntryTracker struct {
// contains filtered or unexported fields
}
EntryTracker tracks individual which log entries have been sent for any given log entry stream.
func (*EntryTracker) Record ¶
func (o *EntryTracker) Record() *EntryRecord
Record exports a snapshot of the current tracking state.
func (*EntryTracker) Track ¶
func (o *EntryTracker) Track(b *logpb.ButlerLogBundle)
Track adds the log entries contained in the supplied bundle to the record.
type Output ¶
type Output interface { // SendBundle sends a constructed ButlerLogBundle through the Output. // // If an error is returned, it indicates a failure to send the bundle. // If there is a data error or a message type is not supported by the // Output, it should log the error and return nil. SendBundle(*logpb.ButlerLogBundle) error // MaxSize returns the maximum number of bytes that this Output can process // with a single send. A return value <=0 indicates that there si no fixed // maximum size for this Output. // // Since it is impossible for callers to know the actual size of the message // that is being submitted, and since message batching may cluster across // size boundaries, this should be a conservative estimate. MaxSize() int // Collect current Output stats. Stats() Stats // Record returns the detailed stream record for an Output. This may return // nil if the Output is not configured to keep a stream record. Record() *EntryRecord // Close closes the Output, blocking until any buffered actions are flushed. Close() }
Output is a sink endpoint for groups of messages.
An Output's methods must be goroutine-safe.
Note that there is no guarantee that any of the bundles passed through an Output are ordered.
type Stats ¶
type Stats interface { fmt.Stringer // SentBytes returns the number of bytes SentBytes() int64 // SentMessages returns the number of successfully transmitted messages. SentMessages() int64 // DiscardedMessages returns the number of discarded messages. DiscardedMessages() int64 // Errors returns the number of errors encountered during operation. Errors() int64 }
Stats is an interface to query Output statistics.
An Output's ability to keep statistics varies with its implementation details. Currently, Stats are for debugging/information purposes only.
type StatsBase ¶
type StatsBase struct { F struct { SentBytes int64 // The number of bytes sent. SentMessages int64 // The number of messages sent. DiscardedMessages int64 // The number of messages that have been discarded. Errors int64 // The number of errors encountered. } }
StatsBase is a simple implementation of the Stats interface.
func (*StatsBase) DiscardedMessages ¶
DiscardedMessages implements Stats.
func (*StatsBase) SentMessages ¶
SentMessages implements Stats.
type StreamEntryRecord ¶
type StreamEntryRecord struct { // Ranges is the sorted set of Range observed for this stream. Ranges []Range }
StreamEntryRecord tracks an individual range of indices from the same stream.