Monitoring

Data for monitoring

Now we monitor several types of events:

  • request, all http and ws requests.

  • error, all failed http and ws requests.

  • ws requests, all messages send by websockets (ws) to clients.

  • subscription error, all errors, generated during redis messages processing or during the subscription

    establishment to redis.

  • redis messages, all messages from redis

Every event is a point in the time series. The point is represented as 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 or websockets request. Each point contains data about the corresponding request (execution time and etc).

  • tags

    tag name

    description

    service

    always “luna-sender”

    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 or websockets request. Each point contains error_code of luna error.

  • tags

    tag name

    description

    service

    always “luna-sender”

    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

‘Subscription errors’ series. Triggered on an error in a pipeline of processing messages from redis or redis subscription. Each point contains error_code of luna error.

  • tags

    tag name

    description

    service

    always “luna-sender”

    error_code

    luna error code

  • fields, now nothing

‘ws requests’ series. Triggered on every request by ws to a client. Each point contains a time of processing

  • tags

    tag name

    description

    service

    always “luna-sender”

    account_id

    account id or none

  • fields

    fields

    description

    transport_time

    time between getting message from redis and finish sending request to a client

    request_id

    request id

Can be to add additional tags or fields in ‘subscription_error’.

Database

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

Classes

Points. For monitoring events in the redis context

class luna_sender.app.monitoring.points.BaseSenderMonitoringPoint(eventTime)[source]

Base point for Sender messages monitoring

classmethod initialize(serviceName)[source]

Initialize :param serviceName: service name

service: str

service name

class luna_sender.app.monitoring.points.ErrorPoint(eventTime, errorCode, additionalTags=None, additionalFields=None)[source]

Point for monitoring errors of processing messages from redis or connecting to redis

additionalTags

additional tags for point

Type:

dict

errorCode

error code

Type:

str

additionalFields

additional fields for point

Type:

dict

property fields: dict

Get point fields

Returns:

dict with additional fields

Return type:

dict

series: str = 'subscription_error'

series

property tags: dict

Get point tags

Returns:

dict with service as keys + additionalTags

Return type:

dict

class luna_sender.app.monitoring.points.SubscribeRedisPoint(requestId, chanel, eventTime)[source]

Point for monitoring receiving message from redis

requestId

request id from luna

Type:

str

chanel

redis chanel (‘{chane name}:{account id}’)

Type:

str

property fields: dict

Get point fields :returns: dict with request id id as keys

Return type:

dict

series: str = 'redis_message'

series

property tags: dict

Get point tags

Returns:

dict with chanel and service as keys

Return type:

dict

class luna_sender.app.monitoring.points.WSRequestPoint(eventTime, requestId, transportTime, accountId)[source]

Point for monitoring sending message to ws

accountId

account id

Type:

str

requestId

request id from luna

Type:

str

transportTime

time between getting message from redis and sending it to a ws (seconds)

Type:

float

property fields: dict

Get point fields :returns: dict with request id id and transport time as keys

Return type:

dict

series: str = 'ws_requests'

series

property tags: dict

Get point tags

Returns:

dict with account id and service as keys

Return type:

dict