Skip to content

OpenTSDB (through opentsdb-py) dependency for nameko services

License

Notifications You must be signed in to change notification settings

scarchik/nameko-opentsdb-py

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

nameko-opentsdb-py

OpenTSDB (through opentsdb-py) dependency for nameko services

Installation

Install

pip3 install nameko-opentsdb-py

Install latest version from Git:

pip3 install git+https://github.com/fraglab/nameko-opentsdb-py.git

Usage

Use with dependency providers

SharedOpenTSDB - use OpenTSDB with dependency providers.

from nameko.extensions import DependencyProvider
from nameko_opentsdb import SharedOpenTSDB


class ServiceLogicProvider(DependencyProvider):
    tsdb = SharedOpenTSDB()

Use with services

OpenTSDBBasic

Base class to use OpenTSDB with service, provide access to opentsdb-py functionality.

OpenTSDB

Extend basic functionality with predefined nameko rpc call metrics:

  • Counter('nameko.rpc_call.success', ['method'])
  • Counter('nameko.rpc_call.failed', ['method'])
  • Gauge('nameko.rpc_call.execute_time_milliseconds', ['method'])
from nameko_opentsdb import OpenTSDB


class Service:
    tsdb = OpenTSDB()

Example:

from nameko.rpc import rpc
from nameko_opentsdb import OpenTSDB
from opentsdb import Counter


class ProfilesService:
    name = 'profiles_service'

    tsdb = OpenTSDB(
        CREATED=Counter('profiles.created'),
    )

    @rpc
    def create(self):
        # Some logic
        self.tsdb.CREATED.inc()
        return True

About

OpenTSDB (through opentsdb-py) dependency for nameko services

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%