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

Add prometheus env #56

Merged
merged 3 commits into from
Apr 29, 2024
Merged

Add prometheus env #56

merged 3 commits into from
Apr 29, 2024

Conversation

Neotamandua
Copy link
Member

@Neotamandua Neotamandua commented Apr 28, 2024

Closes #38

@Neotamandua Neotamandua marked this pull request as ready for review April 28, 2024 14:14
Comment on lines +82 to +88
/// Get a list of all environment variables used in the hdrop backend.
pub fn get_env_vars() -> Vec<String> {
ENV_VARS_BACKEND
.iter()
.map(|&var| var.to_uppercase())
.collect()
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't see this being used for anything, what's the purpose?

Copy link
Member Author

Choose a reason for hiding this comment

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

Given that hdrop-shared contains all formats for the API responses and requests, as well as the names of the metrics and the environment getters, it was a logical choice to include environment variables data in this crate. The objective is to minimize the maintenance required to update the environment variables across multiple tools. A metadata function has therefore been implemented that displays all available environment variables. This allows other programs to fetch these environment variables when using hdrop-shared as a dependency, thereby establishing it as the single source of truth

env_get!(cors_origin);
env_get!(single_file_limit_mb => usize);
env_get!(storage_provider);
macro_rules! env_and_const {
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer a name like map_env because it describes an action whereas env_and_const doesn't, but it's really not that important. Up to you if you wanna change it or not

Copy link
Member Author

Choose a reason for hiding this comment

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

That is a good suggestion. I will reconsider it later today. The term "generate" or "gen" could also be an appropriate choice.

@Neotamandua Neotamandua merged commit 1db8c76 into development Apr 29, 2024
6 checks passed
@Neotamandua Neotamandua deleted the add/prometheus_env branch April 29, 2024 15:36
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.

Expose metrics configuration through env
2 participants