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

Runtime configurable custom build_info details #175

Open
nstinus opened this issue May 9, 2024 · 2 comments
Open

Runtime configurable custom build_info details #175

nstinus opened this issue May 9, 2024 · 2 comments

Comments

@nstinus
Copy link

nstinus commented May 9, 2024

Hello,

In a few projects I routinely already get access to the git describe that contains the version, sha and dirtiness of the repo. This is typically passed to clap to display a useful --version.
Seems like autometrics pulls its info out of compile-time environment variables. It would be very helpful if it could be set during init instead. You could allow arbitrary keys at that stage so that many more information can be included. Not just branch and sha.

What do you think?

@gagbo
Copy link
Member

gagbo commented May 13, 2024

Hello,

I think we could provide a few more knobs to the init or the SettingsBuilder structure to handle more customization. But there’s just one thing I didn’t understand: you say that you use git describe to create a --version command.

Are you shelling out to git describe when you call --version on your binary? That seems pretty dangerous, as it’s easy to have the compiled binary diverge from the state of the repository. And if you’re just shelling out to git describe in the build.rs phase of your script, then we should be able to access the version info at compile time anyway. So there must be something I did not understand.

With that being said, I think that the rust version of Autometrics doesn’t support yet setting the monitored code version in the metrics (I might be mistaken, I mostly worked on the Go version and I will need some time to delve again into this)

@nstinus
Copy link
Author

nstinus commented May 28, 2024

No, I an using the git-version crate.

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

No branches or pull requests

2 participants