Fixed Otel breaking logging. Fixes #2642
I'm not entirely sure why all the otel features are disabled by default, but obviously reenabling them addresses the issue.
In the existing configuration otel is behind feature which isn't enabled moving to the error log statement, but because tracing/logging hasn't been initialized no logs appear. A fix for that would be to just move the set_global_default into the #[cfg(not(feature = "console")) block and it will log the error and allow logs to work, but then otel doesn't forward traces or even work, so I am not entirely sure what this block is for at all other than only to allow otel traces in a dev setting with the console feature enabled.
Either way, these changes allow the otel traces and logs to work when the otel url is enabled, otherwise it will just default to the default logging. Fixes #2642.
Im completely unfamiliar with opentelemetry, or why it is useful. Your PR is enabling it by default, and Im not sure what the benefits of that are. One disadvantage is that it will increase compilation time for all development builds, so there should be a good reason.
If you want to use opentelemetry with current releases, you have to build from source and pass --features console
Opentelemetry is used for visibility into applications. I can go build my own for sure with the feature enabled, I just would assume as the user base is growing it would be useful for folk to have the ability to better triage issues.
So for example, this is what the lemmy-ui produces when auto instrumented:
This is what pict-rs is reporting out:
If the lemmy service itself gets otel added, it will connect all of them together so you can see how long and where calls are going, where bottle necks are, such as that. I'm not a great salesman for this stuff, in my experience many people have a number of different reasons why they found otel useful, in the case of lemmy I would image it would be useful to illuminate issues cross services to see where failures or timeouts are occurring from basic usage.
While yes it is additional build time, I personally if I had a large instance, I would rather have this as a flag I could turn off and on so that if there is a problem I don't have rebuild an image and push it up, I just have to restart the service.
At the end of the day it is up to you, just thought this would be helpful to have working and to fix the mentioned issue. Sorry for all the rambling.
Thanks for the explanation. Im closing in favor of https://github.com/LemmyNet/lemmy/pull/3355.