コード例 #1
0
ファイル: example.py プロジェクト: manasg/amonpy
import amonpy
import sys
import traceback

# Http 
amonpy.config.address = 'http://127.0.0.1:2465'
amonpy.config.secret_key = 'u6ljlx2glnf8xq45ut1etkpxghmjpe3e'
for i in range(0, 100):
	amonpy.log('test data', ['debug','messages','http'])


# ZeroMQ
#amonpy.config.address = '127.0.0.1:5464'
#amonpy.config.protocol = 'zeromq'
#amonpy.log('test data zeromq', ['debug','messages', 'zeromq'])


try:
    1/0
except Exception, e:
    type, value, backtrace = sys.exc_info()
    
    data = {
        'exception_class': e.__class__.__name__,
        'backtrace': traceback.format_exception(type, value, backtrace) ,
        'enviroment': '',
        'data': {"message": "test"}
    }

    amonpy.exception(data)
コード例 #2
0
#http://amon.cx/guide/clients/python/
import amonpy

amonpy.config.address = "http://192.168.101.93:2464"

amonpy.log("Hello")
amonpy.log("Hello w a tag",['tag'])
コード例 #3
0
ファイル: benchmark.py プロジェクト: miohtama/amonpy
        address = "tcp://{0}".format(zeromq_address)
        self.socket.connect(address)

    def close(self):
        self.socket.close()

    def post(self, data):
        self.socket.send_json(data, zmq.NOBLOCK)

if zeromq_bench is True:
    amonpy.config.address = zeromq_address
    amonpy.config.protocol = 'zeromq'

    start = time.time()
    for i in range(0, runs):
        amonpy.log({"key": "value"})

    print "ZeroMQ - {0}".format(time.time()-start) 
    
    
    #z = ZeroMQHandler()
    #start = time.time()
    #for i in range(0, runs):
        #data = {'content': {'message': 'zeromq test {0}'.format(i), 'tags': ['debug']}, 'type':'log'}
        #z.post(data)

    #print "ZeroMQ Raw - {0}".format(time.time()-start) 


if http_bench is True:
    amonpy.config.address = http_address
コード例 #4
0
ファイル: example.py プロジェクト: miohtama/amonpy
import amonpy
import sys
import traceback

# Http
amonpy.config.address = 'http://127.0.0.1:2464'
for i in range(0, 100):
    amonpy.log('test data', ['debug', 'messages', 'http'])

# ZeroMQ
amonpy.config.address = '127.0.0.1:5464'
amonpy.config.protocol = 'zeromq'
amonpy.log('test data zeromq', ['debug', 'messages', 'zeromq'])

try:
    1 / 0
except Exception, e:
    type, value, backtrace = sys.exc_info()

    data = {
        'exception_class': e.__class__.__name__,
        'backtrace': traceback.format_exception(type, value, backtrace),
        'enviroment': '',
        'data': {
            "message": "test"
        }
    }

    amonpy.exception(data)