Finding Slow Code with Wrapture

(grahamdumpleton.me)

14 points | by lumpa 2 days ago

2 comments

  • themgt 1 hour ago
    Every "experienced software developer with expertise across multiple programming languages and technologies" in 2025:

    Currently, I'm on sabbatical (micro retirement) and pondering full retirement. The IT industry has undergone significant upheavals in recent years ... the rapid advancement of AI technologies has created new challenges for experienced developers seeking meaningful work opportunities.

    In 2026:

    The cheaper cousin. Everything above retained a duration. Sometimes the answer is just a number, and the Counter collector counts operations as they begin and keeps nothing else, which makes it cheap enough to leave running under a whole test suite. Bind a database layer's execute once, register a counter, and give every test a query budget in a fixture, and the classic N+1 regression fails with a number attached rather than slipping through as a test that merely got slower.

    • jenniferhooley 14 minutes ago
      lmao. Yep. I guess they all took a sabbatical and decided F** it, lobotomize me, I'm all in.
  • simonw 2 hours ago
    I'm really excited about this library.

    Wrapture is a new project from Graham, who previously developed wrapt (a 20+ year old Python monkey patching library) and built the first version of the New Relic Python agent - the library that instruments your app so New Relic can show you watt its doing.

    Wrapture provides the ability to both mock and instrument code in the same toolset. You can use it in tests for "did this method fire" or "when this method fires return this dummy data instead", and you can also use it to instrument your code to measure what's called and how long things take.

    It can instrument existing Python code without you modifying that code - you can instead define a TOML file saying which methods you want to instrument and Wrapture will live patch the code for you. This means you can instrument any Python code that you need to run without changing it, and export the results to OpenTelemetry.

    The linked article is part of a series of posts Graham wrote about it. I suggest starting here: https://grahamdumpleton.me/posts/2026/08/introducing-wraptur...

    Then hit the index post he just published that links to his others: https://grahamdumpleton.me/posts/2026/09/trying-out-wrapture...