Monitoring

Data for monitoring

Now we monitor several types of events:

  • request, all HTTP requests.

  • error, all failed HTTP requests.

  • subtask execution, some messages about a process of executing a task.

  • subtask errors, all errors, generated during subtask processing.

  • subtask final, messages about the end of subtask processing.

  • worker requests, all messages, generated during subtask sending to workers.

  • worker queue, some messages about a transportation task through a worker queue.

Every event is a point in the time series. The point is represented as a union of the following data:

  • series name (now requests and errors)

  • start request time

  • tags, indexed data in storage, dictionary: keys - string tag names, values - string, integer, float

  • fields, non-indexed data in storage, dictionary: keys - string tag names, values - string, integer, float

‘Requests’ series. Triggered on every HTTP request. Each point contains data about the corresponding request (execution time and etc).

  • tags

    tag name

    description

    service

    “luna-tasks” or “luna-tasks-worker”

    route

    concatenation of a request method and a request resource (GET:/version)

    status_code

    http status code of response

  • fields

    fields

    description

    request_id

    request id

    execution_time

    request execution time

‘Errors’ series. Triggered on failed HTTP request. Each point contains error_code of luna error.

  • tags

    tag name

    description

    service

    “luna-tasks” or “luna-tasks-worker”

    route

    concatenation of a request method and a request resource (GET:/version)

    status_code

    http status code of response

    error_code

    luna error code

  • fields

    fields

    description

    request_id

    request id

‘Subtask errors’ series. Triggered on an error in a pipeline of a task processing.

  • tags

    tag name

    description

    service

    always “luna-tasks-worker”

    task_id

    task id

    subtask_id

    subtask id

    task_type

    task type (1, 2, 3, …)

    error_code

    luna error code

  • fields

    fields

    description

    error_code

    luna error code

‘subtask execution’ series. Triggered on an error in a pipeline of a task processing.

  • tags

    tag name

    description

    service

    always “luna-tasks-worker”

    task_id

    task id

    subtask_id

    subtask id

    task_type

    task type (1, 2, 3, …)

  • fields

    fields

    description

    save_result_time

    time of saving result in image-store (all task type)

    linked_faces

    approximate linked faces count (linker task)

    extracted_descriptors

    extracted descriptors count (additional extract task)

    events

    removed event ids count (gc task)

    match_time

    matching time (crossmatching task)

    clusterization_report_build_time

    build report time (reporter task)

‘subtask final’ series. Triggered on an end of subtask execution.

  • tags

    tag name

    description

    service

    always “luna-tasks-worker”

    task_id

    task id

    subtask_id

    subtask id

    task_type

    task type (1, 2, 3, …)

  • fields

    fields

    description

    execution_time

    execution subtask time

‘worker queue’ series. Triggered on a getting task from the worker queue.

  • tags

    tag name

    description

    service

    always “luna-tasks-worker”

    task_id

    task id

    subtask_id

    subtask id

    task_type

    task type (1, 2, 3, …)

  • fields

    fields

    description

    transport_time

    time between receiving task of a worker and start execution

‘worker requests’ series. Triggered after sending subtask to a worker.

  • tags

    tag name

    description

    service

    always “luna-tasks-worker”

    task_id

    task id

    subtask_id

    subtask id

  • fields

    fields

    description

    transport_time

    initialize sending a task subtasks and send subtask to thr worker execution

It can be to add additional tags or fields.

Database

Monitoring is implemented as data sending to an influx database. You can set up your database credentials in configuration file in section “monitoring”.

Classes

class luna_tasks.monitoring.points.SubtaskErrorPoint(eventTime, subtaskId, taskId, taskType, errorCode, additionalTags=None, additionalFields=None)[source]

Point for sub task error monitoring.

errorCode

error code

Type:

int

additionalTags

additional tags

Type:

dict

additionalFields

additional fields

Type:

dict

property fields: dict

Get point fields

Returns:

dict with additional fields

Return type:

dict

series: str = 'subtask_errors'

series

property tags: dict

Get point tags

Returns:

dict with service as keys + additionalTags

Return type:

dict

class luna_tasks.monitoring.points.SubtaskExecutionPoint(eventTime, subtaskId, taskId, taskType, additionalTags=None, additionalFields=None)[source]

Point for monitoring subtask execution

additionalTags

additional tags for point

Type:

dict

additionalFields

additional fields for point

Type:

dict

property fields: dict

Get point fields

Returns:

dict with additional fields

Return type:

dict

series: str = 'subtask_execution'

series

property tags: dict

Get point tags

Returns:

dict with service as keys + additionalTags

Return type:

dict

class luna_tasks.monitoring.points.SubtaskFinalPoint(eventTime, subTaskId, taskId, taskType, executionTime, status, additionalTags=None, additionalFields=None)[source]

Point for monitoring subtask ending.

additionalTags

additional tags for point

Type:

dict

additionalFields

additional fields for point

Type:

dict

executionTime

subtask execution time

Type:

float

status

subtask status

Type:

int

property fields: dict

Get point fields

Returns:

dict with additional fields

Return type:

dict

series: str = 'subtask_final'

series

property tags: dict

Get point tags

Returns:

dict with service as keys + additionalTags

Return type:

dict

class luna_tasks.monitoring.points.SubtaskMonitoringBasePoint(eventTime, subtaskId, taskId, taskType)[source]

Base class for monitoring an subtask execution .. attribute:: subtaskId

subtask id

type:

int

taskId

task id

Type:

int

taskType

task type

Type:

int

property fields: dict

Get point fields

Returns:

dict with additional fields

Return type:

dict

classmethod initialize(serviceName)[source]

Initialize request point for custom service. :param serviceName: service name

service: str

service name

property tags: dict

Get point tags

Returns:

dict with service as keys + additionalTags

Return type:

dict

class luna_tasks.monitoring.points.WorkerQueuePoint(eventTime, subtaskId, taskId, taskType, transportTime)[source]

Point for a worker queue monitoring .. attribute:: transportTime

time between receiving task of a worker and start execution

type:

float

property fields: dict

Get point fields

Returns:

dict with additional fields

Return type:

dict

series: str = 'worker_queue'

series

property tags: dict

Get point tags

Returns:

dict with service as keys + additionalTags

Return type:

dict

class luna_tasks.monitoring.points.WorkerRequestPoint(eventTime, subtaskId, taskId, transportTime)[source]

Point for monitoring queue of sending subtasks to workers.

taskId

task id

Type:

int

subtaskId

subtask id

Type:

int

transportTime

initialize sending a task subtasks and send subtask to thr worker execution

Type:

float

property fields: dict

Get point fields

Returns:

dict with additional fields

Return type:

dict

classmethod initialize(serviceName)[source]

Initialize request point for custom service. :param serviceName: service name

series: str = 'worker_requests'

series

service: str

service name

property tags: dict

Get point tags

Returns:

dict with service as keys + additionalTags

Return type:

dict