logfire
CLAUDE.md4.5k starsChanged 3 months agoMITView on GitHub
Pydantic Logfire is an observability platform built on OpenTelemetry. This repository contains the Python SDK for Logfire and documentation. The server application for recording and displaying data is closed source. Key aspects: - Opinionated wrapper around OpenTelemetry (traces, metrics, logs) - Extensive integrations with popular Python packages - SQL-based querying of telemetry data Pre-commit automatically runs ruff and pyright, but you can also run make format/lint/typecheck to run them explicitly, particularly to check files that haven't been changed. Docs are…
- Commits and pushes
Trending
Quiet since March.thin dataabout the whole repository
Who's talking about pydantic/logfire
- pydantic/pydantic-ai“Support embeddings models”GitHub · Oct 24, 2025 · 11 reactions
- open-telemetry/opentelemetry-python-contrib“`opentelemetry-instrumentation-psycopg` claims to work for async queries, but doesn't record time”GitHub · May 1, 2024 · 8 reactions
- open-telemetry/opentelemetry-python-contrib“Google GenAI instrumentation needs to count thinking tokens”GitHub · Oct 21, 2025 · 6 reactions
- pydantic/pydantic-ai“Evals fail to run if logfire is not available”GitHub · Apr 7, 2025 · 5 reactions
- ollama/ollama“OpenAI-compatible API tool calls have no index”GitHub · Nov 29, 2024 · 4 reactions
The biggest 5 of 14 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 14
Talked about on GitHub, Hacker News and Bluesky (14 times).
On GitHub · 11
- Oct 24, 2025Support embeddings models — pydantic/pydantic-ai11 reactions · 38 comments
- May 1, 2024`opentelemetry-instrumentation-psycopg` claims to work for async queries, but doesn't record time — open-telemetry/opentelemetry-python-contrib8 reactions · 3 comments
- Oct 21, 2025Google GenAI instrumentation needs to count thinking tokens — open-telemetry/opentelemetry-python-contrib6 reactions · 5 comments
- Apr 7, 2025Evals fail to run if logfire is not available — pydantic/pydantic-ai5 reactions
- Nov 29, 2024OpenAI-compatible API tool calls have no index — ollama/ollama4 reactions · 3 comments
6 more on GitHub
- Mar 20, 2026Write a wikipedia article for Apache DataFusion — apache/datafusion3 reactions · 15 comments
- Nov 27, 2024PEP 541 Request: `logfire-python` — pypi/support3 reactions · 2 comments
- Aug 12, 2025ModuleNotFoundError after release logfire 4.3.0 — pydantic/pydantic-ai2 reactions · 3 comments
- Jul 21, 2025Tracing not working for logfire - they suggest slightly changing how trace data is sent — agno-agi/agno2 reactions · 14 comments
- Jul 2, 2025Tool calls and responses not recorded in message events in opentelemetry-instrumentation-google-genai — open-telemetry/opentelemetry-python-contrib2 reactions · 6 comments
- Nov 12, 2024Role field should not be repeated in streamed response chunks — ollama/ollama2 reactions · 1 comment
On Hacker News · 2
- Aug 29, 2024Pydantic Logfire Switches from Timescale to Datafusion3 points · 2 comments
- May 6, 2024Pydantic logfire: Uncomplicated Observability for Python and beyond1 point
On Bluesky · 1
- May 2, 2024Logfire : une plateforme d'observabilité Open Source. Il offre un dashboard, permettant une analyse approfondie des applications Python. Il… — @bearstech.com1 likes and repost
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/guides/web-ui/agents.mdAGENTS.md
- docs/integrations/agent-frameworks/CLAUDE.mdCLAUDE.md
- update-depsSkill
- logfire-evalsSkill
- logfire-infrastructureSkill
- logfire-instrumentationSkill
- logfire-setupSkill
The file
We split this CLAUDE.md into the rules it gives an agent
7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
When linking between pages in this repository, use source-relative .md links.
- Very specific: line 31
Every page in the public docs (docs/) is held to one standard:
- Very specific: line 80
If the output changes, running again will automatically update the snapshot in the code.
- Very specific: line 93
Use @pytest.mark.anyio for async tests.
- Very specific: line 101
Avoid constructing LogfireConfig or Logfire instances unless absolutely necessary.
- Distinctive: line 134
Read each new review comment.
- Distinctive: line 143
Use git push origin HEAD to push, not just git push, so that it pushes to the current branch without needing to set upstream explicitly.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Pydantic Logfire is an observability platform built on OpenTelemetry. This repository contains the Python SDK for Logfire and documentation. The server application for recording and displaying data is closed source.
Key aspects:
- Opinionated wrapper around OpenTelemetry (traces, metrics, logs)
- Extensive integrations with popular Python packages
- SQL-based querying of telemetry data
Code Quality
Pre-commit automatically runs ruff and pyright, but you can also run make format/lint/typecheck to run them explicitly, particularly to check files that haven't been changed.
Documentation
Docs are rendered and deployed through the pydantic/unified-docs pipeline. Do not use MkDocs checks in this repository.
When linking between pages in this repository, use source-relative .md links. Published routes can
differ from source paths because docs/navigation.yml defines the published
sidebar and route map. When adding, moving, or removing a public docs page, update that manifest in
the same PR. Its public schema provides editor validation; contributors do not need a unified-docs
checkout. Verify the page and any anchor in a rendered preview, and never include the
deployment-specific /docs prefix in source links.
The TypeScript subtree under Instrument is imported from
pydantic/logfire-js/docs/navigation.yml. Change its page order, labels, slugs,
and aliases in logfire-js; this manifest owns only the subtree's placement.
Writing standard
The full documentation style guide is dev-docs/documentation-style-guide.md — page templates, the terminology glossary, the pre-publish checklist, the anti-pattern catalog, and the rules for AI-assisted authoring. Read it before writing or substantially editing a docs page.
Every page in the public docs (docs/) is held to one standard:
If an expert in some other field who has just started building with AI tools wouldn't know what it means, we spell out the acronym, we explain the term in place, or we rewrite the sentence to be human friendly.
This is about introducing terms, not avoiding them — give the real word plus a plain-language hand-hold at first use. Docstrings and other in-code text follow normal API-reference conventions and are out of scope.
Core Structure
logfire-sdk/
└── logfire/
├── __init__.py # Public API via DEFAULT_LOGFIRE_INSTANCE
├── _internal/ # Internal implementation
│ ├── main.py # Logfire and LogfireSpan classes
│ ├── config.py # LogfireConfig, configuration setup
│ ├── config_params.py # Environment variable and config file handling
│ ├── tracer.py # ProxyTracerProvider, tracer wrapping
│ ├── metrics.py # ProxyMeterProvider, metrics handling
│ ├── exporters/ # OTLP, console, test exporters and processors
│ ├── integrations/ # Framework-specific instrumentation
│ ├── auto_trace/ # AST rewriting for auto-instrumentation
│ └── ...
├── integrations/ # Public integration APIs
└── experimental/ # Experimental features
logfire/ # Compatibility package that installs the SDK and CLI
logfire-api/ # No-op shim package for libraries
tests/ # Test suite
docs/ # Documentation source for unified docsTesting
Tests that create spans should follow this pattern:
from inline_snapshot import snapshot
from logfire.testing import TestExporter
import logfire
def test_my_thing(exporter: TestExporter):
# create spans, e.g:
with logfire.span("a span"):
...
assert exporter.exported_spans_as_dict(parse_json_attributes=True) == snapshot()Then run uv run pytest -k test_my_thing --inline-snapshot=fix to automatically fill in snapshot() with a list of dicts and check that the results are sane.
If the output changes, running again will automatically update the snapshot in the code.
TestExporter normalizes common things. If some remaining fields are non-deterministic (e.g., IDs, timestamps), use dirty_equals matchers, e.g:
from dirty_equals import IsStr
from inline_snapshot import snapshot
assert ... == snapshot({
'name': 'foo',
'random_id': IsStr(),
})Use @pytest.mark.anyio for async tests.
Emitting a warning is safe even though the test suite converts warnings to errors. When a warning is intentional, update affected tests to expect it or narrow their warning filters instead of suppressing the warning in production code. Suppress a warning at a call site only when it would be a known duplicate or is intentionally irrelevant there.
Some tests are decorated with @pytest.mark.vcr() and use pytest-recording to record HTTP interactions. Existing VCR cassette files should suffice. When creating a new test like this, run uv run pytest -k test_my_thing --inline-snapshot=fix --record-mode=rewrite.
Tests should use user-facing APIs as much as possible. Minimize mocking and reaching into internals.
Avoid constructing LogfireConfig or Logfire instances unless absolutely necessary. Use logfire.configure() instead, typically with the config_kwargs fixture, and even then only if the default configuration done for each test doesn't already suffice.
There's no need to write lf = logfire.configure(...); lf.foo(). Write logfire.configure(...); logfire.foo(). There's also generally no need to explicitly call logfire.shutdown().
logfire-api
The logfire-api package is a no-op shim that libraries can depend on to avoid hard dependencies on Logfire itself. It provides minimal 'implementations' in logfire-api/logfire_api/__init__.py, which needs to be kept up to date with the public API of the logfire module, especially if test_logfire_api.py starts failing. The rest is just .pyi stubs which should be ignored and are autogenerated when needed during release.
CI
CI is required to pass on main, so pre-existing CI failures are unlikely. If the same test fails across multiple Python version jobs, it's almost certainly caused by your changes — investigate rather than assuming it's a flaky pre-existing issue.
Coverage
Coverage must be 100%. The bar is the uv run coverage report --fail-under 100 step of the coverage job in .github/workflows/main.yml, not pyproject.toml — [tool.coverage.report] sets no fail_under, so reading pyproject.toml suggests there is no bar and a plain coverage report exits 0 on a regression.
Let CI measure it rather than running the suite under coverage locally: CI combines coverage across the whole test matrix, so a line reached only by another matrix job looks missed on one machine, and a local number is both slow to get and misleading. When the coverage job fails it names the file and the missing lines and branches; cover those and push again. Reach for a local run only to check a specific file you are iterating on, with uv run coverage run -m pytest <the relevant tests> followed by uv run coverage report --include='*/<file>.py'.
The check job
The check job runs no checks of its own: it uses the alls-green action to combine the other jobs' results into a single pass or fail. Its log therefore only names which job failed, so open that job and read its log to find the cause.
Pydantic version coverage
PR CI only tests pydantic latest plus one extra job at pydantic 2.4. The full set of supported minor versions (2.4, 2.5, 2.6, ... up through main) is exercised by the twice-monthly job in .github/workflows/deps_test.yml, scheduled for the 1st and 15th. This workflow is the contract: every minor version listed there is meant to keep working.
When something fails on pydantic 2.4, do not assume it is a 2.4-only quirk. The same problem is likely to affect some of the other listed versions as well. Investigate which versions are actually affected (e.g. read the upstream changelog, install one of the in-between versions locally and reproduce) and fix or work around for the whole affected range. A green PR CI is not enough — if you only verify against 2.4 and latest, the twice-monthly job will fail later even though the PR merged cleanly.
Iterating on a pull request
A pull request is ready when CI is green and no review thread is unresolved. Run this loop until both hold.
- Watch the checks until they settle, then fix every failure.
- Read each new review comment. Several AI reviewers comment on pull requests here; verify each finding against this repository's code, configuration and history before acting on it. Do not assume a reviewer is right, and do not assume it is wrong.
- Fix what the valid findings call for. Reply to every thread with what you changed, or with the evidence that the finding does not apply here.
- Resolve each thread once you have replied. Leave a thread unresolved only to hold an open question that needs a maintainer's decision — one the repository's own docs, configuration and history cannot settle.
- Return to step 1 after every push, because reviewers comment again on the new commit.
A reviewer can be right about Python in general and wrong about this repository. For example, a reviewer may report a Ruff S106 violation (hardcoded password passed as an argument). [tool.ruff.lint] in pyproject.toml selects E4, E7, E9 and F, plus an extend-select list that does not contain S, and uv run ruff check --select S106 reports many pre-existing hits. The rule is not enabled, so there is nothing to fix. Check the configuration that governs a finding before you accept it.
Misc
Use git push origin HEAD to push, not just git push, so that it pushes to the current branch without needing to set upstream explicitly.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

