Documentation ¶
Index ¶
- Constants
- type ChannelStats
- type Counter
- type DurationCounter
- type Manager
- type ManagerMessage
- type ManagerStats
- func (m *ManagerStats) AverageByProvider(p provider.Provider) float64
- func (m *ManagerStats) AverageByType(t string) float64
- func (m *ManagerStats) AverageDurationByProvider(p provider.Provider) time.Duration
- func (m *ManagerStats) AverageDurationByType(t string) time.Duration
- func (m *ManagerStats) IncrementJobs(j job.Job)
- func (m *ManagerStats) JobCountByProvider(p provider.Provider) uint64
- func (m *ManagerStats) JobCountByType(t string) uint64
- func (m *ManagerStats) JobDurationByProvider(p provider.Provider) time.Duration
- func (m *ManagerStats) JobDurationByType(t string) time.Duration
- func (m *ManagerStats) JobsPerSecond() float64
- func (m *ManagerStats) JobsPerSecondByProvider(p provider.Provider) float64
- func (m *ManagerStats) JobsPerSecondByType(t string) float64
- func (m *ManagerStats) LastTotalByProvider(p provider.Provider) uint64
- func (m *ManagerStats) LastTotalByType(t string) uint64
- func (m *ManagerStats) ReportStats(w http.ResponseWriter, r *http.Request)
- func (m *ManagerStats) TotalAverage() float64
- func (m *ManagerStats) TotalJobs() uint64
- func (m *ManagerStats) UpTime() time.Duration
- type ManagerStatsReport
Constants ¶
const ( MANAGER_PREFIX = "manager:" CONNECTION_REFRESH_RATE = 360 DEFAULT_MAX_WORKERS = 20 )
const (
MESSAGE_TYPE_CONFIG = 0
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelStats ¶
ChannelStats holds statistics about a channel
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter provides methods for atomically counting things
type DurationCounter ¶
DurationCounter tracks the adition of durations atomically
func (*DurationCounter) Add ¶
func (d *DurationCounter) Add(t time.Duration)
Add add two times together atomically
func (*DurationCounter) Avg ¶
func (d *DurationCounter) Avg() time.Duration
Avg get the averge amount of time so far
func (*DurationCounter) Reset ¶
func (d *DurationCounter) Reset()
func (*DurationCounter) Set ¶
func (d *DurationCounter) Set(t time.Duration)
Set set the counter to a given value
func (*DurationCounter) Val ¶
func (d *DurationCounter) Val() time.Duration
Val returns the current total
type Manager ¶
type Manager struct { // WorkerFactories a map of WorkerFactories that can create workers of a spesific type // WorkerFactories map[string]worker.WorkerFactory // // ProviderFactories a map of ProviderFactory taht can create providers fo a spesific type // ProviderFactories map[string]provider.ProviderFactory // KillChan if recieved on this channel, kill all workers KillChan chan struct{} // Stats keeps track of statistics of jobs running through the manager Stats *ManagerStats // Providers a map of provider.Provider's that can be used to request work Providers map[string]provider.Provider // contains filtered or unexported fields }
Manager is used to manage worker processes
func (*Manager) ConfigStruct ¶
func (m *Manager) ConfigStruct() interface{}
ConfigStruct returns the struct used to configure the manager
type ManagerMessage ¶
type ManagerMessage struct { Type int Payload interface{} }
ManagerMessage is a message that is sent between managers to convey changes in configuration
type ManagerStats ¶
type ManagerStats struct {
// contains filtered or unexported fields
}
ManagerStats is a struct that holds statistics about a manager
func NewManagerStats ¶
func NewManagerStats(man *Manager) *ManagerStats
NewManagerStats initializes and returns a new instance of ManagerStats
func (*ManagerStats) AverageByProvider ¶
func (m *ManagerStats) AverageByProvider(p provider.Provider) float64
func (*ManagerStats) AverageByType ¶
func (m *ManagerStats) AverageByType(t string) float64
AverageByType returns the average number of job processed per second for the entire uptime of this process, for a given type
func (*ManagerStats) AverageDurationByProvider ¶
func (m *ManagerStats) AverageDurationByProvider(p provider.Provider) time.Duration
func (*ManagerStats) AverageDurationByType ¶
func (m *ManagerStats) AverageDurationByType(t string) time.Duration
func (*ManagerStats) IncrementJobs ¶
func (m *ManagerStats) IncrementJobs(j job.Job)
IncrementJobs atomically add one to the total number of job
func (*ManagerStats) JobCountByProvider ¶
func (m *ManagerStats) JobCountByProvider(p provider.Provider) uint64
func (*ManagerStats) JobCountByType ¶
func (m *ManagerStats) JobCountByType(t string) uint64
TotalByType returns the total number of job for a given type
func (*ManagerStats) JobDurationByProvider ¶
func (m *ManagerStats) JobDurationByProvider(p provider.Provider) time.Duration
func (*ManagerStats) JobDurationByType ¶
func (m *ManagerStats) JobDurationByType(t string) time.Duration
func (*ManagerStats) JobsPerSecond ¶
func (m *ManagerStats) JobsPerSecond() float64
JobsPerSecond return the job per second
func (*ManagerStats) JobsPerSecondByProvider ¶
func (m *ManagerStats) JobsPerSecondByProvider(p provider.Provider) float64
JobsPerSecondByProvider returns the job per second for a given Provider
func (*ManagerStats) JobsPerSecondByType ¶
func (m *ManagerStats) JobsPerSecondByType(t string) float64
JobsPerSecondByType returns the job per second of a spesific type
func (*ManagerStats) LastTotalByProvider ¶
func (m *ManagerStats) LastTotalByProvider(p provider.Provider) uint64
func (*ManagerStats) LastTotalByType ¶
func (m *ManagerStats) LastTotalByType(t string) uint64
func (*ManagerStats) ReportStats ¶
func (m *ManagerStats) ReportStats(w http.ResponseWriter, r *http.Request)
ReportStats create a ManagerStatsReport for the current state of the manger
func (*ManagerStats) TotalAverage ¶
func (m *ManagerStats) TotalAverage() float64
TotalAverage returns the average number of job processed per second for the entire uptime
func (*ManagerStats) TotalJobs ¶
func (m *ManagerStats) TotalJobs() uint64
TotalJobs returns the total number of job processed
func (*ManagerStats) UpTime ¶
func (m *ManagerStats) UpTime() time.Duration
UpTime returns the uptime in seconds
type ManagerStatsReport ¶
type ManagerStatsReport struct { Uptime uint64 `json:"uptime"` JobsPerSecond float64 `json:"job_per_second_cumulative"` JobsPerSecondByType map[string]float64 `json:"job_per_second_by_type"` JobsPerSecondByProvider map[string]float64 `json:"job_persecond_by_provider"` TotalJobs uint64 `json:"total_job"` TotalJobsByType map[string]uint64 `json:"total_job_by_type"` TotalJobsByProvider map[string]uint64 `json:"total_job_by_provider"` TotalAverage float64 `json:"total_average"` TotalAverageByType map[string]float64 `json:"total_average_by_type"` TotalAverageByProvider map[string]float64 `json:"total_average_by_provider"` ChannelStats map[string]ChannelStats `json:"channel_stats"` AverageDurationByType map[string]time.Duration `json:"average_duration_by_type"` AverageDurationByProvider map[string]time.Duration `json:"average_duration_by_provider"` AverageDuration time.Duration `json:"average_duration"` TotalDurationByType map[string]time.Duration `json:"total_duration_by_type"` TotalDurationByProvider map[string]time.Duration `json:"total_duration_by_provider"` }
ManagerStatsReport holds statistical information about the mananger