Documentation ¶
Index ¶
- Constants
- type Elastic
- func (e *Elastic) AddTaskLogs(logs []*model.TaskLog) error
- func (e *Elastic) DeleteTaskLogs(ids []model.TaskID) error
- func (e *Elastic) DeleteTrialLogs(ids []int) error
- func (e *Elastic) MaxTerminationDelay() time.Duration
- func (e *Elastic) TaskLogs(taskID model.TaskID, limit int, fs []api.Filter, order apiv1.OrderBy, ...) ([]*model.TaskLog, interface{}, error)
- func (e *Elastic) TaskLogsCount(taskID model.TaskID, fs []api.Filter) (int, error)
- func (e *Elastic) TaskLogsFields(taskID model.TaskID) (*apiv1.TaskLogsFieldsResponse, error)
- func (e *Elastic) TrialLogs(trialID, limit int, fs []api.Filter, order apiv1.OrderBy, ...) ([]*model.TrialLog, interface{}, error)
- func (e *Elastic) TrialLogsCount(trialID int, fs []api.Filter) (int, error)
- func (e *Elastic) TrialLogsFields(trialID int) (*apiv1.TrialLogsFieldsResponse, error)
Constants ¶
const ( // ElasticTimeWindowDelay is the time buffer to allow logs to come in before we try to serve // them up. We do this to not miss later logs when using search_after the way we do. ElasticTimeWindowDelay = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Elastic ¶
type Elastic struct {
// contains filtered or unexported fields
}
Elastic is an interface around an elasticsearch client that abstracts away common queries and indexing operations.
func Setup ¶
func Setup(conf model.ElasticLoggingConfig) (*Elastic, error)
Setup sets up a new elasticsearch client with the given configuration.
func (*Elastic) AddTaskLogs ¶
AddTaskLogs indexes a batch of tasks logs into the index like tasklogs-yyyy-MM-dd based on the UTC value of their timestamp.
func (*Elastic) DeleteTaskLogs ¶
DeleteTaskLogs deletes the logs for the given tasks.
func (*Elastic) DeleteTrialLogs ¶
DeleteTrialLogs deletes the logs for the given trial IDs.
func (*Elastic) MaxTerminationDelay ¶
MaxTerminationDelay is the max delay before a consumer can be sure all logs have been recevied. For Elasticsearch, this _must_ be greater than internal/elastic.elasticTimeWindowDelay or else following terminates before all logs are delivered.
func (*Elastic) TaskLogs ¶
func (e *Elastic) TaskLogs( taskID model.TaskID, limit int, fs []api.Filter, order apiv1.OrderBy, searchAfter interface{}, ) ([]*model.TaskLog, interface{}, error)
TaskLogs return a set of logs matching the provided criteria from the task. This uses the search after API, since from+size is prohibitively expensive for deep pagination and the scroll api specifically recommends search after over itself. https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-request-search-after.html
func (*Elastic) TaskLogsCount ¶
TaskLogsCount returns the number of logs for the given task.
func (*Elastic) TaskLogsFields ¶
TaskLogsFields returns the unique fields that can be filtered on for the given task.
func (*Elastic) TrialLogs ¶
func (e *Elastic) TrialLogs( trialID, limit int, fs []api.Filter, order apiv1.OrderBy, searchAfter interface{}, ) ([]*model.TrialLog, interface{}, error)
TrialLogs return a set of trial logs within a specified window. This uses the search after API, since from+size is prohibitively expensive for deep pagination and the scroll api specifically recommends search after over itself. https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-request-search-after.html
func (*Elastic) TrialLogsCount ¶
TrialLogsCount returns the number of trial logs for the given trial.
func (*Elastic) TrialLogsFields ¶
func (e *Elastic) TrialLogsFields(trialID int) (*apiv1.TrialLogsFieldsResponse, error)
TrialLogsFields returns the unique fields that can be filtered on for the given trial.