spanlint
Checks whether GenAI telemetry actually matches the OpenTelemetry GenAI semantic conventions.
Most AI frameworks now emit OpenTelemetry spans for model calls, and the GenAI semantic conventions say what those spans are supposed to contain. The two do not always agree. Attributes get left out. Old names stick around long after the spec renames them. Token metrics turn up without the right unit. Required events are missing entirely.
You normally find this out from a dashboard, when a panel is empty and nobody can say which layer dropped the attribute.
spanlint reads the telemetry a framework really emits and reports where it diverges from the spec.
Not Weaver, not the conformance suite
Weaver works on the convention
registries: the YAML that defines what an attribute is, code generation from
it, and, with weaver registry live-check, validation of sample telemetry
against them. The OpenTelemetry project runs that live-check over scenario
programs for several dozen GenAI library and instrumentation pairs in
semantic-conventions-conformance
and publishes the results. If you maintain an instrumentation, that is where
its conformance is tracked.
spanlint is for the other side. You have an application, it exports telemetry, and you want to know in CI whether what it exports still matches the conventions. It reads OTLP JSON files or captures spans in a pytest fixture, needs no mock server and no scenario, and tells you which spans came from which framework. It also carries a few checks the suite does not have today, span kind among them, and fixtures from runtimes the suite does not run (.NET, Node). The first comparison across nine frameworks is in docs/conformance/2026-11.md.
Install
pip install spanlint
Usage
Point spanlint check at an OTLP JSON export of your telemetry:
$ spanlint check trace.json
no findings
Divergences from the GenAI conventions show up as one line each, with the target span, the message, and the rule name:
$ spanlint check broken.json
chat: gen_ai.request.model must be a string [gen_ai.request.model.type]
1 finding
The exit code is nonzero whenever there are findings, so this fits a CI
step. Pass --format json for a machine-readable report:
$ spanlint check trace.json --format json
{
"findings": []
}
Line-delimited OTLP exports (.jsonl, one export per line, which is what
the OTel Collector's file exporter writes) are read the same way. The
parser is picked by the file's extension.
spanlint matrix <dir> runs the bundled framework adapters over a tree of
exports laid out as <dir>/<framework>/*.json and prints a markdown table
of finding counts per framework and rule. The fixtures in this repository
are laid out that way, so spanlint matrix tests/fixtures reproduces the
table in docs/conformance/2026-11.md.
Use in CI
In GitHub Actions, spanlint-action installs spanlint and checks a set of OTLP exports, for example the traces your integration tests write through the Collector's file exporter:
- uses: inormis/spanlint-action@v1
with:
files: traces/**/*.json
Findings show up as warnings on the files and in the job summary, and the step fails if there are any.
Supported frameworks
Framework detection is what tells spanlint which spans came from where, so per-framework conformance can be reported without mixing everything together.
- openai-python: spans from the OpenTelemetry contrib instrumentation
(
opentelemetry-instrumentation-openai-v2, scopeopentelemetry.instrumentation.openai_v2) and from Traceloop's OpenAI instrumentation (scopeopentelemetry.instrumentation.openai.v1). Identification falls back togen_ai.system=openaiorgen_ai.provider.name=openaiwhen the scope name is not one of the expected values; that is also how the contrib instrumentation'sgen_ai_latest_experimentaloutput is recognised, since that path emits from opentelemetry-util-genai's ownopentelemetry.util.genai.handlerscope. - LangChain: spans emitted by Traceloop's
opentelemetry-instrumentation-langchain, which is also what the Traceloop SDK installs, and by Arize'sopeninference-instrumentation-langchain. Identification falls back togen_ai.provider.namebeinglangchainorlanggraphwhen the scope name is not one of those. - LlamaIndex: spans from LlamaIndex's own OpenTelemetry bridge
(
llama-index-observability-otel), from Traceloop'sopentelemetry-instrumentation-llamaindex, and from Arize'sopeninference-instrumentation-llama-index. Scope name only; none of the three puts a LlamaIndex-specific attribute on every span. - LiteLLM: spans from LiteLLM's own OpenTelemetry callback (tracer name
litellm), from Traceloop'sopentelemetry-instrumentation-litellm, and from Arize'sopeninference-instrumentation-litellm. Scope name only. - Semantic Kernel (Python): spans from Semantic Kernel's own telemetry,
which is off until
SEMANTICKERNEL_EXPERIMENTAL_GENAI_ENABLE_OTEL_DIAGNOSTICSis set. Every tracer there is named after its module, so any scope starting withsemantic_kernel.counts. - Microsoft.Extensions.AI (.NET): spans from the library's
UseOpenTelemetrychat client, which puts them on theExperimental.Microsoft.Extensions.AIactivity source unless the application names its own. Scope name only. The attributes are plaingen_ai.*, so a span from a renamed source goes unrecognised. - Vercel AI SDK (Node): spans from
@ai-sdk/otel, which is where AI SDK 7 keeps its OpenTelemetry support. ItsOpenTelemetryintegration puts theinvoke_agent,agent_stepandchatspans on a tracer namedgen_ai; theLegacyOpenTelemetryone puts the olderai.generateTextspans on a tracer namedai. Either scope name counts. A legacy span under an application-supplied tracer is still recognised by itsai.operationIdattribute; a semconv one carries nothing of the SDK's own, so it is not. - Langfuse: spans from the Langfuse Python SDK, which is built on
OpenTelemetry and puts everything it emits, the
@observedecorator and its OpenAI and LangChain integrations included, on one tracer namedlangfuse-sdk. Scope name only. Thelangfuse.*attributes are no help because the SDK also copies propagated ones onto third-party spans. - Traceloop SDK: the workflow, task, agent and tool spans that the
traceloop-sdkdecorators emit under thetraceloop.tracerscope. Spans from Traceloop's per-framework instrumentations are claimed by the framework adapters above, not by this one.
More adapters land as work on them starts.
Status
Early, but it runs. You can feed it an OTLP JSON export and get a list of
findings back, in text or JSON. The rules follow the GenAI conventions as
of November 2026 (the registry is pinned to a semantic-conventions-genai
commit, see scripts/refresh_registry.sh): gen_ai.operation.name on
every GenAI span and gen_ai.provider.name where the span definitions
require it, renamed and removed attribute names,
the open operation name enum, span kind per operation, attribute types,
the two legacy message/choice events, and the token/duration histograms.
It recognises spans from the OpenAI contrib instrumentation, LangChain,
LlamaIndex, LiteLLM, Semantic Kernel, Microsoft.Extensions.AI, the Vercel
AI SDK, Langfuse and the Traceloop SDK, and spanlint matrix turns a tree
of exports into the per-framework table in docs/conformance/. There is
also a pytest fixture that grabs whatever spans your test emits so you can
lint them in place.
On PyPI as of 0.2.0, and runs in GitHub Actions through spanlint-action. Next up: a second dataset once the conventions move again.
Apache-2.0
Metadata
Release files for spanlint 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spanlint-0.2.1.tar.gz | 66.9 kB | With provenance | Details for spanlint-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spanlint-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for spanlint-0.2.1-py3-none-any.whl |
Total release size: 102.2 kB
Release files / spanlint-0.2.1.tar.gz
| Download URL | spanlint-0.2.1.tar.gz |
|---|---|
| Size | 66.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0c86dd8d2e1ca11de8df974a0b87f4f35b2e2dcd4e65baaad0c47661562a8ab
|
|
BLAKE2b-256 checksum How to use checksums |
9b668c320a6a868c8f992e48e4c9989a53d2eb83d1fa7bfc9751c19edca373a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / spanlint-0.2.1-py3-none-any.whl
| Download URL | spanlint-0.2.1-py3-none-any.whl |
|---|---|
| Size | 35.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52aa9a5fcbbdc62af2392710acbeb9cd33b5fd67aa36a40ac138ee5b162098aa
|
|
BLAKE2b-256 checksum How to use checksums |
6ee82166b2833aa39bda5d2cf7abdc0de51639073f8b77ed2a48c06145f694f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logSecurity for spanlint 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for spanlint-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.