Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions quinn-proto/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ use crate::{
};

mod transport;
#[cfg(feature = "qlog")]
pub use transport::QlogConfig;
pub use transport::{AckFrequencyConfig, IdleTimeout, MtuDiscoveryConfig, TransportConfig};
#[cfg(feature = "qlog")]
pub use transport::{QlogConfig, VantagePointType};

#[cfg(doc)]
pub use transport::DEFAULT_CONCURRENT_MULTIPATH_PATHS_WHEN_ENABLED;
Expand Down
27 changes: 21 additions & 6 deletions quinn-proto/src/config/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use std::{
#[cfg(feature = "qlog")]
use std::{io, sync::Mutex, time::Instant};

#[cfg(feature = "qlog")]
pub use qlog::VantagePointType;
#[cfg(feature = "qlog")]
use qlog::streamer::QlogStreamer;

Expand Down Expand Up @@ -703,6 +705,7 @@ pub struct QlogConfig {
title: Option<String>,
description: Option<String>,
start_time: Instant,
vantage_point: qlog::VantagePoint,
}

#[cfg(feature = "qlog")]
Expand Down Expand Up @@ -731,17 +734,24 @@ impl QlogConfig {
self
}

/// Vantage point for this trace
pub fn vantage_point(
&mut self,
vantage_point: VantagePointType,
name: Option<String>,
) -> &mut Self {
self.vantage_point.name = name;
self.vantage_point.ty = vantage_point;
self
}

/// Construct the [`QlogStream`] described by this configuration
pub fn into_stream(self) -> Option<QlogStream> {
use tracing::warn;

let writer = self.writer?;
let trace = qlog::TraceSeq::new(
qlog::VantagePoint {
name: None,
ty: qlog::VantagePointType::Unknown,
flow: None,
},
self.vantage_point,
self.title.clone(),
self.description.clone(),
Some(qlog::Configuration {
Expand All @@ -758,7 +768,7 @@ impl QlogConfig {
None,
self.start_time,
trace,
qlog::events::EventImportance::Core,
qlog::events::EventImportance::Extra,
writer,
);

Expand All @@ -780,6 +790,11 @@ impl Default for QlogConfig {
title: None,
description: None,
start_time: Instant::now(),
vantage_point: qlog::VantagePoint {
name: None,
ty: qlog::VantagePointType::Unknown,
flow: None,
},
}
}
}
Expand Down
Loading
Loading