datasette/docs
Alex Garcia 745b7872b8 Remove the hand-rolled tracer now that OpenTelemetry covers the same ground
Datasette had two tracing systems since the OpenTelemetry spans landed. The
hand-rolled one measures the wrong thing - issue 1730, open since 2022, is
about exactly that - and it cannot be rebuilt on top of the new spans without
core owning a TracerProvider, which is the one thing the OTel design refuses
to do. Rather than carry duplicate instrumentation on the db.execute() hot
path indefinitely, the old system goes.

Deleted: datasette/tracer.py, the trace_debug setting, the AsgiTracer
response-rewriting middleware and the ?_trace=1 query-string argument.

- datasette/database.py: the four `with trace(...)` wrappers PR 1 deliberately
  nested the OTel spans inside are removed and the bodies dedented. That also
  retires the `# noqa: SIM117` comments those wrappers required - a leftover
  unnecessary noqa trips ruff's RUF100 - and `kwargs["count"] = count` in
  execute_write_many, which fed the old tracer only. `git diff -w` on this file
  shows nothing but the deleted lines.
- datasette/views/base.py: stream_csv() still read ?_trace=1 to wrap CSV output
  in an HTML <textarea> debug page. That whole branch, including the
  EscapeHtmlWriter selection and the conditional content-type, is gone. The
  EscapeHtmlWriter class itself stays in datasette.utils - it is an importable
  public name and removing it would widen the API break.
- .github/workflows/deploy-latest.yml no longer passes --setting trace_debug 1.
  Worth stating precisely, because the ticket claimed otherwise: this would not
  have broken the deploy. Setting.convert() in cli.py only rewrites a bare name
  to settings.<name> for *known* settings, so `--setting trace_debug 1` would
  have been silently accepted as a meaningless top-level config key. The flag is
  removed because it is dead, not because it errors.

Tests. tests/test_tracer.py is deleted outright (6 items). Four other tests used
?_trace=1 as an assertion instrument rather than testing tracing:

- test_csv_trace tested the trace mechanism itself - deleted.
- test_table_csv_stream_does_not_calculate_facets,
  test_table_csv_stream_does_not_calculate_counts and
  test_nocount_nofacet_if_shape_is_object test real behaviour, and are rebuilt
  against captured spans. All three had silently stopped being able to fail: the
  facets test looked for "select content, count(*) as n", which facet suggestion
  has not emitted since it moved to a `with limited as (...)` CTE, and none of
  the three requested the count or facet work whose suppression they claim to
  check. The rebuilt versions ask for it explicitly, match strings the current
  SQL contains, and carry a guard assertion so an empty span list cannot
  masquerade as a pass. Each was confirmed to fail with the covered code broken.
- test_trace_correctly_escaped is kept, renamed test_query_page_escapes_sql,
  with ?_trace=1 dropped. It ran against ds_client, which has no trace_debug, so
  it never exercised the tracer - what it actually covered is the query page
  echoing user SQL into HTML, the surface of the two reflected-XSS advisories in
  issue 1360, and nothing else in the suite covers it. Deleting it would have
  quietly dropped that.

tests/test_utils.py's pairs_to_nested_config case used settings.trace_debug to
check that a later key overrides an earlier one; it now uses template_debug
rather than losing the case.

Docs: the datasette.tracer section of internals.rst, the trace_debug section of
settings.rst, the ?_trace=1 entries in json_api.rst and introspection.rst, and
the regenerated cli-reference.rst. changelog.rst gets a breaking-change entry
and keeps all its historical ?_trace=1 entries - two of them had to lose a
:ref: role pointing at a label this commit deletes, or Sphinx warns on every
build.

2368 passed, 39 skipped, 6 xfailed, 15 xpassed, 140 subtests, against 2375 /
141 before. Net -7 tests, fully accounted for: -6 test_tracer.py, -1
test_csv_trace, -1 test_trace_correctly_escaped, +1 test_query_page_escapes_sql.
The lost subtest is the per-setting case trace_debug generated in
test_settings_are_documented.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-01 16:24:35 -07:00
..
_static Add favicon to documentation (#1967) 2022-12-31 11:00:31 -08:00
_templates Drop jQuery dependency 2023-03-26 16:38:58 -07:00
.gitignore Added initial docs, including a changelog 2017-11-16 07:11:00 -08:00
authentication.rst Better permission debug tools and documentation 2026-07-14 08:40:07 -07:00
auto-build.sh Added --load-extension argument to datasette serve 2017-11-16 08:48:49 -08:00
binary_data.rst Support BLOB values in row edit UI 2026-07-03 16:09:27 -07:00
changelog.rst Remove the hand-rolled tracer now that OpenTelemetry covers the same ground 2026-09-01 16:24:35 -07:00
cli-reference.rst Remove the hand-rolled tracer now that OpenTelemetry covers the same ground 2026-09-01 16:24:35 -07:00
codespell-ignore-words.txt Move Metadata to --internal database 2024-06-11 09:33:23 -07:00
conf.py Upgrade to ruff>=0.16.0 (#2857) 2026-07-25 15:47:08 -07:00
configuration.rst textarea column type 2026-06-13 22:18:45 -07:00
contributing.rst Add cache-busted static asset helper (#2804) 2026-06-23 13:44:58 -07:00
csv_export.rst Use shot-scraper images from datasette-screenshots repo, closes #1844 2022-10-14 12:57:00 -07:00
custom_templates.rst Improve docs structure for static(), refs #2804, #2800 2026-06-23 13:59:01 -07:00
datasette-0.51.png Release 0.51 2020-10-31 15:21:49 -07:00
datasette-logo.svg Added new logo to the documentation 2020-07-12 12:53:29 -07:00
deploying.rst Add test for RST heading underline lengths, closes #2544 2025-10-26 09:49:49 -07:00
ecosystem.rst Shrunk ecosystem docs in favour of datasette.io, closes #1182 2021-01-09 14:17:18 -08:00
events.md RenameTableEvent, plus write connection track_event() mechanism (#2682) 2026-03-30 11:20:46 -07:00
facets.rst Move table configuration docs from metadata.rst to configuration.rst (#2668) 2026-03-17 08:47:04 -07:00
full_text_search.rst Move table configuration docs from metadata.rst to configuration.rst (#2668) 2026-03-17 08:47:04 -07:00
getting_started.rst Replace Glitch with Codespaces, closes #2488 2025-05-28 19:17:22 -07:00
index.rst Generated template context documentation, closes #1510 2026-06-11 07:47:15 -07:00
installation.rst Remove Datasette Desktop from installation guide 2026-07-07 14:04:46 -07:00
internals.rst Remove the hand-rolled tracer now that OpenTelemetry covers the same ground 2026-09-01 16:24:35 -07:00
introspection.rst Remove the hand-rolled tracer now that OpenTelemetry covers the same ground 2026-09-01 16:24:35 -07:00
javascript_plugins.rst Better docs for makeJumpSections() 2026-06-14 16:28:09 -07:00
json_api.rst Remove the hand-rolled tracer now that OpenTelemetry covers the same ground 2026-09-01 16:24:35 -07:00
json_api_doc.py Upgrade to ruff>=0.16.0 (#2857) 2026-07-25 15:47:08 -07:00
Makefile Document custom json encoder (#1996) 2026-06-23 16:24:03 -07:00
metadata.rst Move table configuration docs from metadata.rst to configuration.rst (#2668) 2026-03-17 08:47:04 -07:00
metadata_doc.py Upgrade to ruff>=0.16.0 (#2857) 2026-07-25 15:47:08 -07:00
pages.rst Unify page-size parameters on _size with table semantics 2026-07-04 17:54:03 +00:00
performance.rst Release 0.63a1 2022-10-23 20:07:09 -07:00
plugin_hooks.rst Return 401 for invalid or expired bearer tokens 2026-07-04 15:18:12 +00:00
plugins.rst Advise plugin authors on naming secret configuration keys 2026-07-06 23:09:10 +00:00
publish.rst Remove all remaining "$ " prefixes from docs, closes #2140 2023-08-11 10:44:34 -07:00
settings.rst Remove the hand-rolled tracer now that OpenTelemetry covers the same ground 2026-09-01 16:24:35 -07:00
spatialite.rst Renamed canned queries to queries / stored queries in docs 2026-05-26 15:17:51 -07:00
sql_queries.rst Return 400 for write canned-query SQL failures 2026-07-04 14:35:54 +00:00
telemetry_doc.py Name every span and attribute once, in a registry the docs are built from 2026-09-01 16:24:35 -07:00
template_context.rst Remove the next_url extra - the key is always present 2026-07-06 23:59:53 +00:00
template_context_doc.py Upgrade to ruff>=0.16.0 (#2857) 2026-07-25 15:47:08 -07:00
testing_plugins.rst datasette.fixtures module, closes #2733 2026-05-21 23:05:37 -07:00
upgrade-1.0a20.md Renamed canned queries to queries / stored queries in docs 2026-05-26 15:17:51 -07:00
upgrade_guide.md Replace token-based CSRF with Sec-Fetch-Site header protection (#2689) 2026-04-14 17:11:36 -07:00
writing_plugins.rst Add cache-busted static asset helper (#2804) 2026-06-23 13:44:58 -07:00