Launch HN: Patchwork (YC S24) – Automatically add structured logs to your code
There’s a demo video (https://youtu.be/ObIepiXfVx0), as well as a demo^ instance with some results for you to explore at https://hackernews.getpatchwork.io (no sign-in required!) The demo shows the analysis and improvement (against a style guide) of existing logs. It’s set up for two OSS repositories, https://github.com/elastic/cloud-on-k8s and our awesome friends at Glasskube (https://github.com/glasskube/glasskube). We welcome suggestions of other OSS Go repositories that you would like to see added!
Why we are building this: At our previous company, we relied heavily on actionable, context-rich structured logs. They were the unsexy but critical tool for managing complex software at scale. When they’re implemented well, they allow you to understand the application state when things break. Structured logs are easier to search and run analytics on. The trouble is that they are time-consuming to implement properly – if you’re reading this, you know it’s a chore. We all know it’s usually an SRE (like Alex) that finds out at 2 am that logs were added as an afterthought. Unstructured and spammy – Error: Failed to do task. Datadog made metrics easy; we are creating that moment for logs.
We've grappled with some tough technical challenges to build our product. First, identifying log statements in codebases where logger symbols are inconsistently named or output directly to stdout/stderr. We solved this with SCIP, indexing symbol references at compile time. Next, we needed to provide the LLM with method context and variable types to ensure we accurately understand what the code is doing. This is achieved using tree-sitter for parsing and SCIP for repo navigation. Finally, we addressed the critical need to reason whether specific data can/should be logged before bringing this all together in an improved logging statement. We’re staring down the next challenge – where should logging statements go in new code?
Refactoring the logs in existing code bases today is a manual slog. Even finding the existing logging and printf statements is tricky at scale. It’s possible to rely on Copilot in VS Code or Cursor to help construct logs as you write new code. However, there are many more reasoning steps required than these tools are designed to do. They are general purpose, zero-shot machines.
Our first goal is to reliably improve existing logging statements (as in the demo). In the next couple of weeks we aim to prove-out adding logs to new applications. Structured logs provide downstream benefits when it comes to storage and query time – our final goal is to build a storage layer that exploits this.
Your honest feedback would mean a lot to us. We have a lot of conviction that observability needs a shake up, and that going back and getting the basics right is valuable. We’d love to hear what you think works and doesn’t work in current approaches, and whether Patchwork solves a problem for you. Chat with us on Discord: https://discord.gg/fkVTgX5s.
^If you'd like to enrol additional repos and run analysis on them, there's a magic link step.
35 comments
[ 3.3 ms ] story [ 68.7 ms ] threadBut in a codebase where far more of the complexity is in native code and doesn't cross network boundaries, I imagine folks feel like they're flying blind without those tools that we Python devs can take for granted. So Patchwork is desperately needed. I'd be very curious to see how your larger observability platform integrates with the broader world of OpenTelemetry, where the native code might be part of a broader distributed system. It's cool to see this space moving forward so quickly!
Regarding the platform, transparently, it's early days for us and we're focusing on vanilla structured logs (generating better ones and then later storing them efficiently in something like ClickHouse), rather than tracing. Are there particular things you'd expect to see from a platform like this?
Does it checks the Log Levels and whether it's appropriate or not
I'm new to the world of querying through my logs, but I can already see a benefit to logging with JSON...
This is what I've defined as a solution for a need of mine for the moment: https://gist.github.com/avi-perl/b173fdc30219155eb9ee4bb3a21...
I thought this was well put together from Better Stack: https://betterstack.com/community/guides/logging/logging-bes...
Charity, CTO of Honeycomb has strong views (which we enjoy a lot): https://charity.wtf/tag/observability-2-0/ - they come at it from a tracing/OT angle which is Honeycomb's forte, but we agree a lot on the intended outcomes - actionable (not spammy/noisy) + make it easy to gather the variable/state context in the context of a single event.
I won't waste the chance to engage a logging connoisseur – could you see yourself using this if the hit rate was 99%?
Possibly yes! If I had a project running in production with a team this seems very valuable as another layer of defense. With these kinds of scanning tools however, they are quickly ignored if they tend to emit noise. If at all possible (from a cost perspective) I'd focus on launching a free version for open source projects complete with a badge to add to the readme. Similar to other Linting/CI projects. Might help gain a bunch of traction in the short term, and if it's free folks may be likely to add it and leave it even if the accuracy isn't perfect which may be nice marketing for y'all.
We could expand to comments. The code maintenance direction is a possibility but the reason we get out of bed right now is to make a worthy contribution to logging -> debugging -> SRE sleep :)
Nice.
slog is shorthand for structured logs[1][2][3][4]. So refactoring the logs [without a tool] is manually converting them to a slog. You have a great pun on your hands.
> Speaking from experience?
I have a notebook laying around with a loose plan on how to get the most compression possible out of a log file. It would use ML to figure out what the log strings would be - but I think your idea of scanning the executable is even more clever. Anyway, once it knows the log strings you can probably stuff it into off the shelf column storage for great compression rates. And if the compression rates are good enough then searches should be much much faster as well.
Who do you reckon are the more important existing competitors? Grafana labs or Sonarqube?
[1] https://github.com/slog-rs/slog
[2] https://github.com/gookit/slog
[3] https://github.com/kala13x/slog
[4] https://pkg.go.dev/log/slog
If you're willing to chat on the technical details of that notebook, we'd love to. Of course, if you're hoping to build it one day and don't feel comfortable sharing, understand. If yes, it's founders@getpatchwork.io :)
We are definitely eyeing up what can be done when you control the log strings and the rest of the payload. And along the lines of what you say, our first step would be to see how much ClickHouse could squeeze that, and then see what other clever compression could be added in advance.
Anyone crushing it in the code analysis and refactoring space is a challenger. I think for now our sense is that the full-blown agentic SWE tools have bitten off more than they can chew and aren't viewed as credible just yet. However there are people out there taking a focused, use-case-specific approach (like us) who are building impressive things. komment.ai is one that springs to mind. SonarQube looks interesting - thanks for flagging.
In terms of logging stack players, we're hoping some could be friend rather than foe, at least to begin with. We thought ClickHouse might see unstructured logs as an unlock for their customers / GTM motion. However, they have invested a lot in their query-time materialisation tech, which they said their log storage customers love. Expensive, in practice, I suspect. Grafana actually pinged me yesterday.
The write up [0] sounds really useful, and says it's open source, but for the life of me I can't find it.
[0] https://www.patched.codes/blog/patched-moa-optimizing-infere...
Thanks for the congrats :)
Want to drop us an email (founders@getpatchwork.io)? Right now we do our best to make pricing work for our customers because the real value for us in this early stage is your feedback. (Cliche but true :) )
It's also 100% open-source.
On the OSS piece, we are not ignoring this. It's very early days for us so we are figuring out how best to balance our limited resources and, in the future, make a thoughtful contribution to the community.
(Edit: just clocked that you _are_ OneUptime.com, so some of my questions won't make total sense. We'd love to understand how your users have responded to those capabilities, if you're willing to share)
Moving forward we will be able to support Python, Ruby, TypeScript, JavaScript, Scala, and Kotlin as well.
I'll check the page issue on firefox. Thanks for the flag.