Skip to content

Commit

Permalink
Add new grafana dashboard for agent memory metrics (#2279)
Browse files Browse the repository at this point in the history
* add new dashboard for agent memory

Signed-off-by: Kosuke Morimoto <ksk@vdaas.org>

* bugfix

Signed-off-by: Kosuke Morimoto <ksk@vdaas.org>

---------

Signed-off-by: Kosuke Morimoto <ksk@vdaas.org>
Co-authored-by: Yusuke Kato <kpango@vdaas.org>
  • Loading branch information
kmrmt and kpango committed Dec 27, 2023
1 parent 78bd472 commit dd2c92b
Show file tree
Hide file tree
Showing 3 changed files with 4,058 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/observability/metrics/mem/mem.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,13 +600,15 @@ func (mm *memMetrics) Register(m metrics.Meter) error {
return m.RegisterCallback(
instruments,
func(ctx context.Context) {
var mstats runtime.MemStats
runtime.ReadMemStats(&mstats)
metrics := getMemstatsMetrics()
if m, err := getProcStatusMetrics(mm.pid); err == nil {
metrics = append(metrics, m...)
}

for i, instrument := range instruments {
g, ok := instrument.(asyncint64.Gauge)
if ok {
g.Observe(ctx, mInfo[i].Value())
g.Observe(ctx, metrics[i].Value())
}
}
},
Expand Down
Loading

0 comments on commit dd2c92b

Please sign in to comment.