metrics.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package daemon
  2. import "github.com/docker/go-metrics"
  3. var (
  4. containerActions metrics.LabeledTimer
  5. imageActions metrics.LabeledTimer
  6. networkActions metrics.LabeledTimer
  7. engineVersion metrics.LabeledGauge
  8. engineCpus metrics.Gauge
  9. engineMemory metrics.Gauge
  10. healthChecksCounter metrics.Counter
  11. healthChecksFailedCounter metrics.Counter
  12. )
  13. func init() {
  14. ns := metrics.NewNamespace("engine", "daemon", nil)
  15. containerActions = ns.NewLabeledTimer("container_actions", "The number of seconds it takes to process each container action", "action")
  16. for _, a := range []string{
  17. "start",
  18. "changes",
  19. "commit",
  20. "create",
  21. "delete",
  22. } {
  23. containerActions.WithValues(a).Update(0)
  24. }
  25. networkActions = ns.NewLabeledTimer("network_actions", "The number of seconds it takes to process each network action", "action")
  26. engineVersion = ns.NewLabeledGauge("engine", "The version and commit information for the engine process", metrics.Unit("info"),
  27. "version",
  28. "commit",
  29. "architecture",
  30. "graph_driver", "kernel",
  31. "os",
  32. )
  33. engineCpus = ns.NewGauge("engine_cpus", "The number of cpus that the host system of the engine has", metrics.Unit("cpus"))
  34. engineMemory = ns.NewGauge("engine_memory", "The number of bytes of memory that the host system of the engine has", metrics.Bytes)
  35. healthChecksCounter = ns.NewCounter("health_checks", "The total number of health checks")
  36. healthChecksFailedCounter = ns.NewCounter("health_checks_failed", "The total number of failed health checks")
  37. imageActions = ns.NewLabeledTimer("image_actions", "The number of seconds it takes to process each image action", "action")
  38. metrics.Register(ns)
  39. }