Pydantic Logfire

https://pydantic.dev/logfire

From the team behind Pydantic, Logfire is a new type of observability platform built on the same belief as our open source library — that the most powerful tools can be easy to use.

Software developer? Then you’ve likely encountered these headaches

Working with over-complicated observability platforms that don't understand your code or application.

Sifting through endless print statements and decoding cryptic portrayals of Python objects in your logs.

Guessing at the performance hit from a specific function, or a mysterious slowdown of your app.

Whether you’re building an AI tool or any other cloud-based app, these frustrating scenarios are avoidable but all too real.

INTRODUCING LOGFIRE

A more intuitive way to understand your

Pydantic Logfire is a window into the inner workings of your application. Smooth to set up and easy to understand, with ready integrations for many popular libraries.

Features

While Pydantic Logfire is Python-first, it’s an observability platform that works just as well with other programming languages.

Transform garbled logs into actionable insights. Discover not just how long a function takes to run, but which queries slow down your app.

Understand your app’s behaviour — from request headers and bodies to the full trace of program execution.

Turn your logs into visualizations, dashboards, and alerts that drive development forward.

Insights

Faster fixes, deeper insights

With an SDK built on top of OpenTelemetry, structured data and an intuitive interface, Pydantic Logfire makes it easy to monitor the behavior of Python applications, at every level. Instrument your app using best practices and draw powerful insights — without hiring a dedicated analytics or observability team.

Structured Data & Direct SQL Access

Ensure your Python objects and structured data are query-ready. Use tools like Pandas, SQLAlchemy, or psql for querying, integrate seamlessly with BI software, and leverage AI for SQL generation.

SELECT attributes->>'campaign' as campaign, count(distinct attributes->>'track_id') as clicks, round(count(distinct attributes->>'track_id')::numeric/50*100, 2) as click_rate FROM records WHERE span_name = 'Click on {campaign}' and attributes->>'campaign' ilike 'c%' GROUP BY attributes->>'campaign'

Manual Tracing

You can use the logfire library to create logs and traces directly — it’s kind of like standard logging in Python, with a more modern interface and some extra capabilities. And a lot less painful than using OpenTelemetry directly.

import logfire
logfire.configure()
name = 'world'
logfire.info(f'Hello, {name}!')
# ^ Equivalent to:
# logfire.info('Hello, {name}!', name=name)
advantages = 'timing', 'context', 'exception capturing'
with logfire.span(f'spans provide: {advantages}'):
     logfire.warn('the next line will raise an exception')
     1 / 0

OpenTelemetry

OpenTelemetry (OTel) is an open source observability framework, it provides libraries for Python and every other popular language to let you collect traces, logs and metrics.

OTel is a powerful tool that increasing numbers of developers want to use, but it can be time-consuming to set up and limited in the kinds of data it can collect.

Pydantic Logfire takes the best of OTel (instrumentation for popular Python packages, open standard for data transmission) and makes it easier to use and more flexible.

By harnessing OpenTelemetry, Pydantic Logfire offers automatic instrumentation for popular Python packages, enables cross-language data integration, and supports data export to any OpenTelemetry-compatible backend or proxy.

Logfire is already making developers' lives easier

From the creators of Pydantic, Crafted with the same developer obsession

Built with developer experience at its core, Pydantic Logfire brings the same balance of ease, sophistication and productivity that’s made Pydantic the most popular data validation library on planet earth. Whether you’re using observability for the first time or an expert, we make it easy.

Out-of-the-box integration

Use Pydantic Logfire to monitor the data that runs through Pydantic for a customized experience that goes way beyond generic observability platforms.

FOR DEVELOPERS

Ready to start building?

Logfire’s Python SDK is open source under the MIT license and wraps the OpenTelemetry Python package. By default, it will send data to the Logfire platform but you could send data to any OpenTelemetry Protocol (OTLP) compliant endpoint.

{
"by": "ellieh",
"descendants": 79,
"id": 40212490,
"kids": [
40212723,
40218832,
40219139,
40215351,
40216559,
40214627,
40214032,
40214699,
40215008,
40216537,
40216536,
40214894
],
"score": 146,
"time": 1714492570,
"title": "Pydantic Logfire",
"type": "story",
"url": "https://pydantic.dev/logfire"
}
{
"author": null,
"date": null,
"description": "Logfire is a new type of observability platform built on the same belief as Pydantic — that the most powerful tools can be easy to use.",
"image": "https://pydantic.dev/logfire/opengraph-image.jpg?b57901e7917d2d58",
"logo": "https://logo.clearbit.com/pydantic.dev",
"publisher": "Pydantic",
"title": "Uncomplicated observability | Pydantic Logfire",
"url": "https://pydantic.dev/logfire"
}
{
"url": "https://pydantic.dev/logfire",
"title": "Uncomplicated observability | Pydantic Logfire",
"description": "From the team behind Pydantic, Logfire is a new type of observability platform built on the same belief as our open source library — that the most powerful tools can be easy to use.Software developer? Then...",
"links": [
"https://pydantic.dev/logfire"
],
"image": "https://pydantic.dev/logfire/opengraph-image.jpg?b57901e7917d2d58",
"content": "<div><div><p>From the team behind Pydantic, Logfire is a new type of observability platform built on the same belief as our open source library — that the most powerful tools can be easy to use.</p></div><div><p>Software developer? Then you’ve likely encountered these headaches</p><div><div><p>Working <strong>with over-complicated observability platforms</strong> that don't understand your code or application.</p></div><div><p>Sifting through <strong>endless print statements</strong> and decoding cryptic portrayals of Python objects in your logs.</p></div><div><p><strong>Guessing at the performance hit</strong> from a specific function, or a mysterious slowdown of your app.</p></div><div><p>Whether you’re building an AI tool or any other cloud-based app, these frustrating scenarios are avoidable but all too real.</p></div></div></div><div><div><svg width=\"100%\" height=\"100%\"></svg><div><p>INTRODUCING LOGFIRE</p><h2>A more intuitive way to understand your </h2><p>Pydantic Logfire is a window into the inner workings of your application. Smooth to set up and easy to understand, with ready integrations for many popular libraries.</p></div></div><div><p>Features</p><div><div><p>While Pydantic Logfire is Python-first, it’s an observability platform that works just as well with other programming languages.</p></div><div><p>Transform garbled logs into actionable insights. Discover not just how long a function takes to run, but which queries slow down your app.</p></div><div><p>Understand your app’s behaviour — from request headers and bodies to the full trace of program execution.</p></div><div><p>Turn your logs into visualizations, dashboards, and alerts that drive development forward.</p></div></div></div></div><div><p>Insights</p><div><h3>Faster fixes, deeper insights</h3></div><p>With an SDK built on top of OpenTelemetry, structured data and an intuitive interface, Pydantic Logfire makes it easy to monitor the behavior of Python applications, at every level. Instrument your app using best practices and draw powerful insights — without hiring a dedicated analytics or observability team.</p></div><div><div><h2>Structured Data &amp; Direct SQL Access</h2><p>Ensure your Python objects and structured data are query-ready. Use tools like Pandas, SQLAlchemy, or psql for querying, integrate seamlessly with BI software, and leverage AI for SQL generation.</p><div><pre><p><code><span>SELECT</span>\n attributes<span>-</span><span>&gt;&gt;</span><span>'campaign'</span> <span>as</span> campaign,\n <span>count</span>(<span>distinct</span> attributes<span>-</span><span>&gt;&gt;</span><span>'track_id'</span>) <span>as</span> clicks,\n round(<span>count</span>(<span>distinct</span> attributes<span>-</span><span>&gt;&gt;</span><span>'track_id'</span>)::<span>numeric</span><span>/</span><span>50</span><span>*</span><span>100</span>, <span>2</span>) <span>as</span> click_rate\n<span>FROM</span> records\n<span>WHERE</span>\n span_name <span>=</span> <span>'Click on {campaign}'</span> <span>and</span>\n attributes<span>-</span><span>&gt;&gt;</span><span>'campaign'</span> ilike <span>'c%'</span>\n<span>GROUP</span> <span>BY</span> attributes<span>-</span><span>&gt;&gt;</span><span>'campaign'</span></code></p></pre></div></div><div><div><h2>Manual Tracing</h2><p>You can use the logfire library to create logs and traces directly — it’s kind of like standard logging in Python, with a more modern interface and some extra capabilities. And a lot less painful than using OpenTelemetry directly.</p></div><div><pre><code><span>import</span> logfire\nlogfire.configure()\nname = <span>'world'</span>\nlogfire.info(<span>f'Hello, <span>{name}</span>!'</span>)\n<span># ^ Equivalent to:</span>\n<span># logfire.info('Hello, {name}!', name=name)</span>\nadvantages = <span>'timing'</span>, <span>'context'</span>, <span>'exception capturing'</span>\n<span>with</span> logfire.span(<span>f'spans provide: <span>{advantages}</span>'</span>):\n logfire.warn(<span>'the next line will raise an exception'</span>)\n <span>1</span> / <span>0</span></code></pre></div></div><div><h2>OpenTelemetry</h2><p><a target=\"_blank\" href=\"https://opentelemetry.io/docs/what-is-opentelemetry/\">OpenTelemetry</a> (OTel) is an open source observability framework, it provides libraries for Python and every other popular language to let you collect traces, logs and metrics.</p><p>OTel is a powerful tool that increasing numbers of developers want to use, but it can be time-consuming to set up and limited in the kinds of data it can collect.</p><p>Pydantic Logfire takes the best of OTel (instrumentation for popular Python packages, open standard for data transmission) and makes it easier to use and more flexible.</p><p>By harnessing OpenTelemetry, Pydantic Logfire offers automatic instrumentation for popular Python packages, enables cross-language data integration, and supports data export to any OpenTelemetry-compatible backend or proxy.</p></div></div><section><p></p><h2>Logfire is already making developers' lives easier</h2><p></p></section><div><div><h2><span>From the creators of Pydantic,</span> Crafted with the same developer obsession</h2><p>Built with developer experience at its core, Pydantic Logfire brings the same balance of ease, sophistication and productivity that’s made Pydantic the most popular data validation library on planet earth. Whether you’re using observability for the first time or an expert, we make it easy.</p></div><div><div><svg width=\"100%\" height=\"100%\"></svg><p>Out-of-the-box integration</p></div><p>Use Pydantic Logfire to monitor the data that runs through Pydantic for a customized experience that goes way beyond generic observability platforms.</p></div></div><div><p>FOR DEVELOPERS</p><p>Ready to start building?</p><p>Logfire’s Python SDK is open source under the MIT license and wraps the OpenTelemetry Python package. By default, it will send data to the Logfire platform but you could send data to any OpenTelemetry Protocol (OTLP) compliant endpoint.</p></div></div>",
"author": "",
"favicon": "https://pydantic.dev/favicon/favicon.ico",
"source": "pydantic.dev",
"published": "",
"ttr": 123,
"type": ""
}