Repository navigation
Conversation
Declares every span, metric and attribute in telemetry_registry.py using Datasette 1.0a41's plugin telemetry kit. No instrumentation yet. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Each run is a new trace linked to the request (or restart) that started it, with a child span per batch. Adds run/batch/row/cost metrics. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Registry conformance via Datasette's telemetry_testing kit, sentinel privacy checks, and a cog-generated span/metric reference checked in CI. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Sep 28, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Claude-generated PR description
Adds enrichment-specific OpenTelemetry spans and metrics, built on Datasette 1.0a41's plugin telemetry kit.
Stack: lint (#63) → 1.0a41 compatibility (#64) → supervised background tasks (#65) → empty jobs (#66) → telemetry (this PR). The base branch is
otel/02b-empty-jobs.There are three commits, one per step:
opentelemetry-api>=1.37becomes a runtime dependency;opentelemetry-sdkis dev-only.telemetry_registry.pyis the single source of truth for every wire name: 5 spans, 6 metrics, and 14 attributes underenrichments.*, plus core'sdb.namespaceanderror.type.telemetry.pyholds API-only helpers. It never imports the SDK, and with no provider installed everything is a no-op. It has noschema_url. Spans are always started withrecord_exception=Falseandset_status_on_exception=False.enrichments.job.run, linked to whatever started it. It carriestrigger=enqueue|resume|restart. What it links to:enrichments.batchis a span per batch (never per row). The internal row fetch nests under it through injected W3C trace headers. That is a workaround for OpenTelemetry: datasette.client requests start a new trace instead of nesting under the caller's span simonw/datasette#2969, and a comment links it.enrichments.initializeis a child of the POST;enrichments.finalizeis a child of the run;enrichments.restart.job.runsjob.runs.activejob.run.durationbatch.durationrowscostfinished,paused,cancelled,stopped,interrupted(shutdown) anderror.error.typeis only ever the class name.start_enrichment_in_process()gains an optionaltrigger=keyword argument, so existing callers keep working.Static registry tests: names are pinned, the prefix rule holds, metric dimensions are bounded, buckets are set where needed, and every entry has a description.
One workload fires every signal, checked in both directions: everything emitted is declared, and everything declared is emitted.
The privacy sentinel test plants unique strings in:
It then asserts none of them appears in any span or metric. That includes core's spans (no
scope_name).docs/telemetry.md:_whereliterals end up indb.query.text, and failed DB calls record their exception message on core's spanA "Telemetry" section for enrichment authors in
developing.md.cog --check docs/*.mdadded to the CIlintjob, andcogappadded to the dev group.Also edits one registry description string, for
batch.outcome.Privacy
The telemetry never records:
filter_querystringnext_cursoractor_idThis is enforced by the sentinel test. Independent reviews confirmed zero leaks across all scopes.
Testing
-W error::pytest.PytestUnraisableExceptionWarning.test_wire_names_are_pinned.json.dumps(config)fails the privacy test.finalize_spanfailsassert_spans_covered.test_batch_spans_are_children_of_run.🤖 Generated with Claude Code