Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

39 linhas
1.2 KiB

  1. // Copyright 2021 The Prometheus Authors
  2. // Licensed under the Apache License, Version 2.0 (the "License");
  3. // you may not use this file except in compliance with the License.
  4. // You may obtain a copy of the License at
  5. //
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. package prometheus
  14. import "runtime/debug"
  15. // NewBuildInfoCollector is the obsolete version of collectors.NewBuildInfoCollector.
  16. // See there for documentation.
  17. //
  18. // Deprecated: Use collectors.NewBuildInfoCollector instead.
  19. func NewBuildInfoCollector() Collector {
  20. path, version, sum := "unknown", "unknown", "unknown"
  21. if bi, ok := debug.ReadBuildInfo(); ok {
  22. path = bi.Main.Path
  23. version = bi.Main.Version
  24. sum = bi.Main.Sum
  25. }
  26. c := &selfCollector{MustNewConstMetric(
  27. NewDesc(
  28. "go_build_info",
  29. "Build information about the main Go module.",
  30. nil, Labels{"path": path, "version": version, "checksum": sum},
  31. ),
  32. GaugeValue, 1)}
  33. c.init(c.self)
  34. return c
  35. }