client

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Hostname string `json:"hostname"`
	Port     int    `json:"port"`
	UseTLS   bool
}

Endpoint is all the information needed to connect and communicate with a swoll-server probe.

func NewEndpoint

func NewEndpoint(host string, port int, useTLS bool) *Endpoint

NewEndpoint creates a new endpoint context for creating, reading, and modifying jobs.

func (*Endpoint) AllJobs

func (ep *Endpoint) AllJobs() ([]*v1alpha1.Trace, error)

AllJobs returns a list of all running and completed jobs as one big array

func (*Endpoint) CompletedJobs

func (ep *Endpoint) CompletedJobs() ([]*v1alpha1.Trace, error)

CompletedJobs returns a list of completed jobs on the endpoint

func (*Endpoint) CreateTrace

func (ep *Endpoint) CreateTrace(ctx context.Context, id, ns string, spec *v1alpha1.TraceSpec) (*v1alpha1.Trace, error)

CreateTrace will attempt to create a job of `spec` format. If the `id` is specified, it will use this string to denote the identity of the job and not a randomly-generated one.

func (*Endpoint) DeleteTraceJob

func (ep *Endpoint) DeleteTraceJob(ctx context.Context, id string) error

DeleteTraceJob will delete the job `id` from the running jobs list

func (*Endpoint) ReadTrace

func (ep *Endpoint) ReadTrace(ctx context.Context, ns, pod, container string, ch chan *StreamMessage) error

ReadTrace will connect to an already-running job, but allows a user to specify which specific parts to view. For example, if a currently-running job "app=nginx" matches the NS "swoll", POD "pod-A" and the container "container-B", then this can be called ReadTrace(ctx, "swoll", "pod-A", "container-B", ....) to obtain a subset of the stream.

func (*Endpoint) ReadTraceJob

func (ep *Endpoint) ReadTraceJob(ctx context.Context, id string, ch chan *StreamMessage) error

ReadTraceJob will read events from the output of a job

func (*Endpoint) RunningJobs

func (ep *Endpoint) RunningJobs() ([]*v1alpha1.Trace, error)

RunningJobs will return a list of running jobs on the endpoint.

func (*Endpoint) URL

func (ep *Endpoint) URL(path string, wsock bool) *url.URL

URL generates a properly formatted URL which is used to connect to the given endpoint.

type StreamMessage

type StreamMessage struct {
	Ep   *Endpoint         `json:"endpoint"`
	Data *event.TraceEvent `json:"payload"`
}

StreamMessage will pack a TraceEvent along with the originating Endpoint so we can correlate where events were sourced.

Jump to

Keyboard shortcuts

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