def enable(cls, flush_interval=None, tracer=None, dogstatsd_url=None):
        # type: (Optional[float], Optional[ddtrace.Tracer], Optional[str]) -> None
        with cls._lock:
            if cls._instance is not None:
                return
            runtime_worker = cls(flush_interval, tracer, dogstatsd_url)  # type: ignore[arg-type]
            runtime_worker.start()
            # force an immediate update constant tags
            runtime_worker.update_runtime_tags()

            forksafe.register(cls._restart)

            cls._instance = runtime_worker
Esempio n. 2
0
    def enable(flush_interval=None, tracer=None, dogstatsd_url=None):
        # type: (Optional[float], Optional[ddtrace.Tracer], Optional[str]) -> None
        with RuntimeWorker._lock:
            if RuntimeWorker._instance is not None:
                return

            runtime_worker = RuntimeWorker(flush_interval, tracer,
                                           dogstatsd_url)
            runtime_worker.start()
            # force an immediate update constant tags
            runtime_worker.update_runtime_tags()

            forksafe.register(RuntimeWorker._restart)

            RuntimeWorker._instance = runtime_worker
Esempio n. 3
0
 def __init__(self):
     self.state = 0
     self.method = forksafe.register(after_in_child=self.after_fork)(
         self.method)
Esempio n. 4
0
 def __init__(self):
     self.state = 0
     forksafe.register(self.after_fork)
Esempio n. 5
0
 def state_append_3():
     forksafe.register(state.append(3))
Esempio n. 6
0
 def state_append_1():
     forksafe.register(state.append(1))
Esempio n. 7
0
 def __attrs_post_init__(self):
     # type: (...) -> None
     self._reset_events()
     forksafe.register(self._after_fork)