def _start_service(self): # type: ignore[override] # type: (...) -> None """Start the scheduler.""" LOG.debug("Starting scheduler") super(Scheduler, self)._start_service() self._last_export = compat.time_ns() LOG.debug("Scheduler started")
def test_export_tracer_base_path_agent_less(endpoint_test_server): # Base path is ignored by the profiling HTTP exporter # because the endpoint path starts with a slash. exp = http.PprofHTTPExporter(_ENDPOINT + "/profiling/", _API_KEY, endpoint_path="/profiling/v1/input") exp.export(test_pprof.TEST_EVENTS, 0, compat.time_ns())
def test_export_tracer_base_path(endpoint_test_server): # Base path is prepended to the endpoint path because # it does not start with a slash. exp = http.PprofHTTPExporter(_ENDPOINT + "/profiling/", _API_KEY, endpoint_path="v1/input") exp.export(test_pprof.TEST_EVENTS, 0, compat.time_ns())
def flush(self): """Flush events from recorder to exporters.""" LOG.debug("Flushing events") if self.before_flush is not None: try: self.before_flush() except Exception: LOG.error("Scheduler before_flush hook failed", exc_info=True) 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 test_export(endpoint_test_server): exp = http.PprofHTTPExporter(_ENDPOINT, _API_KEY) exp.export(test_pprof.TEST_EVENTS, 0, compat.time_ns())
def start(self): """Start the scheduler.""" LOG.debug("Starting scheduler") super(Scheduler, self).start() self._last_export = compat.time_ns() LOG.debug("Scheduler started")