diff options
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/stats.rs | 4 | ||||
| -rw-r--r-- | src/api/stats/prometheus.rs | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/api/stats.rs b/src/api/stats.rs index 90b4fc2..37a7447 100644 --- a/src/api/stats.rs +++ b/src/api/stats.rs @@ -101,6 +101,9 @@ struct DocumentStats { saved_bytes_secs_ago: Option<u64>, /// How long the last measurement took (copy and save), in milliseconds. saved_bytes_took_ms: Option<u64>, + /// Writers (Automerge actors: a node's run each) with changes in the document, + /// counted with `saved_bytes`; absent until first counted. + writers: Option<usize>, /// How long takers of the document's lock waited for it, since start: the node's /// work on the one document queues there. lock_wait: crate::document::lock::LockWaits, @@ -360,6 +363,7 @@ pub(crate) async fn collect(state: &AppState, list: &PeerListResponse) -> StatsR saved_bytes: saved.map(|s| s.bytes), saved_bytes_secs_ago: saved.map(|s| s.at.elapsed().as_secs()), saved_bytes_took_ms: saved.map(|s| s.took.as_millis() as u64), + writers: saved.and_then(|s| s.writers), lock_wait: state.doc.waits(), }, catch_up: CatchUpStats { diff --git a/src/api/stats/prometheus.rs b/src/api/stats/prometheus.rs index 0d79d2c..ca3f1af 100644 --- a/src/api/stats/prometheus.rs +++ b/src/api/stats/prometheus.rs @@ -460,6 +460,14 @@ pub(super) fn render(stats: &StatsResponse, list: &PeerListResponse) -> String { "Most heads after applying a sync message, since start.", document.max_heads as f64, ); + if let Some(writers) = document.writers { + out.single( + "document_writers", + "gauge", + "Writers (Automerge actors, a node's run each) with changes in the document; counted in the background.", + writers as f64, + ); + } if let Some(bytes) = document.saved_bytes { out.single( "document_saved_bytes", |
