mirror of
https://github.com/Bryanthelol/namekoplus
synced 2025-09-13 23:06:10 +08:00
add commad line tool
This commit is contained in:
0
namekoplus/templates/timer/__init__.py
Normal file
0
namekoplus/templates/timer/__init__.py
Normal file
24
namekoplus/templates/timer/config.yml
Normal file
24
namekoplus/templates/timer/config.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
AMQP_URI: pyamqp://${RABBIT_USER:guest}:${RABBIT_PASSWORD:guest}@${RABBIT_HOST:localhost}:${RABBIT_PORT:5672}/
|
||||
RPC_EXCHANGE: 'nameko-rpc'
|
||||
|
||||
max_workers: 10
|
||||
parent_calls_tracked: 20
|
||||
|
||||
LOGGING:
|
||||
version: 1
|
||||
formatters:
|
||||
tracer:
|
||||
(): nameko_tracer.formatters.PrettyJSONFormatter
|
||||
handlers:
|
||||
tracer:
|
||||
class: logging.StreamHandler
|
||||
formatter: tracer
|
||||
loggers:
|
||||
nameko_tracer:
|
||||
level: INFO
|
||||
handlers: [tracer]
|
||||
|
||||
SENTRY:
|
||||
DSN: ${SENTRY_DSN}
|
||||
CLIENT_CONFIG:
|
||||
site: ${SENTRY_SITE}
|
||||
17
namekoplus/templates/timer/timer_demo.py
Normal file
17
namekoplus/templates/timer/timer_demo.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from nameko.timer import timer
|
||||
from nameko_tracer import Tracer
|
||||
from namekoplus import init_statsd, init_sentry
|
||||
|
||||
|
||||
class Service:
|
||||
name = "service"
|
||||
|
||||
tracer = Tracer()
|
||||
sentry = init_sentry()
|
||||
statsd = init_statsd('statsd_prefix', 'statsd_host', 'statsd_port')
|
||||
|
||||
@timer(interval=1)
|
||||
@statsd.timer('ping')
|
||||
def ping(self):
|
||||
# method executed every second
|
||||
print("pong")
|
||||
Reference in New Issue
Block a user