# Pydantic Logfire > Pydantic Logfire Documentation Logfire is a powerful and scalable AI observability platform that can trace your entire application. SQL-queryable, integrated MCP server, OpenTelemetry-based, Logfire has native SDKs for Python, TypeScript/JavaScript, Rust and works with any Otel language. ## Getting Started - [AI & LLM Observability](https://pydantic.dev/docs/logfire/get-started/ai-observability/index.md): Monitor, debug, and optimize your AI agents and LLM applications with Pydantic Logfire. Full-stack observability for the AI era. - [vs Arize Phoenix](https://pydantic.dev/docs/logfire/get-started/comparisons/arize-phoenix/index.md) - [vs Braintrust](https://pydantic.dev/docs/logfire/get-started/comparisons/braintrust/index.md) - [vs Datadog](https://pydantic.dev/docs/logfire/get-started/comparisons/datadog/index.md) - [vs Grafana](https://pydantic.dev/docs/logfire/get-started/comparisons/grafana/index.md) - [Overview](https://pydantic.dev/docs/logfire/get-started/comparisons/index.md) - [vs Langfuse](https://pydantic.dev/docs/logfire/get-started/comparisons/langfuse/index.md) - [vs LangSmith](https://pydantic.dev/docs/logfire/get-started/comparisons/langsmith/index.md) - [vs Sentry](https://pydantic.dev/docs/logfire/get-started/comparisons/sentry/index.md) - [vs SigNoz](https://pydantic.dev/docs/logfire/get-started/comparisons/signoz/index.md) - [Core Concepts](https://pydantic.dev/docs/logfire/get-started/concepts/index.md): Explore how Logfire handles spans, traces, metrics, and event data to help you monitor, debug, and optimize your application. - [FAQ](https://pydantic.dev/docs/logfire/get-started/faq/index.md): Frequently asked questions about Pydantic Logfire - AI observability, language support, pricing, self-hosting, and more. - [Get Help](https://pydantic.dev/docs/logfire/get-started/help/index.md): Need to send alerts to Slack from Logfire? This guide shows how to create a Slack webhook and define SQL-based alert criteria for your Slack alert system. - [](https://pydantic.dev/docs/logfire/get-started/how-to-guides/cloud-metrics/index.md) - [](https://pydantic.dev/docs/logfire/get-started/how-to-guides/otel-collector/host-monitoring/index.md) - [](https://pydantic.dev/docs/logfire/get-started/how-to-guides/otel-collector/kubernetes-monitoring/index.md) - [](https://pydantic.dev/docs/logfire/get-started/how-to-guides/otel-collector/otel-collector-overview/index.md) - [](https://pydantic.dev/docs/logfire/get-started/how-to-guides/otel-collector/otel-collector-scrubbing/index.md) - [](https://pydantic.dev/docs/logfire/get-started/how-to-guides/otel-collector/s3-backup/index.md) - [](https://pydantic.dev/docs/logfire/get-started/integrations/aws-lambda/index.md) - [](https://pydantic.dev/docs/logfire/get-started/integrations/index.md) - [](https://pydantic.dev/docs/logfire/get-started/integrations/system-metrics/index.md) - [Why Logfire?](https://pydantic.dev/docs/logfire/get-started/why/index.md): Logfire unifies metrics, tracing, and structured data logging into one simple platform. End-to-end general and AI observability powered by Pydantic. ## Instrument Your App - [Auto-Tracing](https://pydantic.dev/docs/logfire/instrument/add-auto-tracing/index.md): Enable Logfire auto-tracing to add tracing without code changes. Filter functions by duration to capture high-overhead performance bottlenecks. - [Manual Tracing](https://pydantic.dev/docs/logfire/instrument/add-manual-tracing/index.md): Intro to manual tracing with Logfire. Learn about recording attributes, tracking exceptions, and f-strings. - [Metrics](https://pydantic.dev/docs/logfire/instrument/add-metrics/index.md): Practical guide to adding Logfire metrics: Use system metrics or manual metrics to track Counter, Gauge or Callback Metrics. - [Distributed Tracing](https://pydantic.dev/docs/logfire/instrument/distributed-tracing/index.md): Master Logfire distributed tracing. Automatically propagate context across services using the traceparent header to connect every related span into one view. - [Integrate Logfire](https://pydantic.dev/docs/logfire/instrument/integrate/index.md): This guide shows how to integrate Logfire using OpenTelemetry instrumentation. Get set up with Python's standard logging, Loguru, or Structlog quickly. - [Onboarding Checklist](https://pydantic.dev/docs/logfire/instrument/onboarding-checklist/index.md): Get started with Logfire. This onboarding checklist guides you through initial integration, tracing setup (manual/auto), and collecting metrics data. - [](https://pydantic.dev/docs/logfire/instrument/opentelemetry-collector/host-monitoring/index.md) - [](https://pydantic.dev/docs/logfire/instrument/opentelemetry-collector/kubernetes-monitoring/index.md) - [](https://pydantic.dev/docs/logfire/instrument/opentelemetry-collector/otel-collector-overview/index.md) - [](https://pydantic.dev/docs/logfire/instrument/opentelemetry-collector/s3-backup/index.md) - [Advanced Scrubbing](https://pydantic.dev/docs/logfire/instrument/otel-collector-scrubbing/index.md): Data scrubbing with the Logfire OTel Collector: Remove attributes by key, mask sensitive values, or implement conditional scrubbing to guard sensitive data. - [Sampling Strategies](https://pydantic.dev/docs/logfire/instrument/sampling/index.md): Master log sampling strategies: Use head or tail sampling to control data volume and cost. Preserve Logfire span traces based on duration or error level. - [Scrub Sensitive Data](https://pydantic.dev/docs/logfire/instrument/scrubbing/index.md): Learn how to use Logfire to keep logs & sensitive data safe: Automatically scan spans & logs to scrub data like passwords, tokens & PII before exporting. - [Suppress Spans and Metrics](https://pydantic.dev/docs/logfire/instrument/suppress/index.md): Logfire provides two ways to suppress the data you are sending to Logfire: Suppress Scopes and Suppress Instrumentation. ## Integrations - [AWS Lambda](https://pydantic.dev/docs/logfire/integrations/aws-lambda/index.md): Use the logfire.instrument_aws_lambda function to instrument AWS Lambda functions to automatically send traces to Logfire. - [Asyncpg](https://pydantic.dev/docs/logfire/integrations/databases/asyncpg/index.md): Step-by-step installation guide for instrumenting asyncpg with Logfire using the logfire.instrument_asyncpg() function. - [BigQuery](https://pydantic.dev/docs/logfire/integrations/databases/bigquery/index.md): Get automatic tracing for the BigQuery Python API. Logfire instantly captures query duration and job status without the need for extra configuration. - [MySQL](https://pydantic.dev/docs/logfire/integrations/databases/mysql/index.md): Trace every MySQL query with Logfire SQL logging. Set up the connection using our Docker example and automatically capture database query spans. - [Psycopg](https://pydantic.dev/docs/logfire/integrations/databases/psycopg/index.md): Instrument Psycopg and Psycopg2 operations with OpenTelemetry Psycopg. Capture queries, duration, and context with logfire.instrument_psycopg(). - [PyMongo](https://pydantic.dev/docs/logfire/integrations/databases/pymongo/index.md): Gain observability for your PyMongo stack. Leverage Logfire to trace every insert, find, and update operation in MongoDB. Step-by-step setup guide. - [Redis](https://pydantic.dev/docs/logfire/integrations/databases/redis/index.md): Integrate Pydantic Redis instrumentation. Logfire creates a span for every Redis command executed, offering granular tracing of your data layer. - [SQLAlchemy](https://pydantic.dev/docs/logfire/integrations/databases/sqlalchemy/index.md): Guide to set up database tracing for SQLAlchemy. Use Logfire to monitor all engine queries, connection pools, and database performance in one unified view. - [SQLite3](https://pydantic.dev/docs/logfire/integrations/databases/sqlite3/index.md): Guide on how to use the logfire.instrument_sqlite3() method to instrument the sqlite3 standard library module to create spans for each SQL query executed. - [Airflow](https://pydantic.dev/docs/logfire/integrations/event-streams/airflow/index.md): Guide for instrumenting Apache Airflow OTEL tracing. Configure the native Airflow OpenTelemetry settings to send metrics & Airflow Pydantic data to Logfire - [Celery](https://pydantic.dev/docs/logfire/integrations/event-streams/celery/index.md): Get end-to-end tracing for Celery workers. Logfire's integration creates a span for every task execution, fixing asynchronous visibility. - [FastStream](https://pydantic.dev/docs/logfire/integrations/event-streams/faststream/index.md): Guide on instrumenting FastStream with OpenTelemetry via middleware. - [AIOHTTP](https://pydantic.dev/docs/logfire/integrations/http-clients/aiohttp/index.md): Instrument AIOHTTP for full observability with Pydantic Logfire. Trace HTTP calls, headers, and bodies for async clients. - [HTTPX](https://pydantic.dev/docs/logfire/integrations/http-clients/httpx/index.md): Instrument HTTPX for full observability with Pydantic Logfire. Trace HTTP calls, headers, and request bodies for async and sync clients. - [Requests](https://pydantic.dev/docs/logfire/integrations/http-clients/requests/index.md): Learn how to use the logfire.instrument_requests() method to instrument requests with Logfire. - [Anthropic](https://pydantic.dev/docs/logfire/integrations/llms/anthropic/index.md): Instrument calls to Anthropic with the logfire.instrument_anthropic(), stream responses, and log Anthropic LLM calls to Amazon Bedrock. - [Claude Agent SDK](https://pydantic.dev/docs/logfire/integrations/llms/claude-agent-sdk/index.md): Guide for using Logfire with the Claude Agent SDK, including setup instructions and example trace output. - [DSPy](https://pydantic.dev/docs/logfire/integrations/llms/dspy/index.md): Instrument DSPy with Pydantic Logfire using OpenInference for end-to-end LLM workflow tracing. - [Google Gen AI](https://pydantic.dev/docs/logfire/integrations/llms/google-genai/index.md): Instrument the Google GenAI SDK for Gemini models. Configure OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT to trace prompts, completions & token usage. - [LangChain](https://pydantic.dev/docs/logfire/integrations/llms/langchain/index.md): Guide for using Logfire with LangChain and LangGraph via OpenTelemetry tracing, including setup instructions and example trace output. - [LiteLLM](https://pydantic.dev/docs/logfire/integrations/llms/litellm/index.md): Instrument LiteLLM with Pydantic Logfire using OpenInference. Get full visibility into any model's conversation and performance. - [LLamaIndex](https://pydantic.dev/docs/logfire/integrations/llms/llamaindex/index.md): Guide for instrumenting LlamaIndex via the OpenTelemetry specific instrumentation provided by OpenLLMetry: opentelemetry-instrumentation-llamaindex. - [Magentic](https://pydantic.dev/docs/logfire/integrations/llms/magentic/index.md): Guide for instrumenting Magentic. Magentic instrumentation requires no additional setup beyond configuring Logfire itself. - [MCP](https://pydantic.dev/docs/logfire/integrations/llms/mcp/index.md): Example for instrumenting the MCP Python SDK with the logfire.instrument_mcp() method using Logfire. Suitable for client- and server-side usage scenarios. - [Mirascope](https://pydantic.dev/docs/logfire/integrations/llms/mirascope/index.md): Get seamless observability for Mirascope applications. This guide shows how to trace conversation, prompt templates & monitor different LLM providers. - [OpenAI](https://pydantic.dev/docs/logfire/integrations/llms/openai/index.md): Logfire supports instrumenting via the standard OpenAI SDK package and OpenAI "agents" framework. Track tool calls, token usage, and conversation flow. - [Pydantic AI](https://pydantic.dev/docs/logfire/integrations/llms/pydanticai/index.md): Get deep visibility into your Pydantic AI agents. Logfire tracing captures every tool call, retry, and complex agent step for reliable, structured debugging. - [Logging](https://pydantic.dev/docs/logfire/integrations/logging/logging/index.md): Guide to standard library logging via Logfire: Use LogfireLoggingHandler for simple, centralized Python logging and observability. - [Loguru](https://pydantic.dev/docs/logfire/integrations/logging/loguru/index.md): Seamlessly send all Loguru data to Logfire for analysis. Configure the specialized Loguru sink handler to centralize your logging data. - [Print](https://pydantic.dev/docs/logfire/integrations/logging/print/index.md): Transform every print() statement into a traceable log. This guide shows how to instrument print for structured logging with argument attribute extraction. - [Structlog](https://pydantic.dev/docs/logfire/integrations/logging/structlog/index.md): Guide for integrating Structlog events directly into Pydantic Logfire via the custom StructlogProcessor. - [Pydantic](https://pydantic.dev/docs/logfire/integrations/pydantic/index.md): Guide to instrumenting Pydantic Validation models via the Pydantic Validation plugin (get logs and metrics about model validation). - [Pytest](https://pydantic.dev/docs/logfire/integrations/pytest/index.md): Add observability to your pytest test suite with Pydantic Logfire. See test sessions, individual tests, and what happens during test execution. - [Stripe](https://pydantic.dev/docs/logfire/integrations/stripe/index.md): Instrument the Stripe Python client for tracing. Logfire integrates with requests/httpx to monitor payments and API calls. - [System Metrics](https://pydantic.dev/docs/logfire/integrations/system-metrics/index.md): Collect detailed system metrics (CPU, memory, disk I/O usage) with Logfire Metrics. Visualize real-time performance on a dedicated system metrics dashboard. - [AIOHTTP](https://pydantic.dev/docs/logfire/integrations/web-frameworks/aiohttp/index.md): Trace requests to your AIOHTTP client/server framework. Logfire instrumentation captures spans for every request made. - [ASGI](https://pydantic.dev/docs/logfire/integrations/web-frameworks/asgi/index.md): Learn how to use the logfire.instrument_asgi() method to instrument your ASGI web framework. - [Django](https://pydantic.dev/docs/logfire/integrations/web-frameworks/django/index.md): Guide for instrumenting Django with Pydantic Logfire. How to add tracing, logs and metrics to your Django app with just a few lines of code. - [FastAPI](https://pydantic.dev/docs/logfire/integrations/web-frameworks/fastapi/index.md): Connect Logfire to your FastAPI app. Follow our simple install flow using Uvicorn. - [Flask](https://pydantic.dev/docs/logfire/integrations/web-frameworks/flask/index.md): Get automatic request tracing for Flask applications. Instrument your Flask app to capture spans, logs, and headers effortlessly with Logfire. - [Gunicorn](https://pydantic.dev/docs/logfire/integrations/web-frameworks/gunicorn/index.md): Learn how to configure Logfire with Gunicorn by using the logfire.configure() function to set up Logfire in Gunicorn's post_fork hook. - [Web Frameworks](https://pydantic.dev/docs/logfire/integrations/web-frameworks/index.md): Instrumentation for web apps. How to capture HTTP server request and response headers, query HTTP requests duration per percentile and exclude URLs. - [Starlette](https://pydantic.dev/docs/logfire/integrations/web-frameworks/starlette/index.md): Get seamless tracing for your Starlette application. Use pip install starlette to get started. - [WSGI](https://pydantic.dev/docs/logfire/integrations/web-frameworks/wsgi/index.md): Learn how to use the logfire.instrument_wsgi() method to instrument your WSGI web framework. ## TypeScript SDK - [Configuration](https://pydantic.dev/docs/logfire/typescript-sdk/configuration/index.md): Configure Logfire TypeScript SDK runtime packages with tokens, service metadata, exporters, console output, and OpenTelemetry options. - [Evaluations](https://pydantic.dev/docs/logfire/typescript-sdk/evals/index.md): Use logfire/evals for offline datasets, online evaluation, built-in evaluators, report evaluators, and Python-compatible dataset files. - [Deno](https://pydantic.dev/docs/logfire/typescript-sdk/frameworks/deno/index.md): Configure Deno OpenTelemetry export to Logfire and use the logfire package for manual spans. - [Express](https://pydantic.dev/docs/logfire/typescript-sdk/frameworks/express/index.md): Instrument an Express application with @pydantic/logfire-node. - [Next.js](https://pydantic.dev/docs/logfire/typescript-sdk/frameworks/nextjs/index.md): Use Logfire with Next.js server-side OpenTelemetry and optional client-side browser tracing. - [Vercel AI SDK](https://pydantic.dev/docs/logfire/typescript-sdk/frameworks/vercel-ai/index.md): Capture Vercel AI SDK OpenTelemetry spans in Logfire from Node.js and Next.js applications. - [Getting Started](https://pydantic.dev/docs/logfire/typescript-sdk/get-started/index.md): Install the Logfire TypeScript SDK, configure a write token, and send your first span from Node.js. - [Managed Variables](https://pydantic.dev/docs/logfire/typescript-sdk/managed-variables/index.md): Use logfire/vars and @pydantic/logfire-node/vars for local and remote managed variables. - [Browser](https://pydantic.dev/docs/logfire/typescript-sdk/packages/browser/index.md): Configure @pydantic/logfire-browser for browser tracing with an authenticated backend proxy. - [Cloudflare Workers](https://pydantic.dev/docs/logfire/typescript-sdk/packages/cloudflare/index.md): Instrument Cloudflare Workers with @pydantic/logfire-cf-workers. - [Core API](https://pydantic.dev/docs/logfire/typescript-sdk/packages/logfire/index.md): Manual tracing, structured logs, error reporting, evaluations, and managed variables with the runtime-agnostic logfire package. - [Node.js](https://pydantic.dev/docs/logfire/typescript-sdk/packages/node/index.md): Configure @pydantic/logfire-node for Node.js tracing, logging, metrics, automatic instrumentation, and manual spans. - [API Overview](https://pydantic.dev/docs/logfire/typescript-sdk/reference/api/index.md): Overview of the main TypeScript SDK exports and package entry points. - [CLI](https://pydantic.dev/docs/logfire/typescript-sdk/reference/cli/index.md): Use npx logfire to authenticate, select projects, and manage read tokens. - [Environment Variables](https://pydantic.dev/docs/logfire/typescript-sdk/reference/environment-variables/index.md): Environment variables used by the Logfire TypeScript SDK packages. - [Resource Attributes](https://pydantic.dev/docs/logfire/typescript-sdk/resource-attributes/index.md): Add stable OpenTelemetry resource attributes to Logfire TypeScript SDK telemetry. - [Sampling](https://pydantic.dev/docs/logfire/typescript-sdk/sampling/index.md): Control Logfire TypeScript SDK trace volume with head and tail sampling. - [Scrubbing](https://pydantic.dev/docs/logfire/typescript-sdk/scrubbing/index.md): Scrub sensitive data from Logfire TypeScript SDK span attributes before export. ## Observe & Investigate - [Alerts](https://pydantic.dev/docs/logfire/observe/alerts/index.md): Learn how to create alerts based on SQL query conditions (e.g., error count threshold). Use Logfire to track status changes and send notifications to Slack. - [Dashboards](https://pydantic.dev/docs/logfire/observe/dashboards/index.md): Logfire dashboards let you visualize your observability data. Create custom SQL-powered charts and tables, or start from standard dashboards. - [Detect Service is Down](https://pydantic.dev/docs/logfire/observe/detect-service-is-down/index.md): Guide for creating alerts to notify you when a log message is not received for a certain amount of time to detect if a service is down. - [SQL Explorer](https://pydantic.dev/docs/logfire/observe/explore/index.md): Run arbitrary SQL queries against traces and metric data. Use the Logfire SQL Explorer to investigate and analyze records. - [Hosts](https://pydantic.dev/docs/logfire/observe/hosts/index.md): Browse every host shipping system metrics to your Logfire project. Drill into a host's CPU, memory, load, disk and network charts, alongside the application traces that ran on it. - [Issues](https://pydantic.dev/docs/logfire/observe/issues/index.md): Automatically group exceptions and track Pydantic issues in your application. Identify, prioritize, and resolve errors. - [Kubernetes](https://pydantic.dev/docs/logfire/observe/kubernetes/index.md): Browse your Kubernetes clusters, namespaces, workloads, pods, nodes and container images. Sort by restart count, drill from pod to workload to namespace, and jump straight to the traces each pod produced. - [Live View](https://pydantic.dev/docs/logfire/observe/live/index.md): Use Logfire Live View to watch traces and logs in real time. Pivot into the SQL search pane to deep-dive and explore your traces. - [LLM Panels](https://pydantic.dev/docs/logfire/observe/llm-panels/index.md): Monitor LLM tracing and costs with the Logfire LLM Panel. View token usage, conversation history, and deep data. - [LLMs](https://pydantic.dev/docs/logfire/observe/llms/index.md): Browse every model and provider your application calls. See cost, latency, error rate, tokens, truncation rate and tool-call rate per model. Drill into an LLM for a detail page that links straight to traces, and see avg + p90 distributions for tool calls and turns on every agent run. - [Metrics Explorer](https://pydantic.dev/docs/logfire/observe/metrics-explorer/index.md): A three-step wizard for browsing the OpenTelemetry metrics you're sending to Logfire. Pick a namespace, pick a metric, see what dimensions you can break it down by. View SQL on every card so you can graduate to the full editor when you're ready. - [Prompt Playground](https://pydantic.dev/docs/logfire/observe/prompt-playground/index.md): Prompt Playground: Experiment with agent prompts - [Public Traces](https://pydantic.dev/docs/logfire/observe/public-traces/index.md): Public Traces: Learn how to provide external teams with full trace data, including all nested spans and span links, without granting full access. - [Saved Searches](https://pydantic.dev/docs/logfire/observe/saved-searches/index.md): Share and access key trace queries. Logfire Saved Searches allow you to securely store and share critical log filters with your team. - [Services](https://pydantic.dev/docs/logfire/observe/services/index.md): Browse every service shipping spans to your Logfire project. See requests, errors and latency at a glance, drill into a service's RED breakdown, and explore a topology graph drawn from your traces. - [Setup Slack Alerts](https://pydantic.dev/docs/logfire/observe/setup-slack-alerts/index.md): Need to send alerts to Slack from Logfire? This guide shows how to create a Slack webhook and define SQL-based alert criteria for your Slack alert system. - [Write Dashboard Queries](https://pydantic.dev/docs/logfire/observe/write-dashboard-queries/index.md): Practical recipes and patterns for writing SQL queries in Logfire with focus on querying the records table, which contains logs and spans. ## Evaluate - [Running Evaluations](https://pydantic.dev/docs/logfire/evaluate/datasets/evaluations/index.md): Run evaluations against local or hosted datasets with pydantic-evals. - [Overview](https://pydantic.dev/docs/logfire/evaluate/datasets/index.md): Create, manage, and fetch typed evaluation datasets in Pydantic Logfire. Integrate with pydantic-evals to run evaluations against your AI systems. - [SDK Guide](https://pydantic.dev/docs/logfire/evaluate/datasets/sdk/index.md): Manage evaluation datasets programmatically with the Logfire Python SDK. - [Web UI Guide](https://pydantic.dev/docs/logfire/evaluate/datasets/ui/index.md): Create and manage evaluation datasets through the Logfire web interface. - [Evals: Datasets & Experiments](https://pydantic.dev/docs/logfire/evaluate/evals/index.md): Logfire Evals provides observability into how your AI systems perform. View, compare and analyze evaluation results in the Pydantic web UI. - [Evals: Live Monitoring](https://pydantic.dev/docs/logfire/evaluate/live-evals/index.md): View real-time online-evaluation activity for your agents and functions in Pydantic Logfire. Track pass rates, categorical labels, and numeric scores across production traffic. ## Manage & Configure - [Feature Flags (OFREP)](https://pydantic.dev/docs/logfire/manage/client-side-feature-flags/index.md) - [Logfire Configuration Guide & Environment Variables](https://pydantic.dev/docs/logfire/manage/configuration/index.md): Overview of configuring Pydantic Logfire: Programmatically, by using environment variables or by using a configuration file. - [Convert to Organization](https://pydantic.dev/docs/logfire/manage/convert-to-organization/index.md): Convert your Logfire Personal account to an Organization account. Benefit from dedicated teams and clearly defined user and access roles. - [Write Tokens](https://pydantic.dev/docs/logfire/manage/create-write-tokens/index.md): Step-by-step guide for creating a Logfire write token in the web UI by injecting LOGFIRE_TOKEN in apps & for optionally suppressing it in local development. - [Data Regions](https://pydantic.dev/docs/logfire/manage/data-regions/index.md): Select your data region for Logfire. Logfire offers separate US and EU regions for optimal performance and to meet data compliance and residency needs. - [Combining Multiple Configurations in Logfire](https://pydantic.dev/docs/logfire/manage/different-configurations/index.md): Guide for setting up different Logfire configurations for different parts of your application via logfire.configure(). - [Environments](https://pydantic.dev/docs/logfire/manage/environments/index.md): Learn how to separate traces from your production, staging, and local environments. Use logfire.configure() to manage different environments easily. - [Gateway](https://pydantic.dev/docs/logfire/manage/gateway/index.md): Route LLM calls through a single Logfire-managed endpoint with built-in spending limits, fallbacks, and usage tracking. - [Infrastructure as Code](https://pydantic.dev/docs/logfire/manage/infrastructure-as-code/index.md): Manage Logfire resources as code. - [Cost & Usage](https://pydantic.dev/docs/logfire/manage/logfire-costs/index.md) - [A/B Testing](https://pydantic.dev/docs/logfire/manage/managed-variables/ab-testing/index.md) - [Configuration Reference](https://pydantic.dev/docs/logfire/manage/managed-variables/configuration-reference/index.md) - [External Variables & OFREP](https://pydantic.dev/docs/logfire/manage/managed-variables/external/index.md) - [Overview](https://pydantic.dev/docs/logfire/manage/managed-variables/index.md) - [Local Variables](https://pydantic.dev/docs/logfire/manage/managed-variables/local/index.md) - [Remote Variables](https://pydantic.dev/docs/logfire/manage/managed-variables/remote/index.md) - [Targeting](https://pydantic.dev/docs/logfire/manage/managed-variables/targeting/index.md) - [Templates & Composition](https://pydantic.dev/docs/logfire/manage/managed-variables/templates-and-composition/index.md) - [UI Guide](https://pydantic.dev/docs/logfire/manage/managed-variables/ui/index.md) - [Organizations & Projects](https://pydantic.dev/docs/logfire/manage/organizations-and-projects/index.md): Learn how Organizations and Projects provide granular access control for Admins, Members, and Guests in Logfire. - [Export Data](https://pydantic.dev/docs/logfire/manage/query-api/index.md): Leverage the Logfire web API to query data via SQL. Export logs & metrics and retrieve data in JSON, CSV, or Apache Arrow format. - [API Keys](https://pydantic.dev/docs/logfire/manage/use-api-keys/index.md): Guide on how to create API keys and use them to call Logfire public APIs for managing organizations, projects, and other resources. ## Prompt Management - [Use Prompts in Your Application](https://pydantic.dev/docs/logfire/prompt-management/application/index.md): How to promote a prompt version, fetch it from the SDK, and render it in your application. - [Prompt Composition Walkthrough](https://pydantic.dev/docs/logfire/prompt-management/composition-walkthrough/index.md): Build a Prompt Management prompt from reusable managed-variable and prompt fragments. - [Core Concepts](https://pydantic.dev/docs/logfire/prompt-management/concepts/index.md): The core objects in Prompt Management: prompts and versions. - [Access and Prerequisites](https://pydantic.dev/docs/logfire/prompt-management/plan-requirements/index.md): What a project needs in order to author, test, and ship prompts in Logfire. - [Promote and Roll Out Prompts](https://pydantic.dev/docs/logfire/prompt-management/promotion-and-rollouts/index.md): How to promote prompt versions, canary changes, and roll back with managed-variable labels. - [Test Prompts](https://pydantic.dev/docs/logfire/prompt-management/scenarios/index.md): How to test prompts with scenarios, datasets, and run records. - [Template Reference](https://pydantic.dev/docs/logfire/prompt-management/template-reference/index.md): The authoritative grammar used by Logfire Prompt Management templates: supported helpers, rendering order, and error behavior. - [Writing Templates](https://pydantic.dev/docs/logfire/prompt-management/templates/index.md): How to write Logfire prompt templates with variables and standard Handlebars helpers. - [UI Guide](https://pydantic.dev/docs/logfire/prompt-management/ui/index.md): How to author, test, version, and inspect prompts in the Logfire UI. ## Guides - [How to use Alternative Backends with Logfire](https://pydantic.dev/docs/logfire/guides/alternative-backends/index.md): Learn how to connect Logfire to any backend that supports OpenTelemetry using environment variables. - [Use Alternative Clients](https://pydantic.dev/docs/logfire/guides/alternative-clients/index.md): Guide on how to use the standard OpenTelemetry SDK to export Node.js, Rust or Go data to Logfire. - [Collect Cloud Provider Metrics](https://pydantic.dev/docs/logfire/guides/cloud-metrics/index.md): Collect AWS & GCP cloud metrics via the OTel Collector. This guide outlines how to collect metrics from your cloud provider to centralize them in Logfire. - [Export Codex Activity](https://pydantic.dev/docs/logfire/guides/codex-logfire-exporter/index.md): Install the Logfire Exporter plugin to send completed Codex turns and tool calls to Logfire as OpenTelemetry traces. - [Logfire GitHub Integration Guide: Link to Code Source](https://pydantic.dev/docs/logfire/guides/link-to-code-source/index.md): Link every log and span directly to your Logfire GitHub source code. Configure the repository and revision to jump straight to the exact line of failure. - [Connect to MCP Server](https://pydantic.dev/docs/logfire/guides/mcp-server/index.md): Learn how to use an MCP to allow LLMs to access OpenTelemetry traces and metrics through Logfire. Detailed configuration guide for Cursor and Claude. - [Host Monitoring](https://pydantic.dev/docs/logfire/guides/otel-collector/host-monitoring/index.md): Ship CPU, memory, disk, filesystem, network, and process metrics from any host to Logfire via the OpenTelemetry Collector hostmetrics receiver. - [Kubernetes Monitoring](https://pydantic.dev/docs/logfire/guides/otel-collector/kubernetes-monitoring/index.md): Ship Kubernetes cluster metrics, node and pod metrics, pod logs, and Kubernetes resource attributes to Logfire via the OpenTelemetry Collector. - [Overview](https://pydantic.dev/docs/logfire/guides/otel-collector/otel-collector-overview/index.md): Detailed configuration instructions for connecting Logfire to the OpenTelemetry Collector, plus overview of use cases and benefits. - [Back up to AWS S3](https://pydantic.dev/docs/logfire/guides/otel-collector/s3-backup/index.md): Configure the OpenTelemetry Collector to fan out telemetry to both Logfire and an S3 bucket for long-term archive, plus how to read it back. - [Coding Agent Skills](https://pydantic.dev/docs/logfire/guides/skills/index.md): Use Pydantic's coding agent skills and plugins to give Claude Code, Codex, Cursor, Gemini CLI, and other agents up-to-date Logfire knowledge. - [](https://pydantic.dev/docs/logfire/guides/web-ui/alerts/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/dashboards/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/explore/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/hosts/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/issues/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/kubernetes/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/live/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/llm-panels/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/llms/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/metrics-explorer/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/prompt-playground/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/public-traces/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/saved-searches/index.md) - [](https://pydantic.dev/docs/logfire/guides/web-ui/services/index.md) ## Reference - [Pydantic Logfire OTel Baggage Reference](https://pydantic.dev/docs/logfire/reference/baggage/index.md): Propagate contextual data across your microservices. Use Logfire's set_baggage and get_baggage to carry key-value pairs (like user IDs) through traces. - [Logfire SDK CLI: SDK Command Line Interface Guide](https://pydantic.dev/docs/logfire/reference/cli/index.md): Use the Logfire CLI to simplify project management. Use commands to authenticate, logfire login, create new projects, and manage read/write tokens. - [Logfire Examples: Practical Tracing & Metrics Demos](https://pydantic.dev/docs/logfire/reference/examples/index.md): Explore practical Logfire examples for Python and JavaScript. See full-stack demos for FastAPI, Flask, SQLAlchemy, and LLM agent tracing. - [Pydantic Logfire Generators References](https://pydantic.dev/docs/logfire/reference/generators/index.md): Resolve failed to detach context errors in async code. Learn to use context managers and close Logfire generators to ensure correct span context. - [Aggregating Metrics in Spans with Logfire](https://pydantic.dev/docs/logfire/reference/metrics-in-spans/index.md): Learn how to aggregate counter and histogram metrics (like token usage) across active and ancestor spans. - [How to Migrate to a New Logfire Project](https://pydantic.dev/docs/logfire/reference/migrate-to-new-project/index.md): Send data to multiple Logfire projects simultaneously for seamless migration. - [SQL](https://pydantic.dev/docs/logfire/reference/sql/index.md): Use Logfire to query your observability data using SQL (via PostgreSQL syntax). - [Testing Logfire Instrumentation](https://pydantic.dev/docs/logfire/reference/testing/index.md): Logfire makes it very easy to test emitted logs and spans using the utilities in the logfire.testing module. ## API Reference - [Datasets](https://pydantic.dev/docs/logfire/api/datasets/index.md): Complete method and exception reference for the Logfire datasets SDK. - [Exceptions](https://pydantic.dev/docs/logfire/api/exceptions/index.md): Understand LogfireConfigError to debug Logfire configuration problems. - [Logfire](https://pydantic.dev/docs/logfire/api/logfire/index.md): Introduction to basic Logfire configuration, trace configuration and parameters. - [Propagate](https://pydantic.dev/docs/logfire/api/propagate/index.md): Master context propagation across services. Use logfire.get_context() & attach_context to manually link traces between different threads & processes. - [Pydantic](https://pydantic.dev/docs/logfire/api/pydantic/index.md): Pydantic Logfire integration guide: PluginSettings, LogfireSettings, and LogfirePydanticPlugin and more. - [Query Client](https://pydantic.dev/docs/logfire/api/query_client/index.md) - [Sampling](https://pydantic.dev/docs/logfire/api/sampling/index.md): Master Logfire Sampling Options to retain critical traces. Filter by log level, duration threshold, or combine head and tail sampling. - [Testing](https://pydantic.dev/docs/logfire/api/testing/index.md): Ensure your Logfire spans are accurate. The testing module provides specialized exporters and readers to isolate traces and metrics. - [Types](https://pydantic.dev/docs/logfire/api/types/index.md): Review the Logfire API reference for critical utility types. Define custom logic for ExceptionCallback and ExceptionCallbackHelper. ## Deploy & Scale - [Audit logs API](https://pydantic.dev/docs/logfire/deploy/audit-logs-api/index.md): Retrieve organization activity logs for security monitoring, compliance reporting, and usage auditing with the Logfire Audit Logs API. - [Compliance](https://pydantic.dev/docs/logfire/deploy/compliance/index.md): Overview of Logfire compliance standards. We are SOC2 Type II certified and HIPAA compliant, offer BAAs, and provide an EU Data Region for GDPR compliance. - [Enterprise](https://pydantic.dev/docs/logfire/deploy/enterprise/index.md): The Logfire Enterprise Plan includes custom SSO, guaranteed SLAs, custom BAAs, and priority 24/7 support. Choose between cloud and self-hosted options. - [Single Tenant](https://pydantic.dev/docs/logfire/deploy/enterprise-single-tenant/index.md): Enterprise Dedicated is a fully managed, single-tenant deployment of Logfire running on isolated infrastructure provisioned and operated by Pydantic. - [Architecture](https://pydantic.dev/docs/logfire/deploy/self-hosted-deployment/architecture/index.md): Architecture overview for self-hosted Pydantic Logfire, including the main runtime paths and external dependencies. - [Bucket Migration](https://pydantic.dev/docs/logfire/deploy/self-hosted-deployment/bucket-migration/index.md): How to migrate your Pydantic Logfire self-hosted deployment to a new S3-compatible object storage bucket without data loss. - [Examples](https://pydantic.dev/docs/logfire/deploy/self-hosted-deployment/examples/index.md): Examples for self-hosted Logfire. - [Production Requirements](https://pydantic.dev/docs/logfire/deploy/self-hosted-deployment/installation/index.md): Plan the production values required for self-hosted Pydantic Logfire, including PostgreSQL, object storage, authentication, and sizing. - [Local Quickstart](https://pydantic.dev/docs/logfire/deploy/self-hosted-deployment/local-quickstart/index.md): Run self-hosted Pydantic Logfire locally with the Helm chart's development values. - [Overview](https://pydantic.dev/docs/logfire/deploy/self-hosted-deployment/overview/index.md): Overview of self-hosted Pydantic Logfire, including production requirements and operational procedures. - [Troubleshooting](https://pydantic.dev/docs/logfire/deploy/self-hosted-deployment/troubleshooting/index.md): Troubleshooting guide for self-hosted Logfire deployments, including meta project access and image pull checks. - [Usage Report](https://pydantic.dev/docs/logfire/deploy/self-hosted-deployment/usage-report/index.md): Generate and download a usage report from a self-hosted Logfire instance. - [SSO Setup](https://pydantic.dev/docs/logfire/deploy/sso-setup/index.md): Step-by-step guide to configure Single Sign-On (SSO) for Logfire Enterprise Cloud. Supports Microsoft Entra ID, Okta, and Keycloak OIDC providers. ## Resources - [Languages](https://pydantic.dev/docs/logfire/resources/languages/index.md): Logfire offers streamlined SDKs for Python, Rust, and JavaScript/TypeScript. Leverage OpenTelemetry compatibility to support tracing in other languages. - [Release Notes](https://pydantic.dev/docs/logfire/resources/release-notes/index.md): List of official Logfire release notes and changelogs. Get an overview of the latest features, changes, and updates. - [Roadmap](https://pydantic.dev/docs/logfire/resources/roadmap/index.md)