api

package
v0.0.0-...-ae11625 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2014 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildStats

func BuildStats(parent *Node)

func ConvertTask

func ConvertTask(taskJson map[string]*json.RawMessage) db.Task

func GetStatFromTask

func GetStatFromTask(task db.Task, prop string) float64

func HandleTasks

func HandleTasks(taskChannel <-chan db.Task, taskNodes map[string]*Node)

func SplitTaskKey

func SplitTaskKey(taskKey string) (string, string, string)

Types

type Node

type Node struct {
	TaskId    string  `json:"task_id"`
	Key       string  `key`
	Name      string  `json:"name"`
	ContextId string  `json:"context_id"`
	Children  []*Node `json:"children"`

	Keys     []string `json:"keys"` // Handles multiple runs of the same task
	IsParent bool     `json:"is_parent"`
	Status   int      `json:"status"`
	Latency  float64  `json:"latency"`
	RunTime  float64  `json:"run_time"`

	Stats map[string]*Stats
	// contains filtered or unexported fields
}

func BuildChildNode

func BuildChildNode(taskId, taskKey, contextId string,
	children map[string]*Node) *Node

func BuildParentNode

func BuildParentNode(requestId string) *Node

func ProcessChildNode

func ProcessChildNode(taskKey string, nodes map[string]*Node,
	childrenMap map[string]map[string]*Node) (string, *Node)

type StatAPI

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

func NewStatAPI

func NewStatAPI(pool db.DBPool) *StatAPI

func (*StatAPI) GetStatForRequest

func (s *StatAPI) GetStatForRequest(requestId string) (db.Stat, error)

func (*StatAPI) MakeRequestStats

func (s *StatAPI) MakeRequestStats(statJson map[string]*json.RawMessage) (*db.Request, db.Stat)

func (*StatAPI) SaveRequestStats

func (s *StatAPI) SaveRequestStats(request *db.Request, stat db.Stat) (string, error)

type Stats

type Stats struct {
	Count   int     `json:"count"`
	Min     float64 `json:"min"`
	Max     float64 `json:"max"`
	Average float64 `json:"average"`
	Median  float64 `json:"median"`
	StdDev  float64 `json:"std_dev"`
}

type TaskAPI

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

func NewTaskAPI

func NewTaskAPI(pool db.DBPool) *TaskAPI

func (*TaskAPI) GetRequestTaskGraph

func (a *TaskAPI) GetRequestTaskGraph(requestId string) (*Node, error)

func (*TaskAPI) GetTaskForKey

func (a *TaskAPI) GetTaskForKey(taskKey string) (db.Task, error)

func (*TaskAPI) ListAddresses

func (a *TaskAPI) ListAddresses() (WeightedScoreList, error)

func (*TaskAPI) ListRequestTaskKeys

func (a *TaskAPI) ListRequestTaskKeys(requestId string) (WeightedScoreList, error)

func (*TaskAPI) ListRequestTaskKeysAsSet

func (a *TaskAPI) ListRequestTaskKeysAsSet(requestId string) (map[string]int, error)

func (*TaskAPI) ListRequests

func (a *TaskAPI) ListRequests(address string) (WeightedScoreList, error)

Returns a byte array of a jsonified list of strings (request ids).

func (*TaskAPI) ListTaskKeys

func (a *TaskAPI) ListTaskKeys(taskId string) (WeightedScoreList, error)

func (*TaskAPI) LoadTask

func (a *TaskAPI) LoadTask(taskKey string, taskChannel chan<- db.Task)

func (*TaskAPI) ProcessTaskKeys

func (a *TaskAPI) ProcessTaskKeys(requestId string, taskKeys map[string]int,
	parent *Node) *Node

func (*TaskAPI) SaveTask

func (a *TaskAPI) SaveTask(task db.Task) (string, error)

func (*TaskAPI) SetTaskInfo

func (a *TaskAPI) SetTaskInfo(taskKey string, node *Node)

type WeightedScore

type WeightedScore struct {
	Key   string
	Value int
}

A data structure to hold a key/value pair.

type WeightedScoreList

type WeightedScoreList []WeightedScore

A slice of Pairs that implements sort.Interface to sort by Value.

func (WeightedScoreList) Len

func (p WeightedScoreList) Len() int

func (WeightedScoreList) Less

func (p WeightedScoreList) Less(i, j int) bool

func (WeightedScoreList) Swap

func (p WeightedScoreList) Swap(i, j int)

Jump to

Keyboard shortcuts

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