Add a `OTEL_DEBUG` env variable for enabling debug mode
Right now we use an OTEL_EXPORT variable for switching between debug mode & exporting to an opentelemetry service — https://github.com/electric-sql/electric/blob/5cd4a9595f86199ebc6ea1039152025de75859cb/packages/sync-service/config/runtime.exs#L35-L70
Instead we should add an OTEL_DEBUG which enable debug mode and otherwise export if the other otel configuration is correct.
@kevin-dp, my interpretation is that OTEL_EXPORT from OTEL_DEBUG.
Where you can have the two behaviours commutatively like:
-
OTEL_DEBUG=1prints data to stdout -
OTEL_EXPORT=otlpexports data
I think in this case we don't care about the specific value of OTEL_EXPORT, just that it is set
@balegas Why OTEL_DEBUG=1 and not OTEL_DEBUG=true? We've been using boolean values for configuration flags so far.
Even though it's not spelled out in the issue description, I remember @KyleAMathews saying that OTEL_EXPORT is unnecessary, setting OTLP_ENDPOINT by itself should be enough to enable the export, while OTEL_DEBUG is a complementary option that can enable debug logging to stdout independently from the OTLP export config.
yeah, it's not an either or — OTEL_DEBUG overrides OTEL_EXPORT when set — it's like any other DEBUG=true mode.
Actually now that I think about it — we'd still want to send traces to an external services even when we're debugging locally. So OTEL_DEBUG just adds output to the terminal.
Agree that OTEL_DEBUG=true makes more sense. That's how most env variable settings work afaik.