mirror of
https://github.com/simonw/datasette.git
synced 2026-09-03 23:24:07 +02:00
- Remove the registry's unused prefix=True slot, its span_for() branch, its doc-rendering case and its test - nothing in the stack sets it. - Stop promising a "later phase" query-duration metric dimension in the db.operation.name description; the cardinality rationale stands alone. - Replace baked-in benchmark numbers in the telemetry module docstring with the docs' own phrasing (below run-to-run variation). - Compact the duplicated copy_context() and enqueue-site comments in database.py to pointers at their canonical tellings. - Make the "catch people out" gotchas skimmable as a bullet list and give the changelog's "nothing is removed" line a clear antecedent. - Add a test that a result cut short by max_returned_rows records datasette.truncated=True - previously only ever asserted False. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012U7coQfVu8nK2R4q2mCULA
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
"""
|
|
Render the span reference in ``internals.rst`` from
|
|
``datasette/telemetry_registry.py``.
|
|
|
|
Driven by cog, and ``cog --check docs/*.rst`` runs in CI - so adding a span
|
|
without documenting it, or documenting one that no longer exists, is a build
|
|
failure rather than something a reader discovers later.
|
|
"""
|
|
|
|
|
|
def _attribute_lines(cog, attributes):
|
|
if not attributes:
|
|
cog.out(" No attributes.\n\n")
|
|
return
|
|
cog.out(" Attributes:\n\n")
|
|
for attribute in attributes:
|
|
suffix = " *(optional)*" if attribute.optional else ""
|
|
cog.out(f" - ``{attribute}``{suffix} - {attribute.description}\n")
|
|
cog.out("\n")
|
|
|
|
|
|
def spans(cog):
|
|
from opentelemetry.trace import SpanKind
|
|
|
|
from datasette.telemetry_registry import SPANS
|
|
|
|
cog.out("\n")
|
|
for span in SPANS:
|
|
cog.out(f"``{span}``\n")
|
|
cog.out(f" {span.description}\n\n")
|
|
# INTERNAL is the default and the overwhelming majority of spans -
|
|
# printing it on every one would be noise. Only the exceptional case,
|
|
# a real database call, is worth calling out.
|
|
if span.kind != SpanKind.INTERNAL:
|
|
cog.out(f" Kind: ``{span.kind.name}``.\n\n")
|
|
_attribute_lines(cog, span.attributes)
|