Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable doc generation when AUTOMETRICS_DISABLE_DOCS env var is present #104

Merged
merged 2 commits into from
May 26, 2023

Conversation

emschwartz
Copy link
Contributor

Resolves #80

@emschwartz emschwartz requested review from arendjr and a team May 26, 2023 09:55
// 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 option_env!("AUTOMETRICS_DISABLE_DOCS").is_some() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

option_env! works at compile-time. Is that really what we want? I see PROMETHEUS_URL uses the regular env::var() function, which I think I would've expected here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I'm not sure it makes a difference because the macros are only run at compile time. But I can change it anyway

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I also found it hard to reason about what it means for something to be done at compile-time for a macro. Maybe avoiding the confusion is reason enough :)

@emschwartz emschwartz merged commit 6bceaf4 into main May 26, 2023
1 check passed
@emschwartz emschwartz deleted the disable-docs-gen branch May 26, 2023 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support AUTOMETRICS_DOCS_GEN=0 environment variable
2 participants