@@ -16,12 +16,12 @@ struct MainArgs {
1616const MISSING_CONFIG_HELP : & str = "missing required `config` argument, e.g.\n \
1717 #[dial9_tokio_telemetry::main(config = my_config_fn)]\n \
1818 or with an inline closure:\n \
19- #[dial9_tokio_telemetry::main(config = || Dial9Config::builder().base_path (...).max_total_size(...).build().unwrap())]";
19+ #[dial9_tokio_telemetry::main(config = || Dial9Config::builder().on_disk_buffer (...).max_total_size(...).build().unwrap())]";
2020
2121const CONFIG_MUST_BE_ZERO_ARG_HELP : & str = "`config` must be a zero-argument function path or a zero-argument closure, e.g.\n \
2222 #[dial9_tokio_telemetry::main(config = my_config_fn)]\n \
2323 or with an inline closure:\n \
24- #[dial9_tokio_telemetry::main(config = || Dial9Config::builder().base_path (...).max_total_size(...).build().unwrap())]";
24+ #[dial9_tokio_telemetry::main(config = || Dial9Config::builder().on_disk_buffer (...).max_total_size(...).build().unwrap())]";
2525impl Parse for MainArgs {
2626 fn parse ( input : ParseStream ) -> syn:: Result < Self > {
2727 if input. is_empty ( ) {
@@ -118,20 +118,19 @@ fn expand_main(args: MainArgs, input: ItemFn) -> Result<TokenStream2, syn::Error
118118/// * `config` — a zero-argument function path or a zero-argument closure
119119/// returning any value convertible into a `TracedRuntime`. In
120120/// practice that means one of:
121- /// - `Dial9Config` from `Dial9Config::builder().build()` (strict):
122- /// any builder validation or writer-I/O failure surfaces from
123- /// `.build()` as a `Dial9ConfigBuilderError`; runtime construction
121+ /// - `Dial9Config` from `Dial9Config::builder().on_disk_buffer(..)..build()`
122+ /// or `..in_memory_buffer()..build()` (strict): a writer-I/O failure surfaces
123+ /// from `.build()` as a `Dial9ConfigBuilderError`; runtime construction
124124/// under the macro panics on tokio-builder or telemetry-core I/O.
125- /// - `Dial9Config` from `Dial9Config::builder().build_or_disabled()`
126- /// (lenient): the same `Dial9Config` type, but validation and
127- /// writer-I/O failures are logged at `error!` and downgraded to a
128- /// disabled config that still preserves your `with_tokio`
129- /// configurators.
125+ /// - `Dial9Config` from `..build_or_disabled()` (lenient): the same
126+ /// `Dial9Config` type, but writer-I/O failures are logged at `error!`
127+ /// and downgraded to a disabled config that still preserves your
128+ /// `with_tokio` configurators.
130129/// - The deprecated positional `dial9_tokio_telemetry::config::Dial9Config`,
131130/// kept compatible via a bridge impl.
132131///
133- /// Use `.enabled(false)` on the builder to run without telemetry
134- /// while keeping your `with_tokio` configurators.
132+ /// Use `.enabled(false)` to run without telemetry while keeping your
133+ /// `with_tokio` configurators.
135134///
136135/// # Examples
137136///
@@ -142,7 +141,7 @@ fn expand_main(args: MainArgs, input: ItemFn) -> Result<TokenStream2, syn::Error
142141///
143142/// fn my_config() -> Dial9Config {
144143/// Dial9Config::builder()
145- /// .base_path ("/tmp/trace.bin")
144+ /// .on_disk_buffer ("/tmp/trace.bin")
146145/// .max_file_size(1024 * 1024)
147146/// .max_total_size(16 * 1024 * 1024)
148147/// .build()
@@ -164,7 +163,7 @@ fn expand_main(args: MainArgs, input: ItemFn) -> Result<TokenStream2, syn::Error
164163/// ```rust,ignore
165164/// #[dial9_tokio_telemetry::main(config = || {
166165/// Dial9Config::builder()
167- /// .base_path ("/tmp/trace.bin")
166+ /// .on_disk_buffer ("/tmp/trace.bin")
168167/// .max_file_size(1024 * 1024)
169168/// .max_total_size(16 * 1024 * 1024)
170169/// .build()
@@ -181,7 +180,7 @@ fn expand_main(args: MainArgs, input: ItemFn) -> Result<TokenStream2, syn::Error
181180/// ```rust,ignore
182181/// #[dial9_tokio_telemetry::main(config = || {
183182/// Dial9Config::builder()
184- /// .base_path ("/tmp/trace.bin")
183+ /// .on_disk_buffer ("/tmp/trace.bin")
185184/// .max_file_size(1024 * 1024)
186185/// .max_total_size(16 * 1024 * 1024)
187186/// .build_or_disabled()
@@ -197,6 +196,7 @@ fn expand_main(args: MainArgs, input: ItemFn) -> Result<TokenStream2, syn::Error
197196/// ```rust,ignore
198197/// #[dial9_tokio_telemetry::main(config = || {
199198/// Dial9Config::builder()
199+ /// .on_disk_buffer("/tmp/trace.bin")
200200/// .enabled(false)
201201/// .build()
202202/// .expect("config build failed")
@@ -205,6 +205,22 @@ fn expand_main(args: MainArgs, input: ItemFn) -> Result<TokenStream2, syn::Error
205205/// /* ... */
206206/// }
207207/// ```
208+ ///
209+ /// In-memory writer (no telemetry on disk), select it with `.in_memory_buffer()`.
210+ ///
211+ /// ```rust,ignore
212+ /// #[dial9_tokio_telemetry::main(config = || {
213+ /// Dial9Config::builder()
214+ /// .in_memory_buffer()
215+ /// .max_total_size(16 * 1024 * 1024)
216+ /// .with_runtime(|r| r.with_custom_pipeline(|p| p.pipe(MyUploader)))
217+ /// .build()
218+ /// .expect("config build failed")
219+ /// })]
220+ /// async fn main() {
221+ /// /* ... */
222+ /// }
223+ /// ```
208224#[ proc_macro_attribute]
209225pub fn main ( attr : TokenStream , item : TokenStream ) -> TokenStream {
210226 let args = parse_macro_input ! ( attr as MainArgs ) ;
0 commit comments