This article was originally published on The New Stack.
Picture this: You’re having a lovely afternoon, you’ve cooked a delicious dinner, you took a walk around the neighborhood and you’re feeling delightful. Well, that just won’t do. Delightful? In this economy? I have the perfect solution! Setting up OpenTelemetry in your favorite ReactJS frontend side project. It’s the ideal fix for when you’re feeling cheerful and need to put a solid scowl back on your face come Monday morning.
With just 82 confusing instructions that might not work with your favorite toolchain, you, too, can get lost in a maze of subtle fiddly details. In fact we’ll throw in a free performance penalty for your app’s asynchronous code!
But wait, there’s more! It’s not enough to install the dependencies, you’ve got to use them, too. Luckily, using OpenTelemetry to instrument the frontend is sure to bring out a frown. From facing context woes correlating server-side rendering with client hydration, to watching user sessions break on page navigation unless you carefully thread it through local storage, to dealing with telemetry dying when users close or switch the tab, you’re sure to find a way to experience exasperation.
If that’s not enough, you can always trigger an existential crisis by asking yourself how to add an attribute to the “main” span. Is there an API method for that? Of course not. Luckily all the cool kids know to cite Jeremy’s blog post for a neat workaround (naturally, making it work on the browser is left as an exercise to the reader).
OK, there’s a bit of exaggeration going on and things are improving over time, but the friction is pervasive, especially when compared to Java or Go on the backend. That said, hmm… Wait a minute, aren’t frontend developers the majority of the industry? Haven’t they needed high cardinality observability for decades? How did we get here, anyway? Maybe we need to take a step back and ask if we’re approaching frontend observability the wrong way.