observe

package
v0.13.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetHubbleClientFunc = func(ctx context.Context, vp *viper.Viper) (client observerpb.ObserverClient, cleanup func() error, err error) {
	if otherOpts.inputFile != "" {
		var f *os.File
		if otherOpts.inputFile == "-" {

			f = os.Stdin

			cleanup = func() error { return nil }
		} else {

			f, err = os.Open(otherOpts.inputFile)
			if err != nil {
				return nil, nil, err
			}
			cleanup = f.Close
		}
		client = NewIOReaderObserver(f)
		return client, cleanup, nil
	}

	hubbleConn, err := conn.New(ctx, vp.GetString(config.KeyServer), vp.GetDuration(config.KeyTimeout))
	if err != nil {
		return nil, nil, err
	}
	logger.Logger.Debug("connected to Hubble API", "server", config.KeyServer)
	cleanup = hubbleConn.Close
	client = observerpb.NewObserverClient(hubbleConn)
	return client, cleanup, nil
}

GetHubbleClientFunc is primarily used to mock out the hubble client in some unit tests.

Functions

func New

func New(vp *viper.Viper) *cobra.Command

New observer command.

Types

type IOReaderObserver added in v0.12.0

type IOReaderObserver struct {
	// contains filtered or unexported fields
}

IOReaderObserver implements ObserverClient interface. It reads flows in jsonpb format from an io.Reader.

func NewIOReaderObserver added in v0.12.0

func NewIOReaderObserver(reader io.Reader) *IOReaderObserver

NewIOReaderObserver reads flows in jsonpb format from an io.Reader and returns a IOReaderObserver that implements the ObserverClient interface.

func (*IOReaderObserver) GetAgentEvents added in v0.12.0

GetAgentEvents is not implemented, and will throw an error if used.

func (*IOReaderObserver) GetDebugEvents added in v0.12.0

GetDebugEvents is not implemented, and will throw an error if used.

func (*IOReaderObserver) GetFlows added in v0.12.0

GetFlows returns flows

func (*IOReaderObserver) GetNamespaces added in v0.12.0

GetNamespaces is not implemented, and will throw an error if used.

func (*IOReaderObserver) GetNodes added in v0.12.0

GetNodes is not implemented, and will throw an error if used.

func (*IOReaderObserver) ServerStatus added in v0.12.0

ServerStatus is not implemented, and will throw an error if used.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL