Пример #1
0
def current_tracker():
    return knapsack().current_tracker()
Пример #2
0
    def drop_tracker(self):
        if not self.enabled:
            return self

        knapsack().drop_tracker(self)
Пример #3
0
 def save_tracker(self):
     knapsack().save_tracker(self)
Пример #4
0
    def __init__(self, proxy, enabled=None, framework="Python"):
        self.framework = framework
        self.proxy = proxy
        self.enabled = False
        self._settings = None

        self.thread_id = knapsack().current_thread_id()

        self.background_task = False
        self.start_time = 0
        self.end_time = 0
        # FIXME
        self.queque_start = 0
        self._queue_time = 0
        self.trace_node = []
        self.async_func_trace_time = 0  # millisecond

        self._errors = []
        self.external_error = []
        self._custom_params = {}
        self._slow_sql_nodes = []

        self.http_method = "GET"
        self.request_uri = None
        self.http_status = 500
        self.request_params = {}
        self.header_params = {}
        self.cookie_params = {}
        self._priority = 0
        self._group = None
        self._name = None
        self.apdex = 0
        self._frozen_path = None

        self.stack_trace_count = 0
        self.explain_plan_count = 0

        self.thread_name = "Unknow"
        self.referer = ""

        self._trace_guid = ""
        self._trace_id = ""
        self._ssa_id = ""

        self._called_traced_data = ""
        self.call_ssa_id = ""
        self.call_req_id = ""

        self.db_time = -1
        self.external_time = -1
        self.redis_time = -1
        self.memcache_time = -1
        self.mongo_time = -1

        global_settings = proxy.global_settings
        if global_settings.enabled:
            if enabled or (enabled is None and proxy.enabled):
                self._settings = proxy.settings
                if not self._settings:
                    self.proxy.activate()
                    self._settings = proxy.settings

                if self._settings:
                    self.enabled = True

        if self.enabled:
            self._ssa_id = self._settings.tingyunIdSecret
Пример #5
0
def current_tracker():
    """return current tracker in the thread
    :return:
    """
    return knapsack().current_tracker()
Пример #6
0
    def __init__(self, proxy, enabled=None, environ=None, framework="Python"):
        """
        :param proxy: communication proxy instance to controller.
        :return:
        """
        self.environ = environ
        self.framework = framework
        self.proxy = proxy
        self.enabled = False
        self._settings = None

        self.thread_id = knapsack().current_thread_id()

        self.background_task = False
        self.start_time = 0
        self.end_time = 0
        self.queque_start = 0
        self._queque_time = 0
        self.trace_node = []
        self.async_func_trace_time = 0  # millisecond

        self._errors = []
        self.external_error = []
        self._custom_params = {}
        self._slow_sql_nodes = []

        self.http_method = "GET"
        self.request_uri = None
        self.http_status = 500
        self.request_params = {}
        self.header_params = {}
        self.cookie_params = {}
        self._priority = 0
        self._group = None
        self._name = None
        self.apdex = 0
        self._frozen_path = None

        self.stack_trace_count = 0
        self.explain_plan_count = 0

        self.thread_name = "Unknown"
        self.referer = ""

        self._trace_guid = ""
        self._trace_id = ""
        self._tingyun_id = ""

        self._called_traced_data = ""
        self.call_tingyun_id = ""
        self.call_req_id = ""

        # -1 indicate it's not called the service.
        self.db_time = -1
        self.external_time = -1
        self.redis_time = -1
        self.memcache_time = -1
        self.mongo_time = -1

        # set the global switch of agent.  the return application settings is download from server witch is merged
        # with the local settings on server
        # agent always be enabled if enabled in local settings. just not upload data when disabled by server.
        global_settings = proxy.global_settings
        if global_settings.enabled:
            if enabled or (enabled is None and proxy.enabled):
                self._settings = proxy.settings
                if not self._settings:
                    # sunyan
                    self.proxy.activate()
                    self._settings = proxy.settings

                if self._settings:
                    self.enabled = True

        if self.enabled:
            self._tingyun_id = self._settings.tingyunIdSecret