Skip to main content

ATN atn dbot metrics package

Project description

DBot-server metrics

The metrics client for dbot-server.

It supports collecting and transporting metrics for each dbot-server.

  • Currently we have some inner output-plugins, and more, you can define your own ouput-plugins.
  • Output-plugins can work at the same time, but we recommand only one.
  • Also the input metric-plugin can be defined by yourself.
  • Only you need to do is implementing the Plugin-Interface and configuring the file collector.conf.

Installation

pip install dbot_metrics

If you used default collector.conf file from system, you should copy it to /etc

Dependencies

Install leveldb if you want to use the recommand output-plugin leveldb-client

pip install leveldb

Install influxdb-python first if you want to use the inner output-plugin influxdb-client.

$ sudo apt-get install python-influxdb

Get more information, see https://github.com/influxdata/influxdb-python.

Install tinydb if you want to use the inner output-plugin tinydb-client.

pip install tinydb

Install unqlite if you want to use output-plugin unqlite-client

pip install unqlite

Documentation

See https://github.com/ATNIO/AI_market_plan/wiki/metric-heartbeat.

Interface

Metrics support query interface, it receive a json-type request parameter like this:

{ 'range': { 'from': 1532023625, 'to': 1532025313 },
  'targets': [{'table':'student', 'type':'all', 'sentence':''},
              {'table':'teacher', 'type':'sql', 'sentence': 'select * from teacher'},
              {'table':'others', 'type':'columns', 'sentence': 'age|name|no'}]}

and the response format is like this:

[ {
    'name': 'influxdb',
    'content':[ {
                  'time':1532023688,
                  'tags':{'name':'John', 'No':10023},
                  'fields': {'age': 23, 'gender': 'male'} 
                },
                {
                  'time':1532023798,
                  'tags':{'name':'Tom', 'No':10024},
                  'fields': {'age': 25, 'gender': 'male'}
                }
              ]
   }
]

Examples

from dbot_metrics import DBotMetricsCollector
# DBotApiMetric is a special metric in dbot_service_metric defined by yourself
from dbot_service_metric import DBotApiMetric

DBotMetricsCollector().Start("./collector.conf")
m = DBotApiMetric()
DBotMetricsCollector().RegisterMetrics(m)
m.EnableDetailRecord(False)

apiinfo = m.CallBegin("/api/dbot_server/api_call_test", "user")
# ... ... processing
m.CallEnd(apiinfo, 0)

DBotMetricsCollector().Stop()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbot_metrics-0.1.5.tar.gz (6.4 kB view details)

Uploaded Source

File details

Details for the file dbot_metrics-0.1.5.tar.gz.

File metadata

  • Download URL: dbot_metrics-0.1.5.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/18.5 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.10

File hashes

Hashes for dbot_metrics-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b4350c60fd9cc81a9087bdc6a72fe0ad9166a33cf6f5bd624973f3534b52b029
MD5 023b6c8855181ab2e644e145dff9b42d
BLAKE2b-256 d2ba73e0247266189706307da24df5f75ca99eedc983ca704cefd25b2d4ef6f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page