def flush(self): """Flush events from recorder to exporters.""" LOG.debug("Flushing events") events = self.recorder.reset() total_events = sum(len(v) for v in events.values()) for exp in self.exporters: try: exp.export(events) 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)
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" )
def __init__(self, exception): """Create a failed upload error based on raised exceptions.""" self.exception = exception super(UploadFailed, self).__init__("Unable to upload: " + _traceback.format_exception(exception))
def test_traceback(): assert _traceback.format_exception( Exception("hello")) == "Exception: hello"
def __init__(self, exception, msg=None): """Create a failed upload error based on raised exceptions.""" self.exception = exception msg = _traceback.format_exception(exception) if msg is None else msg super(UploadFailed, self).__init__("Unable to upload profile: " + msg)