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 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
    
    	// MaxSendBundles is the number of concurrent calls to SendBundle allowed.
    	//
    	// If <= 0, only one SendBundle will be called at a time.
    	MaxSendBundles() int
    
    	// URLConstructionEnv should return a bootstrap.Environment containing
    	// any fields necessary for clients to construct a URL pointing to where this
    	// Output is sending its data.
    	//
    	// Returning an empty Environment means that clients will not be able to
    	// construct URLs to this data (which may be accurate, depending on the
    	// Output implementation).
    	//
    	// StreamServerURI is ignored and should not be specified.
    	//
    	// NOTE: This is an awful encapsulation violation. We should change the butler
    	// protocol so that opening a new stream has the butler immediately reply with
    	// the externally-visible URL to the stream and stop exporting these envvars
    	// entirely.
    	URLConstructionEnv() bootstrap.Environment
    
    	// 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
    
    	// 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

          func (s *StatsBase) DiscardedMessages() int64

            DiscardedMessages implements Stats.

            func (*StatsBase) Errors

            func (s *StatsBase) Errors() int64

              Errors implements Stats.

              func (*StatsBase) Merge

              func (s *StatsBase) Merge(o Stats)

                Merge merges the values from one Stats block into another.

                func (*StatsBase) SentBytes

                func (s *StatsBase) SentBytes() int64

                  SentBytes implements Stats.

                  func (*StatsBase) SentMessages

                  func (s *StatsBase) SentMessages() int64

                    SentMessages implements Stats.

                    func (*StatsBase) String

                    func (s *StatsBase) String() string

                    Source Files

                    Directories

                    Path Synopsis
                    Package log implements the "log" Output.
                    Package log implements the "log" Output.
                    Package logdog implements output to a Logdog server via PubSub.
                    Package logdog implements output to a Logdog server via PubSub.