Пример #1
0
 def start(self):
     """Start the scheduler."""
     self._periodic = _periodic.PeriodicThread(
         self.interval,
         self.flush,
         name="%s:%s" % (__name__, self.__class__.__name__))
     LOG.debug("Starting scheduler")
     self._last_export = compat.time_ns()
     self._periodic.start()
     LOG.debug("Scheduler started")
Пример #2
0
 def flush(self):
     """Flush events from recorder to exporters."""
     LOG.debug("Flushing events")
     events = self.recorder.reset()
     start = self._last_export
     self._last_export = compat.time_ns()
     total_events = sum(len(v) for v in events.values())
     for exp in self.exporters:
         try:
             exp.export(events, start, self._last_export)
         except exporter.ExportError as e:
             LOG.error("Unable to export %d events: %s", total_events,
                       _traceback.format_exception(e))
         except Exception:
             LOG.exception("Error while exporting %d events", total_events)
Пример #3
0
 def flush(self):
     """Flush events from recorder to exporters."""
     LOG.debug("Flushing events")
     if self.exporters:
         events = self.recorder.reset()
         start = self._last_export
         self._last_export = compat.time_ns()
         for exp in self.exporters:
             try:
                 exp.export(events, start, self._last_export)
             except exporter.ExportError as e:
                 LOG.error("Unable to export profile: %s. Ignoring.", _traceback.format_exception(e))
             except Exception:
                 LOG.exception(
                     "Unexpected error while exporting events. "
                     "Please report this bug to https://github.com/DataDog/dd-trace-py/issues"
                 )
Пример #4
0
def test_export(endpoint_test_server):
    exp = http.PprofHTTPExporter(_ENDPOINT, _API_KEY)
    exp.export(test_pprof.TEST_EVENTS, 0, compat.time_ns())
Пример #5
0
 def start(self):
     """Start the scheduler."""
     LOG.debug("Starting scheduler")
     super(Scheduler, self).start()
     self._last_export = compat.time_ns()
     LOG.debug("Scheduler started")