mjl- / mox

modern full-featured open source secure mail server for low-maintenance self-hosted email
https://www.xmox.nl
MIT License
3.36k stars 89 forks source link

Implementation of OpenTelemetry #167

Closed ryuichi1208 closed 2 months ago

ryuichi1208 commented 2 months ago

Thank you for the wonderful tool. Have you considered SMTP level tracing on your mail server?

For example, it would be useful if you are using a mail server as a relay server and want to trace the processing results all at once.

mjl- commented 2 months ago

I think you're interested in opentelemetry traces, with spans and attributes, right? With spans for individual SMTP commands, and/or activity like SPF or DKIM verification.

So far, the structured logging has been more than enough for me. What kind of use cases/insights will opentelemetry tracing help with? Performance debugging maybe? I think it would require adding tracing calls throughout the (SMTP) code paths, to start & end spans, and to set attributes?

Mox can log SMTP protocol traces (and IMAP) with the trace* log levels, but I don't think that's what you're looking for.

ryuichi1208 commented 2 months ago

I was thinking of using it for distributed tracing. For example, in the case of relaying mail servers in multiple stages, I think it would be good to have a mechanism to propagate the trace ID on each mail server.

mjl- commented 2 months ago

So you would have to propagate the trace ID over SMTP to another mail server? I'm don't know of a standardized way to pass such an attribute. A custom mechanism could be created. Once that's available, including it in structured logging may be enough?

I'm not sure I really understand the use case. Is this a setup you already have (relaying mail servers in multiple stages)? And are you running into trouble that currently can't easily be debugged? I tend to wait to implement things like this when there's a clear & strong enough need for it (that warrants implementing/maintaining the feature).

ryuichi1208 commented 2 months ago

Currently, I am using Postfix and am having trouble debugging distributed tracing in such an environment.

I thought it would be possible to achieve something like this with this solution, so I would like to propose it again once this technology has matured further.

thank you