Monitoring

Data for monitoring

We are currently processing several types of events for monitoring:

  1. request (any http request)

  2. error (failed http request)

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

  • series name

  • start event 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

Monitoring series

  • Requests series.

    Triggered on every request. Each point contains a data about corresponding request (execution time and etc).

    Requests series tags

    tag name

    description

    service

    always “luna-builder”

    route

    concatenation of a request method and a request resource (POST:/sdk)

    status_code

    http status code of response

    Requests series fields

    fields

    description

    request_id

    request id

    execution_time

    request execution time

  • Errors series.

    Triggered on failed request. Each point contains error_code of luna error.

    Errors series tags

    tag name

    description

    service

    always “luna-builder”

    route

    concatenation of a request method and a request resource (POST:/sdk)

    status_code

    http status code of response

    error_code

    Luna Platform error code

    Errors series fields

    fields

    description

    request_id

    request id

Database

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

Plugins

You can implement your own plugin for sending monitoring data. See plugins

Module request monitoring plugin example

class crutches_on_wheels.cow.plugins.plugin_examples.request_monitoring_plugin_example.BaseRequestMonitoringPlugin(app)[source]

Base class for requests monitoring.

abstractmethod async flushPointToMonitoring(point, logger)[source]

All plugins must realize this method.

This function call after end of request

Parameters:
  • point (TypeVar(MonitoringPoint)) – point for monitoring

  • logger – logger

Return type:

None

async handleEvent(points, logger)[source]

Handle event

Parameters:
  • *args – positional arg for event handler function

  • **kwargs – named arg for event handler function

class crutches_on_wheels.cow.plugins.plugin_examples.request_monitoring_plugin_example.RequestMonitoringPlugin(app)[source]

Example plugin sends a request data for monitoring to third-party source. Only one instance of this class exist during the program execution.

async close()[source]

Stop plugin.

Close all open connections and ect

async flushPointToMonitoring(point, logger)[source]

Callback for sending a request monitoring data.

Parameters:
  • point (TypeVar(MonitoringPoint)) – point for monitoring

  • logger – logger

Return type:

None

async initialize()[source]

Initialize plugin.

Close all open connections and ect