hosts: add hostsfile as label for coredns_hosts_entries (#6801)
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
This commit is contained in:
parent
ae65f4e0c7
commit
e5945d2767
2 changed files with 2 additions and 2 deletions
|
@ -138,7 +138,7 @@ func (h *Hostsfile) readHosts() {
|
||||||
h.mtime = stat.ModTime()
|
h.mtime = stat.ModTime()
|
||||||
h.size = stat.Size()
|
h.size = stat.Size()
|
||||||
|
|
||||||
hostsEntries.WithLabelValues().Set(float64(h.inline.Len() + h.hmap.Len()))
|
hostsEntries.WithLabelValues(h.path).Set(float64(h.inline.Len() + h.hmap.Len()))
|
||||||
hostsReloadTime.Set(float64(stat.ModTime().UnixNano()) / 1e9)
|
hostsReloadTime.Set(float64(stat.ModTime().UnixNano()) / 1e9)
|
||||||
h.Unlock()
|
h.Unlock()
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ var (
|
||||||
Subsystem: "hosts",
|
Subsystem: "hosts",
|
||||||
Name: "entries",
|
Name: "entries",
|
||||||
Help: "The combined number of entries in hosts and Corefile.",
|
Help: "The combined number of entries in hosts and Corefile.",
|
||||||
}, []string{})
|
}, []string{"hostsfile"})
|
||||||
// hostsReloadTime is the timestamp of the last reload of hosts file.
|
// hostsReloadTime is the timestamp of the last reload of hosts file.
|
||||||
hostsReloadTime = promauto.NewGauge(prometheus.GaugeOpts{
|
hostsReloadTime = promauto.NewGauge(prometheus.GaugeOpts{
|
||||||
Namespace: plugin.Namespace,
|
Namespace: plugin.Namespace,
|
||||||
|
|
Loading…
Add table
Reference in a new issue