all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [RFC proxmox-backup v2 0/2] Tasklog rewrite with tracing
@ 2023-10-25 13:53 Gabriel Goller
  2023-10-25 13:53 ` [pbs-devel] [RFC proxmox-backup v2 1/2] log: removed task_log! macro and moved to tracing Gabriel Goller
  2023-10-25 13:53 ` [pbs-devel] [RFC proxmox v2 2/2] proxmox-log: added tracing infra Gabriel Goller
  0 siblings, 2 replies; 12+ messages in thread
From: Gabriel Goller @ 2023-10-25 13:53 UTC (permalink / raw)
  To: pbs-devel

Removed the task_log! (and friends task_warn!, task_debug!, etc.) macro
and introduced the `tracing` crate. We now initiate the tracing crate
using two Layers, first the syslog layer (using the `syslog` crate) and
the `file_layer`. The file_layer uses the original `FileLogger`.

To write to the task logs from the worker threads and tasks, we now
have a task_local logger (and warning counter) in the file_layer, which
will get instantiated when a task/thread is created. This means that
when we call `info!` or any other `tracing` log macros (with the "tasklog"
attribute), it will get the file_logger from TLS and write to the file.

Most notable changes since version 1:
 - Remove the 'tasklog = true' attribute and infer the context
    - Wrap the worker_thread or worker_task in a span with name
      'worker_task'
    - All events in the span with name 'worker_task' get logged to the
      file_logger, everything else goes to syslog (Error events go to
      both)
 - Remove the `Option<>` around the `FileLogger` in TLS
 - Clippy fixes


Gabriel Goller (1):
  log: removed task_log! macro and moved to tracing

 Cargo.toml                       |  61 ++++----
 pbs-api-types/src/metrics.rs     |   1 -
 pbs-api-types/src/node.rs        |   3 +-
 pbs-datastore/Cargo.toml         |   1 +
 pbs-datastore/src/chunk_store.rs |  30 +---
 pbs-datastore/src/datastore.rs   |  74 +++++-----
 src/api2/admin/datastore.rs      |  24 ++--
 src/api2/admin/metrics.rs        |   2 +-
 src/api2/config/acme.rs          |  20 +--
 src/api2/config/datastore.rs     |  12 +-
 src/api2/node/apt.rs             |  13 +-
 src/api2/node/certificates.rs    |  64 ++++-----
 src/api2/node/disks/directory.rs |  13 +-
 src/api2/node/disks/mod.rs       |   6 +-
 src/api2/node/disks/zfs.rs       |  30 ++--
 src/api2/node/mod.rs             |  11 +-
 src/api2/pull.rs                 |  28 ++--
 src/api2/tape/backup.rs          |  80 +++++------
 src/api2/tape/drive.rs           | 135 +++++++----------
 src/api2/tape/restore.rs         | 240 ++++++++++---------------------
 src/backup/verify.rs             | 104 ++++----------
 src/bin/proxmox-backup-api.rs    |  10 +-
 src/bin/proxmox-backup-proxy.rs  |  42 ++----
 src/server/gc_job.rs             |   6 +-
 src/server/prune_job.rs          |  26 ++--
 src/server/pull.rs               | 166 ++++++++-------------
 src/server/realm_sync_job.rs     |  40 ++----
 src/server/verify_job.rs         |  10 +-
 src/tape/drive/mod.rs            |  34 ++---
 src/tape/pool_writer/mod.rs      |  85 +++++------
 tests/worker-task-abort.rs       |   9 +-
 31 files changed, 510 insertions(+), 870 deletions(-)


Gabriel Goller (1):
  proxmox-log: added tracing infra

 Cargo.toml                                    |   6 +
 proxmox-log/Cargo.toml                        |  23 +++
 proxmox-log/debian/changelog                  |   5 +
 proxmox-log/debian/control                    |  53 +++++++
 proxmox-log/debian/copyright                  |  18 +++
 proxmox-log/debian/debcargo.toml              |   7 +
 proxmox-log/src/file_layer.rs                 | 139 ++++++++++++++++++
 .../src/file_logger.rs                        |   2 +-
 proxmox-log/src/lib.rs                        |  50 +++++++
 proxmox-log/src/syslog_layer.rs               | 111 ++++++++++++++
 proxmox-rest-server/Cargo.toml                |   2 +
 proxmox-rest-server/src/api_config.rs         |   3 +-
 proxmox-rest-server/src/lib.rs                |   3 -
 proxmox-rest-server/src/rest.rs               |   4 +-
 proxmox-rest-server/src/worker_task.rs        | 120 ++++++++-------
 proxmox-sys/src/worker_task_context.rs        |  47 ------
 16 files changed, 488 insertions(+), 105 deletions(-)
 create mode 100644 proxmox-log/Cargo.toml
 create mode 100644 proxmox-log/debian/changelog
 create mode 100644 proxmox-log/debian/control
 create mode 100644 proxmox-log/debian/copyright
 create mode 100644 proxmox-log/debian/debcargo.toml
 create mode 100644 proxmox-log/src/file_layer.rs
 rename {proxmox-rest-server => proxmox-log}/src/file_logger.rs (98%)
 create mode 100644 proxmox-log/src/lib.rs
 create mode 100644 proxmox-log/src/syslog_layer.rs

-- 
2.39.2





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-11-03 10:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-25 13:53 [pbs-devel] [RFC proxmox-backup v2 0/2] Tasklog rewrite with tracing Gabriel Goller
2023-10-25 13:53 ` [pbs-devel] [RFC proxmox-backup v2 1/2] log: removed task_log! macro and moved to tracing Gabriel Goller
2023-10-27  8:31   ` Gabriel Goller
2023-10-25 13:53 ` [pbs-devel] [RFC proxmox v2 2/2] proxmox-log: added tracing infra Gabriel Goller
2023-11-02 13:43   ` Wolfgang Bumiller
2023-11-02 14:58     ` Gabriel Goller
2023-11-03  8:56       ` Wolfgang Bumiller
2023-11-03  9:24         ` Gabriel Goller
2023-11-03  9:52           ` Wolfgang Bumiller
2023-11-03 10:27             ` Gabriel Goller
2023-11-03 10:39               ` Wolfgang Bumiller
2023-11-03 10:49                 ` Gabriel Goller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal