nginx/ngx-rust

`log` and `tracing` integration

bavshin-f5 opened this issue · 0 comments

We want to capture logs from external dependencies. This could be done by registering an implementation for the most popular log facades, log and tracing, with the latter one being optional, as it offers tracing/log or tracing/log-always feature flags for sending messages to the log.

Considerations:

  • Log messages should be mapped to an appropriate ngx_log_t instance: cycle, conf, connection, request or event. This may require a global mutable state with careful tracking of log ownership/lifetime.
  • ngx_log_t is not thread-safe. No surprises here, almost everything in NGINX is !Send + !Sync.
  • Needs to be opt-in, as the SDK users may have different ideas about the log destinations.
  • Would be nice to be able to filter, rate-limit or downgrade severity of the messages. E.g. if an error happens on every n-th request, then maybe it should be changed to a warning or even excluded from the logging.
    This could be omitted from the initial implementation.