Additional span logging of counter state; trace logging of contents.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::sync::Arc;
|
||||
use std::{ops::Range, sync::Arc};
|
||||
|
||||
use tokio::sync::{watch, watch::Sender};
|
||||
use tuwunel_core::{
|
||||
@@ -53,7 +53,7 @@ impl Data {
|
||||
.wait_for(|retired| retired.ge(count))
|
||||
.await
|
||||
.map(|retired| *retired)
|
||||
.map_err(|e| err!("counter channel error {e:?}"))
|
||||
.map_err(|e| err!(debug_error!("counter channel error {e:?}")))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -66,6 +66,9 @@ impl Data {
|
||||
#[inline]
|
||||
pub fn current_count(&self) -> u64 { self.counter.current() }
|
||||
|
||||
#[inline]
|
||||
pub fn pending_count(&self) -> Range<u64> { self.counter.range() }
|
||||
|
||||
fn handle_retire(sender: &Sender<u64>, count: u64) -> Result {
|
||||
let _prev = sender.send_replace(count);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ mod data;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fmt::Write,
|
||||
ops::Range,
|
||||
sync::{Arc, RwLock},
|
||||
time::Instant,
|
||||
};
|
||||
@@ -105,22 +106,40 @@ impl crate::Service for Service {
|
||||
|
||||
impl Service {
|
||||
#[inline]
|
||||
#[tracing::instrument(level = "trace", skip(self))]
|
||||
#[tracing::instrument(
|
||||
level = "trace",
|
||||
skip_all,
|
||||
ret,
|
||||
fields(pending = ?self.pending_count()),
|
||||
)]
|
||||
pub async fn wait_pending(&self) -> Result<u64> { self.db.wait_pending().await }
|
||||
|
||||
#[inline]
|
||||
#[tracing::instrument(level = "trace", skip(self))]
|
||||
#[tracing::instrument(
|
||||
level = "trace",
|
||||
skip_all,
|
||||
ret,
|
||||
fields(pending = ?self.pending_count()),
|
||||
)]
|
||||
pub async fn wait_count(&self, count: &u64) -> Result<u64> { self.db.wait_count(count).await }
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[tracing::instrument(level = "debug", skip(self))]
|
||||
#[tracing::instrument(
|
||||
level = "debug",
|
||||
skip_all,
|
||||
fields(pending = ?self.pending_count()),
|
||||
)]
|
||||
pub fn next_count(&self) -> data::Permit { self.db.next_count() }
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn current_count(&self) -> u64 { self.db.current_count() }
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn pending_count(&self) -> Range<u64> { self.db.pending_count() }
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn server_name(&self) -> &ServerName { self.server.name.as_ref() }
|
||||
|
||||
Reference in New Issue
Block a user