Blog My Happy PlaceGemma Lara Savill

Beyond testability: unobservable code, a silent warning

By Gemma Lara Savill
Published at July 22, 2025

Beyond

I was adding some observability metrics to a codebase the other day, and some parts were challenging to measure. This got me thinking.

We all know that if your code is not testable, it's not verifiable, and thus not reliable. But what if your code is not observable?

What if you are trying to generate metrics to measure when an element appears in the UI? If you find it difficult to send the required metric with the necessary dimensions, or if the logic is not centralized or aligned? you might want to consider refactoring.

And what if you want to observe a specific screen loading sequence? you want to trace it. What if your logic is in the Fragment and not in the ViewModel? you also might want to consider refactoring.

Could code hard to measure, trace, etc., be a warning sign? Would that make good code, testable, tested code easier to trace and measure? Was that hard-to-observe-code tested? Testable even?

Another important point of adding observability to your codebase is that it gets you thinking about what is important. You want to measure and observe the important parts that impact behaviour, so those are the parts you want to center your attention on.

Using an observability platform, like Opentelemetry, helps you shine the light into the darker parts of your application at run time, to see what is going on. It is great when you don't really know what is happening. Or for the situations where you do know what is happening: crashing, slowness, etc, but you don't know why. This is when you need new eyes.

"The real voyage of discovery consists not in seeking new landscapes, but in having new eyes."

Marcel Proust

Conclusion

Adding observability to your code pays off before you get any signals sent. Just considering where to measure, trace, or log will get you thinking about what code parts are the most critical to your app.

If it is hard to add observability, take a closer look. Why is it hard? Is this part of the code tested? can it be tested? This could be a red flag to indicate that you really need to rethink and refactor this part of the codebase.