fixup golang std metrics

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-04-04 16:36:48 +03:00
parent 4cd610a474
commit 1862ee5380
2 changed files with 17 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"hash/fnv"
"io"
"regexp"
"sync"
"time"
@@ -280,8 +281,10 @@ func (m *prometheusMeter) Write(w io.Writer, opts ...options.Option) error {
}
if options.WriteProcessMetrics || options.WriteFDMetrics {
c := collectors.NewProcessCollector(collectors.ProcessCollectorOpts{})
_ = m.set.Register(c)
pc := collectors.NewProcessCollector(collectors.ProcessCollectorOpts{})
_ = m.set.Register(pc)
gc := collectors.NewGoCollector(collectors.WithGoCollectorRuntimeMetrics(collectors.GoRuntimeMetricsRule{Matcher: regexp.MustCompile("/.*")}))
_ = m.set.Register(gc)
}
g, ok := m.set.(prometheus.Gatherer)