Documentation ¶
Index ¶
- func NewInternalCollectorCurrentlyQueuedTasksCount() prometheus.Collector
- func NewInternalCollectorExecutedTasksCount() prometheus.Collector
- func NewInternalCollectorMetricsCount() prometheus.Collector
- func StoreDelMetric(ctx context.Context, s store.Store, m schemas.Metric)
- func StoreGetMetric(ctx context.Context, s store.Store, m *schemas.Metric)
- func StoreSetMetric(ctx context.Context, s store.Store, m schemas.Metric)
- type Controller
- func (c *Controller) HealthCheckHandler(ctx context.Context) (h healthcheck.Handler)
- func (c *Controller) MetricsHandler(w http.ResponseWriter, r *http.Request)
- func (c *Controller) RegisterCollector(ctx context.Context, collectors RegistryCollectors)
- func (c *Controller) RegisterTasks(n schemas.TaskType, h interface{})
- func (c *Controller) Schedule(ctx context.Context, tt schemas.TaskType, cfg config.SchedulerConfig)
- func (c *Controller) ScheduleRedisSetKeepalive(ctx context.Context)
- func (c *Controller) ScheduleTask(ctx context.Context, tt schemas.TaskType, uniqueID string, args ...interface{})
- func (c *Controller) ScheduleTaskWithTicker(ctx context.Context, tt schemas.TaskType, intervalSeconds int)
- func (c *Controller) UnqueueTask(ctx context.Context, tt schemas.TaskType, uniqueID string)
- func (c *Controller) WebhookHandler(w http.ResponseWriter, r *http.Request)
- type Registry
- func (r *Registry) ExportInternalMetrics(ctx context.Context, s store.Store) (err error)
- func (r *Registry) ExportMetrics(metrics schemas.Metrics)
- func (r *Registry) GetCollector(kind schemas.MetricKind) prometheus.Collector
- func (r *Registry) RegisterCollectors() error
- func (r *Registry) RegisterInternalCollectors()
- type RegistryCollectors
- type TaskController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewInternalCollectorCurrentlyQueuedTasksCount ¶
func NewInternalCollectorCurrentlyQueuedTasksCount() prometheus.Collector
NewInternalCollectorCurrentlyQueuedTasksCount returns a new collector for the mre_currently_queued_tasks_count metric.
func NewInternalCollectorExecutedTasksCount ¶
func NewInternalCollectorExecutedTasksCount() prometheus.Collector
NewInternalCollectorExecutedTasksCount returns a new collector for the mre_executed_tasks_count metric.
func NewInternalCollectorMetricsCount ¶
func NewInternalCollectorMetricsCount() prometheus.Collector
NewInternalCollectorMetricsCount returns a new collector for the mre_metrics_count metric.
Types ¶
type Controller ¶
type Controller struct { Config config.Config // UUID is used to identify this controller/process amongst others when // the exporter is running in cluster mode, leveraging Redis. UUID uuid.UUID Redis *redis.Client TaskController TaskController Store store.Store Collectors RegistryCollectors }
func (*Controller) HealthCheckHandler ¶
func (c *Controller) HealthCheckHandler(ctx context.Context) (h healthcheck.Handler)
HealthCheckHandler ..
func (*Controller) MetricsHandler ¶
func (c *Controller) MetricsHandler(w http.ResponseWriter, r *http.Request)
MetricsHandler ..
func (*Controller) RegisterCollector ¶
func (c *Controller) RegisterCollector(ctx context.Context, collectors RegistryCollectors)
RegisterCollector is used to add collectors to the registry
func (*Controller) RegisterTasks ¶
func (c *Controller) RegisterTasks(n schemas.TaskType, h interface{})
RegisterTasks is used to load the list of tasks to be handled.
func (*Controller) Schedule ¶
func (c *Controller) Schedule(ctx context.Context, tt schemas.TaskType, cfg config.SchedulerConfig)
Schedule ..
func (*Controller) ScheduleRedisSetKeepalive ¶
func (c *Controller) ScheduleRedisSetKeepalive(ctx context.Context)
ScheduleRedisSetKeepalive will ensure that whilst the process is running, a key is periodically updated within Redis to let other instances know this one is alive and processing tasks.
func (*Controller) ScheduleTask ¶
func (c *Controller) ScheduleTask(ctx context.Context, tt schemas.TaskType, uniqueID string, args ...interface{})
ScheduleTask ..
func (*Controller) ScheduleTaskWithTicker ¶
func (c *Controller) ScheduleTaskWithTicker(ctx context.Context, tt schemas.TaskType, intervalSeconds int)
ScheduleTaskWithTicker ..
func (*Controller) UnqueueTask ¶
func (*Controller) WebhookHandler ¶
func (c *Controller) WebhookHandler(w http.ResponseWriter, r *http.Request)
WebhookHandler ..
type Registry ¶
type Registry struct { *prometheus.Registry InternalCollectors struct { CurrentlyQueuedTasksCount prometheus.Collector ExecutedTasksCount prometheus.Collector MetricsCount prometheus.Collector } Collectors RegistryCollectors }
Registry wraps a pointer of prometheus.Registry.
func NewRegistry ¶
func NewRegistry(ctx context.Context, collectors RegistryCollectors) *Registry
NewRegistry initialize a new registry.
func (*Registry) ExportInternalMetrics ¶
ExportInternalMetrics ..
func (*Registry) ExportMetrics ¶
ExportMetrics ..
func (*Registry) GetCollector ¶
func (r *Registry) GetCollector(kind schemas.MetricKind) prometheus.Collector
GetCollector ..
func (*Registry) RegisterCollectors ¶
RegisterCollectors add all our metrics to the registry.
func (*Registry) RegisterInternalCollectors ¶
func (r *Registry) RegisterInternalCollectors()
RegisterInternalCollectors declare our internal collectors to the registry.
type RegistryCollectors ¶
type RegistryCollectors map[schemas.MetricKind]prometheus.Collector
RegistryCollectors ..
type TaskController ¶
type TaskController struct { Factory taskq.Factory Queue taskq.Queue TaskMap *taskq.TaskMap TaskSchedulingMonitoring map[schemas.TaskType]*schemas.TaskSchedulingStatus }
TaskController holds task related metrics.
func NewTaskController ¶
func NewTaskController(ctx context.Context, r *redis.Client, cfg config.Config) (t TaskController)
NewTaskController initializes and returns a new TaskController object.
func (*TaskController) MonitorLastTaskScheduling ¶
func (tc *TaskController) MonitorLastTaskScheduling(tt schemas.TaskType)
func (*TaskController) MonitorNextTaskScheduling ¶
func (tc *TaskController) MonitorNextTaskScheduling(tt schemas.TaskType, duration int)