From 77aba226f458ec2b48d6f231405e355968850a96 Mon Sep 17 00:00:00 2001 From: jlizen Date: Wed, 23 Apr 2025 20:45:01 +0000 Subject: [PATCH 1/3] chore: Add CONTRIBUTING.md with info on testing docs.rs docs --- .gitignore | 1 + CONTRIBUTING.md | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/.gitignore b/.gitignore index 96ef6c0..eb1d4ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target Cargo.lock +.vscode \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e90a1c3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,20 @@ +## How to test docs.rs changes + +Set up your local docs.rs environment as per official README: +https://github.com/rust-lang/docs.rs?tab=readme-ov-file#getting-started + +Make sure you have: +- Your .env contents exported +- docker-compose for db and s3 running +- The web server running via local (or pure docker-compose approach) +- If on a remote machine, port 3000 (or whatever your webserver is listening on) forwarded + +Invoke the build command against your local path: + +``` +# you could also point to the `cratesfyi` binary from outside of the docker workspace, +# though you'll still need the right ENVs exported +cargo run -- build crate --local ../tokio-metrics +``` + +View the generated documentation for `tokio-metrics` in your browser \ No newline at end of file From e4cd6b6a1c9f1f16c8e4418b558f331796eb8829 Mon Sep 17 00:00:00 2001 From: jlizen Date: Wed, 23 Apr 2025 20:50:40 +0000 Subject: [PATCH 2/3] fix: rt: in docs.rs, lists metrics-rs-integration feature dependency --- src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3bf4ec7..3eefdf5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -169,9 +169,14 @@ cfg_rt! { RuntimeMetrics, RuntimeMonitor, }; - #[cfg(feature = "metrics-rs-integration")] - pub use runtime::metrics_rs_integration::{RuntimeMetricsReporterBuilder, RuntimeMetricsReporter}; } +#[cfg(all(tokio_unstable, feature = "rt", feature = "metrics-rs-integration"))] +#[cfg_attr( + docsrs, + doc(cfg(all(tokio_unstable, feature = "rt", feature = "metrics-rs-integration"))) +)] +pub use runtime::metrics_rs_integration::{RuntimeMetricsReporter, RuntimeMetricsReporterBuilder}; + mod task; pub use task::{Instrumented, TaskMetrics, TaskMonitor}; From f5290054eada1be93a5399ffbbea2d30fd505d09 Mon Sep 17 00:00:00 2001 From: jlizen Date: Wed, 23 Apr 2025 20:50:45 +0000 Subject: [PATCH 3/3] chore: clean up unecessary docs.rs annotations in runtime.rs --- src/runtime.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/runtime.rs b/src/runtime.rs index a21e81c..ea5002e 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -4,8 +4,6 @@ use tokio::runtime; #[cfg(feature = "metrics-rs-integration")] pub(crate) mod metrics_rs_integration; -#[cfg(any(docsrs, all(tokio_unstable, feature = "rt")))] -#[cfg_attr(docsrs, doc(cfg(all(tokio_unstable, feature = "rt"))))] /// Monitors key metrics of the tokio runtime. /// /// ### Usage @@ -53,8 +51,6 @@ pub struct RuntimeMonitor { runtime: runtime::RuntimeMetrics, } -#[cfg(any(docsrs, all(tokio_unstable, feature = "rt")))] -#[cfg_attr(docsrs, doc(cfg(all(tokio_unstable, feature = "rt"))))] /// Key runtime metrics. #[non_exhaustive] #[derive(Default, Debug, Clone)]