mesoslog

package
v0.0.0-...-8c755ac Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2017 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// PageLength is the amount of data we want to consume during log tailing
	PageLength int    = 5000
	TailURIFmt string = "http://%s:5051/files/read.json?path=%s&offset=%v&length=%v"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogOut

type LogOut struct {
	// AppID - the task name / application identifier
	AppID string
	// TaskID - the task identifier
	TaskID string
	// Log - filename of the outputted log when in download more or RAW log if request is to print to stdout
	Log string
}

LogOut - struct which holds the result from getting Mesos logs

type LogType

type LogType int

LogType - enumeration of STDOUT or STDERR

const (
	// STDOUT - requests the stdout log from Mesos
	STDOUT LogType = 1 + iota
	// STDERR - requests the stderr log from Mesos
	STDERR
)

func (LogType) String

func (l LogType) String() string

type MesosClient

type MesosClient struct {
	Host      string
	Port      int
	MasterURL string
	State     *masterState
	Options   *MesosClientOptions
}

MesosClient holds state about the current Master node. Allows method receivers to obtain these values

func NewMesosClient

func NewMesosClient(host string, port int) (*MesosClient, error)

NewMesosClient - Creates a new MesosClient {host} - the host/ip of the mesos master node {port} - the port # of the mesos master node

func NewMesosClientWithOptions

func NewMesosClientWithOptions(host string, port int, options *MesosClientOptions) (*MesosClient, error)

NewMesosClient - Creates a new MesosClient {host} - the host/ip of the mesos master node {port} - the port # of the mesos master node {options} - client options - optional

func (*MesosClient) GetAppNameForPath

func (c *MesosClient) GetAppNameForPath(path string) string

func (*MesosClient) GetAppNameForTaskID

func (c *MesosClient) GetAppNameForTaskID(taskID string) (string, error)

GetAppNameForTaskID - Attempts to find the Mesos Application name for the given TaskID {taskID} - the task identifier

func (*MesosClient) GetAppNames

func (c *MesosClient) GetAppNames() (map[string]int, error)

GetAppNames - List all unique app names aka task names running in the Mesos cluster

func (*MesosClient) GetLog

func (c *MesosClient) GetLog(appID string, logtype LogType, dir string) ([]*LogOut, error)

GetLog - Gets/Downloads logs for a [appID] {appID} - the task name / app identifier {logtype} - the desired log type STDOUT | STDERR {dir} - optional output dir which is used to download vs stdout

func (*MesosClient) TailLog

func (c *MesosClient) TailLog(appID string, logtype LogType, duration int) error

TailLog - Tails the logs for a [appID] {appID} - the task name / app identifier {logtype} - the desired log type STDOUT | STDERR {duration} - poll frequency in seconds

func (*MesosClient) TailLogToChannel

func (c *MesosClient) TailLogToChannel(appID string, logtype LogType, duration int, target chan<- string, done chan bool) error

type MesosClientOptions

type MesosClientOptions struct {
	SearchCompletedTasks bool
	ShowLatestOnly       bool
}

type SortTasksByLatestTimestamp

type SortTasksByLatestTimestamp []*mstateTask

func (SortTasksByLatestTimestamp) Len

func (SortTasksByLatestTimestamp) Less

func (s SortTasksByLatestTimestamp) Less(i, j int) bool

func (SortTasksByLatestTimestamp) Swap

func (s SortTasksByLatestTimestamp) Swap(i, j int)

Jump to

Keyboard shortcuts

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