tracing_attributes_hyper/lib.rs
1//! Procedural macro attributes for instrumenting functions with [`tracing`], in
2//! HTTP use cases, following the [`opentelemetry`] conventions.
3//!
4use proc_macro::TokenStream;
5use proc_macro_error::proc_macro_error;
6
7/// Add tracing instrumentation attribute: Server-Send
8///
9/// # Example
10///
11/// ```ignore
12/// use tracing_attributes_hyper::*;
13///
14/// #[server_send(level = tracing::Level::TRACE, name = "Server::encode", skip = [dst, msg])]
15/// fn encode(mut msg: Encode<'_, Self::Outgoing>, dst: &mut Vec<u8>) -> crate::Result<Encoder> {
16/// // ...
17/// }
18/// ```
19///
20///
21#[allow(unused_variables)]
22#[proc_macro_attribute]
23#[proc_macro_error]
24pub fn server_send(metadata: TokenStream, item: TokenStream) -> TokenStream {
25 // let rust = quote::quote! {
26 // panic!("This macro is a placeholder for a tracing attribute plugin. See the `examples` folder of the tracing-attributes-hyper crate.");
27 // };
28 // rust.into()
29 item
30}