mirror of
https://github.com/simonw/datasette.git
synced 2026-09-16 13:34:07 +02:00
The database instrumentation covered the four SQL-string entry points but not the callback entry points, which are the documented way for plugins to run arbitrary SQL - so the JSON write API's inserts and deletes, the startup catalog scan, and every plugin built on execute_fn/execute_write_fn were invisible to a trace, or worse, showed orphan-looking db.write.* spans with no db.query above them. Each callback method now opens the same db.query CLIENT span as its SQL-string sibling, carrying a new optional datasette.callback attribute (the callable's qualified name, captured before _wrap_fn_with_hooks() can rename it) in place of db.query.text, which is now marked optional. A bare execute_fn() also wraps the callback in a db.query.execute child, so the "gap between the spans is thread-wait" story holds for plugin callbacks too. No db.operation.name: there is no statement to take a keyword from, and the registry says that attribute is omitted rather than guessed. The previous bodies move to private _execute_fn()/_execute_write_fn() and the SQL-string methods call those, so an execute() emits exactly the spans it did before - pinned by test_execute_does_not_double_wrap. Database's own introspection helpers stay on the public method deliberately: they are real SQLite round trips, which lifts a table page from ~58 to ~100 (no-op) spans. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012U7coQfVu8nK2R4q2mCULA |
||
|---|---|---|
| .. | ||
| default_permissions | ||
| publish | ||
| static | ||
| templates | ||
| utils | ||
| views | ||
| __init__.py | ||
| __main__.py | ||
| _pytest_plugin.py | ||
| actor_auth_cookie.py | ||
| app.py | ||
| blob_renderer.py | ||
| cli.py | ||
| column_types.py | ||
| csrf.py | ||
| database.py | ||
| default_actions.py | ||
| default_column_types.py | ||
| default_database_actions.py | ||
| default_debug_menu.py | ||
| default_jump_items.py | ||
| default_magic_parameters.py | ||
| default_query_actions.py | ||
| default_table_actions.py | ||
| events.py | ||
| extras.py | ||
| facets.py | ||
| filters.py | ||
| fixtures.py | ||
| forbidden.py | ||
| handle_exception.py | ||
| hookspecs.py | ||
| inspect.py | ||
| jump.py | ||
| permissions.py | ||
| plugins.py | ||
| renderer.py | ||
| resources.py | ||
| sql_functions.py | ||
| stored_queries.py | ||
| telemetry.py | ||
| telemetry_registry.py | ||
| template_contexts.py | ||
| tokens.py | ||
| tracer.py | ||
| url_builder.py | ||
| version.py | ||
| write_sql.py | ||