Most active commenters
  • necovek(4)

←back to thread

Pydantic Logfire

(pydantic.dev)
146 points ellieh | 32 comments | | HN request time: 0.95s | source | bottom
1. serjester ◴[] No.40212723[source]
I love pydantic but I really have to wonder why they chose this route. There's already a ton of companies that do this really well and I'm trying to figure out how their solution is any different.

The llm integration seems promising but if you care about LLM observability you probably also care about evals, guardrails and a million other things that are very specific to LLM's. Is it possible to build all this under one platform?

I do hope I'm wrong for the sake of pydantic-core.

replies(3): >>40212966 #>>40214112 #>>40214695 #
2. thenipper ◴[] No.40212966[source]
Agreed. I use pydantic daily and I'm in the position to try this out... but why? It really seems to be a weird divergence from their core product.
replies(2): >>40213832 #>>40214245 #
3. Yenrabbit ◴[] No.40213832[source]
They also have a UI framework (fastui). They have funding and devs looking to be useful, I think it's fine that they get to try out new things that work well with their core product.
4. wferrell ◴[] No.40214112[source]
Who do you like who does this well?

I think Pydantic is great software and so I am inclined to see if this too will be great software.

replies(3): >>40214480 #>>40215321 #>>40219124 #
5. ◴[] No.40214245[source]
6. clintonb ◴[] No.40214480[source]
My last company used Splunk and SignalFx. They were fine, but I wasn't necessarily in the weeds with configuration and usage. The Observability Team made it easy to use.

My current company, a much small startup, primarily uses Datadog and we are starting to better integrage Honeycomb. We mostly abandoned Google Cloud Monitoring because the UI/UX are not that great. Honeycomb is a paradigm, so took some time for us/me to understand. It's growing on us.

Despite the ability to completely blow up our bill (which is now better controlled), Datadog is a good product that lets us quickly answer questions when things go wrong. It's not perfect, but it's the best we have right now. The UI is intuitive, and facilitates more discovery (esp. for metrics and their attributes).

replies(1): >>40214968 #
7. scolvin ◴[] No.40214695[source]
Pydantic creator here.

I understand why this might be your reaction, but let me just share my thoughts:

Can we build all the LLM things people want? Yes I think so, early feedback is that Logfire is already much more comprehensive than LLM specific solutions.

How is our solution any different? AFAIK:

* no one else offers opinionated wrapper for OTel to make it nicer to use, but with all the advantages

* no one else does auto-tracing (basically profiling) using import hooks the way we do

* no one else has dedicated instrumentation for OpenAI or Pydantic

* no one else provides metadata about python objects the way we do so we can render a semi-faithful repr of complex objects (Pydantic models, dataclasses, dataframes etc.) in the web UI

* no one else (except Sentry, who are doing something different) makes it really easy to start using it

* no one else lets you query observability data with SQL

In my mind, the obvious alternative would be to do the thing most OSS companies do, and build "Pydantic Cloud", then start adding features to that instead of the open source package. I didn't want to do that, and I don't think our users would like that either.

In the end I decided to build Logfire for two reasons:

1. I wanted it, and have wanted it for years

2. I think building a commercial product like this, then using OSS to spread the word and drive adoption is a really exciting way to incentivize us to make the open source as good as possible — good as-in permissive and good as-in well maintained. And it means that our commercial success is not in tension with the adoption of our open source, which has been a recurring issue for companies trying to capitalize on their open source brand.

replies(4): >>40215045 #>>40215146 #>>40215756 #>>40221179 #
8. cipherself ◴[] No.40214968{3}[source]
I am kinda confused by your comment, OP is about tracing as far as I understood, but you're referencing Google Cloud Monitoring (whereas the comparable thing would be Google Cloud Trace) and then again

  (esp. for metrics and their attributes).
but OP isn't about metrics at all rather traces.
replies(2): >>40215325 #>>40218578 #
9. hakanderyal ◴[] No.40215045[source]
Useful product, great marketing site. This is obviously a labor of love. Keep it up!

Sadly I've moved on from Python world.

Funny anecdote, using Pydantic everywhere to improve maintainability made me realize I'm fighting an uphill battle with Python and I should move to a statically typed language, so I switched to C#.

Thanks for your work.

replies(4): >>40217691 #>>40217958 #>>40218303 #>>40218360 #
10. serjester ◴[] No.40215146[source]
Thanks for the response, massive kudos - I look forward to trying it out!
11. emmanueloga_ ◴[] No.40215321[source]
Looks like "Pydantic Logfire" is another entry on the category of "APM"s? [1]

Gotta echo the sentiment that Logfire doesn't seem to be too closely related to Pydantic... Also, afaict it looks like the frontend is not open source, unless I'm missing something [2]. So, not a tool that one could self-host?

--

1: https://github.com/topics/apm

2: https://github.com/pydantic/logfire/

replies(1): >>40217527 #
12. gazpacho ◴[] No.40215325{4}[source]
Hi, I'm one of the developers of Logfire. We do support metrics! Our vision is a single pane of glass observability where you can easily go from metrics <-> traces both via correlation and by creating metrics/dashboards from traces.

We also support logging as an integrated concept into tracing (you can emit events without a duration that are just like a log but carry context of where they were emitted from relative to a trace).

13. btown ◴[] No.40215756[source]
This is very cool. Could someone use Logfire alongside Honeycomb or another OTel platform? Honeycomb's strengths in drilling into an interactive chart vs. Logfire's strengths in drilling into a stream of text logs (and SQL support!) seem very complementary.

Certainly seems like the Logfire initializer could coexist with code like in https://docs.honeycomb.io/send-data/logs/opentelemetry/sdk/p... - is this a reasonable assumption? We're looking into modernizing our Honeycomb integration from their older direct integration to their OTel SDK, and would be very curious if Logfire can exist alongside this. Do you do any patching of OTel internals that would make this impossible?

replies(1): >>40215869 #
14. scolvin ◴[] No.40215869{3}[source]
You can send data from any OTLP endpoint, so yes.

I don't think we currently expose an easy way for you to send data to two (e.g. honeycomb and logfire), it it should be entirely doable, and if people want that, we can make it easy.

15. threecheese ◴[] No.40217527{3}[source]
I’ve observed that Pydantic - which we’ve used for years in our API stack - has become very popular in LLM applications, for its type-adjacent features. It serves as a foundational technology for prompting libraries like [DSPy](https://github.com/stanfordnlp/dspy) which are abstracting “up the stack” of LLM apps. (some opinions there)

Operating AI apps reveals a big challenge, in that debugging probabilistic code paths requires more than the usual introspective abilities, and in an environment where function calls can have very real monetary impact we have to be able to see what’s happening in the runtime. See LangChain’s hosted solution (can’t recall the name) that allows an operator to see prompts and responses “on the wire”. (It just occurred to me that Langchain and Pydantic have a lot in common here, in approach.)

Having a coupling between Pydantic - which is *just about* the data layer itself - and an observability tool seems very interesting to me, and having this come from the folks who built it does not seem unreasonable. WRT open source and monetization, I would be lying if I said I wasn’t a little worried - given the recent few months - but I am choosing to see this in a positive light, given this team’s “believability weight” (to overuse Dalio) and history of delivering solid and really useful tooling.

16. sirsinsalot ◴[] No.40217691{3}[source]
Honestly, after spending the last 10 years developing in Python, I'm considering doing something similar. I've lived the problems. They suck for engineering software with longevity.
17. necovek ◴[] No.40217958{3}[source]
This is admittedly an unpopular opinion.

I've actually really wondered why one wants static typing, especially with a language as expressive as Python, and where you can be so efficient with it?

At a time, I was mesmerized with Zope (esp 3), but learned that nobody really learns to use it, but instead learns to work around it — for the uninitiated, Zope provided "interfaces", you'd have classes implementing those interfaces, and you could happily mix and match with "configuration" that lived in ZCML (an XML schema) files, way back in early 2000s.

Static typing really kills off some of the biggest benefits of using Python (like "duck typing" to quickly emulate an identical API without having to construct a hierarchy of types before you can do that).

How many bugs have you really hit in your Python code because of lack of static types? For ~20 years of doing Python, I honestly believe that it could have helped me at most once or twice. Generally, doing sufficient level of testing has covered most potential misuse of code, and you need to have tests anyway.

The reason I'd want to move away from Python is mostly pure performance (loops should not be this slow) and library ecosystem (crappy code has risen to the top), but I find nothing is nearly as expressive, has a comparable standard library plus allows one to be so efficient.

replies(3): >>40218609 #>>40219378 #>>40237194 #
18. BurningFrog ◴[] No.40218360{3}[source]
When I get tired of Python, I think of working in Ruby instead.

Maybe it's the Python disease of trying to be everything at once, which can end up as the worst of all worlds.

Ruby is a proudly untyped language, and that's all it is.

replies(1): >>40224293 #
19. clintonb ◴[] No.40218578{4}[source]
Google Cloud Monitoring (https://console.cloud.google.com/monitoring), perhaps not what you call it, supports the big three signals—logs, traces, metrics.
20. imiric ◴[] No.40218609{4}[source]
> How many bugs have you really hit in your Python code because of lack of static types?

I don't work with Python much anymore (happily moved on to Go :), but was a heavy user for ~15 years. And honestly, typing issues were pretty common, if not the most common issue across all codebases I've worked on.

The problem with dynamic typing is that, at the end of the day, you're still working with and thinking about types. You have to be implicitly aware of which type the function you're calling expects, which not only increases your mental burden, but makes refactoring much more unreliable. You have to rely on documentation or _very_ thorough tests, which most codebases don't have to the extent and quality they should.

With static typing, all of this goes away. Types become explicit (remember "explicit is better than implicit"? Yeah...), you get immediate feedback from your IDE when passing the wrong type, and the code simply doesn't compile.

Best of all, you don't learn about a TypeError exception from a Sentry alert after your users run into it. The amount of times this happens in the wild is shockingly high.

> For ~20 years of doing Python, I honestly believe that it could have helped me at most once or twice.

I honestly struggle to believe this, but good on you if true.

> Generally, doing sufficient level of testing has covered most potential misuse of code, and you need to have tests anyway.

But that's the thing: in order to catch basic typing issues, you would have to have dozens of tiny and mostly pointless tests for each function. Yes you need tests, but most tests, even at the unit level, shouldn't be concerned about types, but about the functionality. And you won't catch typing issues at the boundaries in integration, or higher level tests. Static typing simply helps you avoid all of this nuisance, and ultimately write more robust and maintainable code.

If I was ever to work on a Python codebase again, I wouldn't consider it without a runtime type checker like Mypy, or whatever state of the art tooling is these days. All the supposed freedom of dynamic and duck typing just isn't worth it.

replies(2): >>40221748 #>>40259277 #
21. OutOfHere ◴[] No.40219124[source]
This is more a service than it is software. It can't independently be used as a software without relying on their service.
22. hakanderyal ◴[] No.40219378{4}[source]
Main selling point for me is productivity. Performance benefits are just icing on the cake.

Being explicit about types allows the IDE and platform to help you write & refactor code, allowing your brain to work on the actual problem instead.

This may sound surprising but modern C#/.NET is almost as expressive as Python. You don`t need unnecessary boilerplate or AbstractBaseFactorySingletonProxyDecoratorAdapterWrapper style types. LINQ alone is a game changer. I`m still writing code with almost same style as Python in C#, but now with the power of IDE behind me. I`m much more productive.

Interfaces are duck typing in an explicit form. Being explicit about it may sound more work, but you also need that work in Python if you want your solution to become maintainable, in the form of tests.

I`ve been using Python for ~10 years (with years of PHP/Ruby before) and written probably hundreds of thousands of lines of code. One thing I don`t like while programming is doing unnecessary work myself if the computer can do it. So I do a lot of meta programming and build abstractions when it becomes annoying to repeat myself. There had been a lot of moments where I return to a highly dynamic part of code that I`ve written months before to fix a bug and spend a lot of time trying to figure out how everything is connected. Same code in C# is both quicker to write (once you grok how reflection works and how everything is tied together), and infinitely more maintainable for less work.

Give C#/.NET a serious try. You may become surprised. I was.

replies(1): >>40275046 #
23. nirga ◴[] No.40221179[source]
OpenLLMetry creator here. We’re building the most popular OpenTelemetry instrumentation for LLm providers including OpenAI, Anthropic, Pinecone, Langchain and >10 others since last August [1]. We’re using import hooks (like other otel instrumentations), and offer an sdk with a one line install. I’m also aware of other OSS initiatives doing similar initiatives, so I wouldn’t say no one has ever done what your doing.

[1] https://github.com/traceloop/openllmetry

replies(1): >>40226179 #
24. rewsiffer ◴[] No.40221748{5}[source]
You perfectly articulated how I feel about python and why I am trying to move my team’s projects to Go.
replies(2): >>40224250 #>>40237205 #
25. neonsunset ◴[] No.40224250{6}[source]
Hopefully Go being such a bare bones language with unsound features will tire you out soon enough to follow the sibling comment in moving to C# instead :)
26. neonsunset ◴[] No.40224293{4}[source]
It does not offer better productivity, sometimes worse due to brittleness, at the cost of 0.1x performance of .NET.

It is this easy to make a back-end application with ASP.NET Core: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/m...

27. kakaly0403 ◴[] No.40226179{3}[source]
+1 to this. Langtrace core maintainer here. We are building a SDK and a client for automatic instrumentation of LLM based applications using OTEL standards. The OpenLLMetry team along with the CNCF OpenTelemetry working group has been doing some great work standardizing semantic naming conventions and we are starting to adopt the same set of standards.

[1] https://github.com/Scale3-Labs/langtrace [2] https://github.com/open-telemetry/semantic-conventions/blob/...

28. LtWorf ◴[] No.40237194{4}[source]
You want correct data.
29. LtWorf ◴[] No.40237205{6}[source]
If you don't want type errors, go is not the best language to pick.
30. necovek ◴[] No.40259277{5}[source]
> I honestly struggle to believe this, but good on you if true.

Having seen some of the codebases in the wild as I moved projects, I can understand why someone would feel that way — and to be honest, I was referring to the code I wrote, not necessarily code that someone else wrote, where I've seen many type errors, but which were really either irrelevant (exceptions that should have been "nicer" errors, as in, this was bad data getting passed in between systems), or missing functional tests (see below).

Notably, once I moved to a Go codebase, I uncovered a weird bug that could have been caught by typing, but really wasn't due to induced type complexity by the developers to get things to work at all — mostly to demonstrate that complex type structure likely leads to bugs, rather than typing or lack of typing.

> But that's the thing: in order to catch basic typing issues, you would have to have dozens of tiny and mostly pointless tests for each function.

Yes, that's the thing: I am specifically not referring to the "typing" type of test like "this throws an error if an int is passed in instead of a str" or BaseFoo instead of BaseBar, but really, a test that confirms something fails when it needs to fail, and works when it needs to pass — iow, regular functional tests that you need either way.

> Static typing simply helps you avoid all of this nuisance, and ultimately write more robust and maintainable code.

I fully accept that may be true for some codebases, but I don't think it's true for everyone. My biggest gripe with Python is that idiomatic (or maybe "widely accepted way to write") Python leads to less robust and maintainable code, and non-stdlib packages are really, really, crappy. Django does like a gazillion of those anti-patterns, but even things like SQLAlchemy, Requests, Flask, FastAPI are problematic.

I had the (mis?)fortune to land my first real job in a wonderful TDD shop way back in mid-2000s, and after I survived 6 months without getting fired (and it was close, I heard later :)), it was an excellent learning opportunity.

31. necovek ◴[] No.40275046{5}[source]
> LINQ alone is a game changer. I`m still writing code with almost same style as Python in C#,...

That's very curious: do you have any quick examples that you could point me to?

I was generally intrigued by C# and .NET way back when it was introduced and especially when Mono started shipping the runtime for Linux, but I hated the boilerplate and couldn't move away from Python for that reason.

replies(1): >>40275971 #
32. necovek ◴[] No.40275971{6}[source]
FWIW, I've read up on LINQ and it strikes me as having exactly the same issues as any ORM generally does: you lose on the expressiveness needed to get most optimal querying capabilities for the tool in use (eg. Postgres specifics or SQLite specifics or...).

This is not to say that one should use string concatenation to construct queries, but that you want smart tools that do just enough. I.e. I like Storm expression language or sqlalchemy-core to express SQL as Python, but getting into deeper ORM level stuff generally harms what you can achieve once you need more complex stuff.