sapcc / ntp_exporter

Prometheus exporter for NTP offset/stratum of a client
Apache License 2.0
50 stars 17 forks source link

Add ntp_build_info metric with version information #27

Closed lindhor closed 2 years ago

lindhor commented 2 years ago

Adds ntp_build_info metric with labels based on bininfo

Named metric build_info to be as compliant as possible with https://www.robustperception.io/exposing-the-software-version-to-prometheus/

closes #12

SuperSandro2000 commented 2 years ago

We are currently slowly migrating all our packages to use https://github.com/sapcc/go-api-declarations/blob/main/bininfo/bininfo.go instead of older custom code. It is very similar to bininfo but with some extra features and integrated into our unified build system scripts. Keppel switched to it in https://github.com/sapcc/keppel/commit/d587aad2db66d9165f18fe9a3849a68e9a7aff90 . It should be used here, too

lindhor commented 2 years ago

Thanks for reviewing. Actually I'm not sure if I understand what you would like me to do. The code already did use github.com/sapcc/go-api-declarations/bininfo Is it that you don't want me to store the result from the binInfo functions in a temp variable? I.e. this part?

var version = bininfo.VersionOr("unknown")
var buildDate = bininfo.BuildDateOr("unknown")
var revision = bininfo.CommitOr("unknown")

Please provide some more input on what you expect, I'm new to go...