예제 #1
0
    def test_set_collector_host(self):
        self.assertTrue(
            pinpointPy.set_agent(collector_host='unix:/tmp/collector1.sock'))
        self.assertTrue(
            pinpointPy.set_agent(collector_host='Unix:/tmp/collector1.sock'))
        self.assertTrue(
            pinpointPy.set_agent(collector_host='TCP:dev-collector:11331'))
        self.assertTrue(
            pinpointPy.set_agent(collector_host='Tcp:dev-collector:11331'))

        try:
            pinpointPy.set_agent(collector_host='dev-collector:11331')
            self.assertFalse(1)
        except:
            pass
        try:
            self.assertFalse(
                pinpointPy.set_agent(collector_host='/tmp/collector1.sock'))
            self.assertFalse(1)
        except:
            pass

        self.assertTrue(
            pinpointPy.set_agent(collector_host='Tcp:dev-collector:11331',
                                 trace_limit=1000))
    def _test_api_flow(self):
        self.assertTrue(pinpointPy.set_agent(collector_host='unix:/tmp/unexist.sock'))
        # self.assertTrue(pinpointPy.enable_debug(None))

        while True:
            id = str(random.randint(1,10000000))
            pinpointPy.set_special_key('sid',id)
            self.assertEqual(pinpointPy.start_trace(),1)
            pinpointPy.add_clue("key","value3")
            pinpointPy.add_clues("key","value3")
            value = pinpointPy.get_special_key('sid')
            self.assertEqual(value,id)
            self.assertEqual(pinpointPy.end_trace(),0)
            pinpointPy.mark_as_error("fghjk","fghjkl",234234)
예제 #3
0
    def _test_api_flow(self):
        self.assertTrue(pinpointPy.set_agent(collector_host='unix:/tmp/unexist.sock'))
        # self.assertTrue(pinpointPy.enable_debug(None))

        while self.thread_running:
            pinpointPy.start_trace()
            pinpointPy.set_special_key('sid','12345678')
            pinpointPy.add_clue("key","value3")
            pinpointPy.add_clues("key","value3")
            value = pinpointPy.get_special_key('sid')
            self.assertEqual(value,'12345678')
            pinpointPy.mark_as_error("fghjk","fghjkl",234234)
            pinpointPy.end_trace()
            value = pinpointPy.get_special_key('sid')
            self.assertFalse(value)
예제 #4
0
STRING_ID = 30
HTTP_URL = '40'
HTTP_PARAM = '41'
HTTP_PARAM_ENTITY = '42'
HTTP_COOKIE = '45'
HTTP_STATUS_CODE = '46'
HTTP_INTERNAL_DISPLAY = 48
HTTP_IO = 49
MESSAGE_QUEUE_URI = 100

MYSQL = '2101'
REDIS = '8200'
REDIS_REDISSON = '8203'
REDIS_REDISSON_INTERNAL = '8204'
MEMCACHED = '8050'
pinpointPy.set_agent(collector_host=COLLECTOR_HOST, trace_limit=-1)
# pinpointPy.set_agent(collector_host='Tcp:ip:port',trace_limit=-1)

# def output(msg):
#     print(msg)
#
pinpointPy.enable_debug(None)


class Candy(object):
    def __init__(self, class_name, module_name):
        self.class_name = class_name
        self.module_name = module_name

    def onBefore(self, *args, **kwargs):
        pinpointPy.start_trace()
예제 #5
0
import pinpointPy
import random
import asyncio

PYTHON = '1700'
PYTHON_METHOD_CALL = '1701'
PYTHON_REMOTE_METHOD = '9900'

###############################################################

# user should set below before use
APP_ID = 'python-app-id'  # application id
APP_NAME = 'python-app-name'  # application name
COLLECTOR_HOST = 'unix:/tmp/collector-agent.sock'

pinpointPy.set_agent(collector_host=COLLECTOR_HOST, enable_coroutines=True)

## disable `enable_debug` if you not care it
# def output(msg):
#     print(msg)
#

# pinpointPy.enable_debug(None)

###############################################################
HTTP_PINPOINT_PSPANID = 'HTTP_PINPOINT_PSPANID'
HTTP_PINPOINT_SPANID = 'HTTP_PINPOINT_SPANID'
HTTP_PINPOINT_TRACEID = 'HTTP_PINPOINT_TRACEID'
HTTP_PINPOINT_PAPPNAME = 'HTTP_PINPOINT_PAPPNAME'
HTTP_PINPOINT_PAPPTYPE = 'HTTP_PINPOINT_PAPPTYPE'
HTTP_PINPOINT_HOST = 'HTTP_PINPOINT_HOST'
예제 #6
0
 def setUpClass(cls):
     # pinpointPy.enable_debug(None)
     pinpointPy.set_agent(collector_host="unix:/tmp/unexist.sock")
예제 #7
0
 def setUp(self):
     # self.assertTrue(pinpointPy.enable_debug(output))
     # self.assertTrue(pinpointPy.enable_debug(None))
     self.assertTrue(
         pinpointPy.set_agent(
             collector_host='unix:/tmp/collector-agent.sock'))