]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs_mirror: format sync timestamps as ISO-8601 local time
authorKotresh HR <khiremat@redhat.com>
Thu, 23 Jul 2026 11:36:46 +0000 (17:06 +0530)
committerKotresh HR <khiremat@redhat.com>
Thu, 23 Jul 2026 11:36:46 +0000 (17:06 +0530)
Show sync_time_stamp and metrics_updated_at as human-readable
local timestamps in peer_status and mgr status. Keep epoch in
omap and counter dump.

Fixes: https://tracker.ceph.com/issues/76506
Signed-off-by: Kotresh HR <khiremat@redhat.com>
src/pybind/mgr/mirroring/fs/metrics/format.py
src/tools/cephfs_mirror/PeerReplayer.cc

index 943eeb14e2c42848ca3e4082a1691b3bcc33b94a..6ef0b8089f8f5162abebb69e71be5f6d14b56000 100644 (file)
@@ -1,3 +1,6 @@
+from ..checkpoint import format_epoch_timestamp
+
+
 def default_sync_stat_metrics():
     return {
         'state': 'idle',
@@ -134,8 +137,8 @@ def format_and_order_sync_stat_for_display(stat, policy=None, dir_path=None,
         if isinstance(sync_bytes, (int, float)):
             snap['sync_bytes'] = _format_bytes(sync_bytes)
         sync_time_stamp = snap.get('sync_time_stamp')
-        if isinstance(sync_time_stamp, (int, float)):
-            snap['sync_time_stamp'] = f'{sync_time_stamp:.6f}s'
+        if isinstance(sync_time_stamp, (int, float, str)):
+            snap['sync_time_stamp'] = format_epoch_timestamp(sync_time_stamp)
         out['last_synced_snap'] = _order_dict(
             snap, ('id', 'name', 'crawl_duration',
                    'datasync_queue_wait_duration', 'sync_duration',
@@ -146,6 +149,10 @@ def format_and_order_sync_stat_for_display(stat, policy=None, dir_path=None,
         out['current_syncing_snap'] = _order_current_syncing_snap(
             current_syncing_snap)
 
+    metrics_updated_at = out.get('metrics_updated_at')
+    if isinstance(metrics_updated_at, (int, float, str)):
+        out['metrics_updated_at'] = format_epoch_timestamp(metrics_updated_at)
+
     out.pop('_instance_id', None)
 
     return _order_dict(
index 09543a53a01f7f04cf564069f4f2b802ad7ab0c8..50497cf3535af96e7ce319cb6034b588bfa48c4e 100644 (file)
@@ -3816,10 +3816,8 @@ void PeerReplayer::dump_sync_stat(Formatter *f, const SnapSyncStat &sync_stat) {
       f->dump_string("sync_duration", format_time(*sync_stat.last_sync_duration));
     }
     if (!sync_stat.last_synced.is_zero()) {
-      std::ostringstream os;
-      os << std::fixed << std::setprecision(6)
-         << static_cast<double>(sync_stat.last_synced);
-      f->dump_string("sync_time_stamp", os.str() + "s");
+      // ISO-8601 local time with offset (matches utime_t::localtime / mgr format)
+      f->dump_string("sync_time_stamp", stringify(sync_stat.last_synced));
     }
     if (sync_stat.last_sync_bytes) {
       f->dump_string("sync_bytes", format_bytes(*sync_stat.last_sync_bytes));