luci: Index | Files | Directories

package output

import ""

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.


Package Files

doc.go output.go record.go

type EntryRecord Uses

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 Uses

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 Uses

func (o *EntryTracker) Record() *EntryRecord

Record exports a snapshot of the current tracking state.

func (*EntryTracker) Track Uses

func (o *EntryTracker) Track(b *logpb.ButlerLogBundle)

Track adds the log entries contained in the supplied bundle to the record.

type Output Uses

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 is 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.

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 Range Uses

type Range struct {
    Start uint64
    End   uint64

Range marks an inclusive log entry index range [Start-End].

func (*Range) String Uses

func (sr *Range) String() string

type Stats Uses

type Stats interface {

    // 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 Uses

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 Uses

func (s *StatsBase) DiscardedMessages() int64

DiscardedMessages implements Stats.

func (*StatsBase) Errors Uses

func (s *StatsBase) Errors() int64

Errors implements Stats.

func (*StatsBase) Merge Uses

func (s *StatsBase) Merge(o Stats)

Merge merges the values from one Stats block into another.

func (*StatsBase) SentBytes Uses

func (s *StatsBase) SentBytes() int64

SentBytes implements Stats.

func (*StatsBase) SentMessages Uses

func (s *StatsBase) SentMessages() int64

SentMessages implements Stats.

func (*StatsBase) String Uses

func (s *StatsBase) String() string

type StreamEntryRecord Uses

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.


logPackage log implements the "log" Output.
pubsubPackage pubsub implements the "pubsub" Output.

Package output imports 6 packages (graph) and is imported by 17 packages. Updated 2019-08-24. Refresh now. Tools for package owners.