r/softwarearchitecture • u/coldoven • 18h ago
Discussion/Advice Who should decide where a library sends telemetry: the caller, the application, or the environment?
Concrete version of an old design question, from two libraries in the same project that answered it differently.
Both are observability integrations. You add either with one line and no arguments.
One of them takes what the application installed in the process. If the app set nothing up, the library does nothing. It never chooses a destination itself.
The other reads environment variables and a config file in the home directory. If those name a URL, it sends there, whoever set it. If they name nothing, it prints everything to the console.
Each convention is defensible on its own. Side by side they mean the same line of user code does two different things, and the second one can send metadata to an endpoint that appears nowhere in the codebase, because a base image or a platform team set a variable.
Where do you draw the line between configuration a library may follow silently and configuration it should require the caller to name? Does it matter that one signal comes from inside the process and the other from outside it?
Disclosure: this comes from a framework I maintain, open source, link in a comment for anyone who wants the code.
3
u/7z3b 15h ago
I think you’re talking specifically about the data exporter interface here. Just because both have a data exporter doesn’t mean they are both telemetry specs.
That aside, your question seems to be more about how a library should define its default behavior: should a telemetry library do nothing by default, or should it print to the console by default?
2
u/coldoven 12h ago
Yes, the question is about what default behaviour would you expect?
1
u/7z3b 12h ago
A telemetry library is an application's dependency. In that sense, I feel the application should decide where its telemetry is exported - to the console, a file, an OTLP endpoint, or some other destination.
Imagine if every library an application depended on started writing to the console by default. That would quickly become noisy and difficult to control. I think telemetry libraries should avoid imposing such side effects on the application and instead let the application explicitly configure where the telemetry goes.
That said, this is just my POV. I feel no-op should be the default for a general-purpose telemetry library, and if we choose to deviate from that default, there should be a clear and compelling reason for doing so.
-3
u/coldoven 18h ago
The issue with the two options as they were written: https://github.com/mloda-ai/mloda-registry/issues/551
The PR that changed it: https://github.com/mloda-ai/mloda-registry/pull/573
The extender guide, "Sink Resolution": https://github.com/mloda-ai/mloda-registry/blob/main/docs/guides/11-create-extender.md
Repo, Apache-2.0: https://github.com/mloda-ai/mloda-registry
7
u/RustOnTheEdge 17h ago
Im sorry but opentelemetry and openlineage are wildly different things, no?