mirror of
https://github.com/simonw/datasette.git
synced 2026-09-07 17:14:07 +02:00
invoke_startup() runs before any request exists, so nothing it does has an ambient span to nest under. Measured on a fresh instance: 19 distinct traces, 19 of them single- or few-span roots - the register_* hook dispatches, the internal catalog's db.query reads and its db.write.* catalog writes. In a trace UI that is nineteen pieces of noise sitting next to every real trace, which for an operator opening Jaeger for the first time is the difference between "this works" and "this is unusable". Bracketing the whole method body in one datasette.startup span takes that to 1. This is not a propagation fix - ticket 04's context propagation was already correct, it simply had nothing to propagate. The bulk of the app.py diff is re-indentation; `git diff -w` shows the real change (plus one line-length rewrap black applied to the StartupError raise). register_output_renderer and asgi_wrapper stay orphans deliberately: both are dispatched from Datasette.__init__ / .app(), before invoke_startup() exists to be called, and wrapping them would mean holding a span open across object construction in library code that may never serve a request. Suppressing instrumentation during warm-up was rejected as an alternative: a slow prepare_connection runs on every connection, not just at startup, and is exactly what tracing should reveal. Also corrects the stale write-thread warm-up comment in database.py. It is still a root, but for a reason worth stating precisely: a raw threading.Thread does not inherit the starting thread's context, so the datasette.startup span current on the event loop does not reach it. Read connections do warm up under copy_context() and nest correctly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| plugins | ||
| test_templates | ||
| __init__.py | ||
| build_small_spatialite_db.py | ||
| conftest.py | ||
| ext.c | ||
| fixtures.py | ||
| spatialite.db | ||
| test-datasette-load-plugins.sh | ||
| test_actions_sql.py | ||
| test_actor_restriction_bug.py | ||
| test_allowed_many.py | ||
| test_allowed_resources.py | ||
| test_api.py | ||
| test_api_write.py | ||
| test_auth.py | ||
| test_autocomplete.py | ||
| test_base_view.py | ||
| test_cli.py | ||
| test_cli_serve_get.py | ||
| test_cli_serve_server.py | ||
| test_column_types.py | ||
| test_config_dir.py | ||
| test_config_permission_rules.py | ||
| test_crossdb.py | ||
| test_csrf_middleware.py | ||
| test_csv.py | ||
| test_custom_pages.py | ||
| test_datasette_https_server.sh | ||
| test_debug_autocomplete.py | ||
| test_default_deny.py | ||
| test_docs.py | ||
| test_docs_plugins.py | ||
| test_error_shape.py | ||
| test_extras.py | ||
| test_facets.py | ||
| test_fd_leak.py | ||
| test_filters.py | ||
| test_fixtures.py | ||
| test_html.py | ||
| test_internal_db.py | ||
| test_internals_database.py | ||
| test_internals_datasette.py | ||
| test_internals_datasette_client.py | ||
| test_internals_request.py | ||
| test_internals_response.py | ||
| test_internals_urls.py | ||
| test_jump.py | ||
| test_label_column_for_table.py | ||
| test_lifespan.py | ||
| test_load_extensions.py | ||
| test_messages.py | ||
| test_multipart.py | ||
| test_package.py | ||
| test_permission_endpoints.py | ||
| test_permissions.py | ||
| test_playwright.py | ||
| test_plugins.py | ||
| test_publish_cloudrun.py | ||
| test_publish_heroku.py | ||
| test_pytest_autoclose_plugin.py | ||
| test_queries.py | ||
| test_restriction_sql.py | ||
| test_routes.py | ||
| test_schema_endpoints.py | ||
| test_search_tables.py | ||
| test_spatialite.py | ||
| test_stored_queries.py | ||
| test_success_envelope.py | ||
| test_table_api.py | ||
| test_table_html.py | ||
| test_telemetry.py | ||
| test_template_context.py | ||
| test_token_handler.py | ||
| test_tracer.py | ||
| test_utils.py | ||
| test_utils_check_callable.py | ||
| test_utils_permissions.py | ||
| test_utils_sql_analysis.py | ||
| test_write_sql_operation_decisions.py | ||
| test_write_wrapper.py | ||
| utils.py | ||