build.go 943 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package build
  2. import (
  3. "runtime"
  4. "github.com/prometheus/common/version"
  5. prom "github.com/prometheus/prometheus/web/api/v1"
  6. )
  7. // Version information passed to Prometheus version package.
  8. // Package path as used by linker changes based on vendoring being used or not,
  9. // so it's easier just to use stable Loki path, and pass it to
  10. // Prometheus in the code.
  11. var (
  12. Version string
  13. Revision string
  14. Branch string
  15. BuildUser string
  16. BuildDate string
  17. GoVersion string
  18. )
  19. func init() {
  20. version.Version = Version
  21. version.Revision = Revision
  22. version.Branch = Branch
  23. version.BuildUser = BuildUser
  24. version.BuildDate = BuildDate
  25. version.GoVersion = runtime.Version()
  26. }
  27. func GetVersion() prom.PrometheusVersion {
  28. return prom.PrometheusVersion{
  29. Version: version.Version,
  30. Revision: version.Revision,
  31. Branch: version.Branch,
  32. BuildUser: version.BuildUser,
  33. BuildDate: version.BuildDate,
  34. GoVersion: version.GoVersion,
  35. }
  36. }