Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Autometrics now provides a `tracing_subscriber::Layer` that makes the specific `Span` fields
available to the library, and autometrics will automatically attach those fields as exemplars
on the counter and histogram metrics
- `AUTOMETRICS_DISABLE_DOCS` environment variable can be set to disable doc comment generation
(this is mainly for use with editor extensions that generate doc comments themselves)

### Changed

Expand Down
8 changes: 6 additions & 2 deletions autometrics-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ fn instrument_function(args: &AutometricsArgs, item: ItemFn) -> Result<TokenStre
let prometheus_url =
env::var("PROMETHEUS_URL").unwrap_or_else(|_| DEFAULT_PROMETHEUS_URL.to_string());

// Build the documentation we'll add to the function's RustDocs
let metrics_docs = create_metrics_docs(&prometheus_url, &function_name, args.track_concurrency);
// Build the documentation we'll add to the function's RustDocs, unless it is disabled by the environment variable
let metrics_docs = if env::var("AUTOMETRICS_DISABLE_DOCS").is_ok() {
String::new()
} else {
create_metrics_docs(&prometheus_url, &function_name, args.track_concurrency)
};

// Type annotation to allow type inference to work on return expressions (such as `.collect()`), as
// well as prevent compiler type-inference from selecting the wrong branch in the `spez` macro later.
Expand Down