intake

package
Version: v0.0.0-...-7129faf Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2021 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IntakeEndpointV1 = "/intake/"

	SeriesEndpointV1       = "/api/v1/series"
	CheckRunsEndpointV1    = "/api/v1/check_run"
	SketchSeriesEndpointV1 = "/api/v1/sketches"
	ValidateEndpointV1     = "/api/v1/validate"
	ProcessesEndpointV1    = "/api/v1/collector"
	ContainerEndpointV1    = "/api/v1/container"
	OrchestratorEndpointV1 = "/api/v1/orchestrator"

	SeriesEndpointV2        = "/api/v2/series"
	EventsEndpointV2        = "/api/v2/events"
	ServiceChecksEndpointV2 = "/api/v2/service_checks"
	SketchSeriesEndpointV2  = "/api/beta/sketches"
	HostMetadataEndpointV2  = "/api/v2/host_metadata"
	MetadataEndpointV2      = "/api/v2/metadata"
)

Endpoint name constants

Variables

This section is empty.

Functions

func GetV1Endpoints

func GetV1Endpoints() []string

GetV1Endpoints returns a slice containing all the v1 endpoints

func Serve

func Serve()

Serve starts the HTTP server and blocks

Types

type HostMeta

type HostMeta struct {
	APIKey           string
	AgentVersion     string
	UUID             string
	InternalHostname string
	Os               string
	AgentFlavor      string `json:"agent-flavor"`
	Python           string
	SystemStats      struct {
		CPUCores  int
		Machine   string
		Platform  string
		PythonV   string
		Processor string
		MacV      interface{}
		NixV      interface{}
		FsdV      interface{}
		WinV      interface{}
	}
	Meta struct {
		SocketHostname string `json:"socket-hostname"`
		Timezones      []string
		SocketFqdn     string `json:"socket-fqdn"`
		Ec2Hostname    string `json:"ec2-hostname"`
		Hostname       string
		HostAliases    []string `json:"host_aliases"`
		InstanceID     string   `json:"instance-id"`
	}
	HostTags struct {
		System              []string `json:"system"`
		GoogleCloudPlatform []string `json:"google cloud platform,omitempty"`
	} `json:"host-tags"`
	Network struct {
		IP   string `json:"ipaddress"`
		IPV6 string `json:"ipaddressv6"`
		Mac  string `json:"macaddress"`
	}
	Logs      struct{ Transport string }
	Resources struct {
		Processes struct {
			Snaps []interface{}
		}
	}
}

HostMeta represents a metadata payload

func DecodeHostMeta

func DecodeHostMeta(payload []byte) (*HostMeta, error)

DecodeHostMeta decodes a HostMeta payload

func (*HostMeta) GetProcessSnapshots

func (hm *HostMeta) GetProcessSnapshots() []*ProcessSnapshot

GetProcessSnapshots extracts the list of processes from the metadata payload

type Point

type Point []float64

Point is an alias for an array of floats

type Process

type Process struct {
	Username string
	CPUPct   float64
	MemPct   float64
	VMS      float64
	RSS      float64
	Name     string
	Pids     float64
}

Process represent a process stats

type ProcessSnapshot

type ProcessSnapshot struct {
	Timestamp   float64
	ProcessList []*Process
}

ProcessSnapshot represents a list of snapshots

func NewProcessSnapshot

func NewProcessSnapshot(rawSnapshot interface{}) *ProcessSnapshot

NewProcessSnapshot creates a ProcessSnapshot from raw data.

The payload is a slice in the form [timestamp, process_list] where process_list is in turn an array of 5 items.

type PubSub

type PubSub struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

PubSub is a ridicoulously simple message broker

var (
	// MsgBroker is used to read messages from the intake
	MsgBroker *PubSub
)

func NewPubsub

func NewPubsub() *PubSub

NewPubsub creates an instance of the broker

func (*PubSub) Close

func (ps *PubSub) Close()

Close shuts down the broker and cleans up the channels

func (*PubSub) Publish

func (ps *PubSub) Publish(topic string, msg []byte)

Publish sends a message to a topic

func (*PubSub) Subscribe

func (ps *PubSub) Subscribe(topic string) <-chan []byte

Subscribe lets clients subscribe to a topic

type V1Metric

type V1Metric struct {
	Metric         string
	Points         []Point
	Tags           []string
	Host           string
	Device         string
	Type           string
	Interval       int
	SourceTypeName string `json:"source_type_name"`
}

V1Metric represents a datapoint series

func DecodeV1Metrics

func DecodeV1Metrics(payload []byte) ([]V1Metric, error)

DecodeV1Metrics decodes a payload and returns a slice of Metric

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL