sensor

package
v0.4.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2018 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main()

Main is the main entrypoint for the sensor

Types

type MetricsCounters

type MetricsCounters struct {
	// Number of events created during the sample period
	Events uint64

	// Number of subscriptions
	Subscriptions int32
}

MetricsCounters is used for tracking metrics information in the sensor

type ProcessInfoCache

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

ProcessInfoCache is an object that caches process information. It is maintained automatically via an existing sensor object.

func NewProcessInfoCache

func NewProcessInfoCache(sensor *Sensor) ProcessInfoCache

NewProcessInfoCache creates a new process information cache object. An existing sensor object is required in order for the process info cache to able to install its probes to monitor the system to maintain the cache.

func (*ProcessInfoCache) ProcessCommandLine

func (pc *ProcessInfoCache) ProcessCommandLine(pid int) ([]string, bool)

ProcessCommandLine returns the command-line for a process. The command-line is constructed from argv passed to execve(), but is limited to a fixed number of elements of argv; therefore, it may not be complete.

func (*ProcessInfoCache) ProcessContainerID

func (pc *ProcessInfoCache) ProcessContainerID(pid int) (string, bool)

ProcessContainerID returns the container ID that the process indicated by the given host PID.

func (*ProcessInfoCache) ProcessID

func (pc *ProcessInfoCache) ProcessID(pid int) (string, bool)

ProcessID returns the unique ID for the thread group of the process indicated by the given PID. This process ID is identical whether it is derived inside or outside a container.

type Sensor

type Sensor struct {
	// Unique Id for this sensor. Sensor Ids are ephemeral.
	ID string

	// Metrics counters for this sensor
	Metrics MetricsCounters
	// contains filtered or unexported fields
}

Sensor represents the state of a sensor instance.

func NewSensor

func NewSensor() (*Sensor, error)

NewSensor creates a new Sensor instance.

func (*Sensor) NewEvent

func (s *Sensor) NewEvent() *api.TelemetryEvent

NewEvent creates a new API Event instance with common sensor-specific fields correctly populated.

func (*Sensor) NewEventFromContainer

func (s *Sensor) NewEventFromContainer(containerID string) *api.TelemetryEvent

NewEventFromContainer creates a new API Event instance using a specific container ID.

func (*Sensor) NewEventFromSample

func (s *Sensor) NewEventFromSample(sample *perf.SampleRecord,
	data perf.TraceEventSampleData) *api.TelemetryEvent

NewEventFromSample creates a new API Event instance using perf_event sample information.

func (*Sensor) NewSubscription

func (s *Sensor) NewSubscription(sub *api.Subscription) (*stream.Stream, error)

NewSubscription creates a new telemetry subscription from the given api.Subscription descriptor. NewSubscription returns a stream.Stream of api.Events matching the specified filters. Closing the Stream cancels the subscription.

func (*Sensor) Start

func (s *Sensor) Start() error

Start starts a sensor instance running.

func (*Sensor) Stop

func (s *Sensor) Stop()

Stop stops a running sensor instance.

type TelemetryService

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

TelemetryService is a service that can be used with the ServiceManager to process telemetry subscription requests and stream the resulting telemetry events.

func NewTelemetryService

func NewTelemetryService(sensor *Sensor, address string) *TelemetryService

NewTelemetryService creates a new TelemetryService instance that can be used with a ServiceManager instance.

func (*TelemetryService) Name

func (ts *TelemetryService) Name() string

Name returns the human-readable name of the TelemetryService.

func (*TelemetryService) Serve

func (ts *TelemetryService) Serve() error

Serve is the main entrypoint for the TelemetryService. It is normally called by the ServiceManager. It will service requests indefinitely from the calling Goroutine.

func (*TelemetryService) Stop

func (ts *TelemetryService) Stop()

Stop will stop a running TelemetryService.

Jump to

Keyboard shortcuts

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