Exemple #1
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)
Exemple #2
0
    def handleHttpHeader(self, url, headers):

        self.url = url
        # headers[SAMPLED] = pinpointPy.get_special_key(SAMPLED)
        if pinpointPy.check_tracelimit():
            headers[SAMPLED] = 's0'
            return
        else:
            headers[SAMPLED] = 's1'
        headers[PINPOINT_PAPPTYPE] = '1700'
        headers[PINPOINT_PAPPNAME] = APP_NAME
        headers['Pinpoint-Flags'] = "0"
        headers[PINPOINT_HOST] = self.getHostFromURL(self.url)
        headers[PINPOINT_TRACEID] = pinpointPy.get_special_key('tid')
        headers[PINPOINT_PSPANID] = pinpointPy.get_special_key('sid')
        self.nsid = self.generateSid()
        headers[PINPOINT_SPANID] = self.nsid
    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)