diff --git a/routes/api/metrics.go b/routes/api/metrics.go index 6f5d8fea..28f1c39a 100644 --- a/routes/api/metrics.go +++ b/routes/api/metrics.go @@ -42,6 +42,8 @@ const ( DescMemAllocTotal = "Total number of bytes allocated for heap" DescMemSysTotal = "Total number of bytes obtained from the OS" + DescPausedTotal = "Total nanoseconds stop-the-world pause time due to GC" + DescNumGCTotal = "Total number of GC cycles" DescGoroutines = "Total number of running goroutines" DescDatabaseSize = "Total database size in bytes" ) @@ -245,6 +247,20 @@ func (h *MetricsHandler) getUserMetrics(user *models.User) (*mm.Metrics, error) Labels: []mm.Label{}, }) + metrics = append(metrics, &mm.CounterMetric{ + Name: MetricsPrefix + "_paused_total", + Desc: DescPausedTotal, + Value: int64(memStats.PauseTotalNs), + Labels: []mm.Label{}, + }) + + metrics = append(metrics, &mm.CounterMetric{ + Name: MetricsPrefix + "_num_gc_total", + Desc: DescNumGCTotal, + Value: int64(memStats.NumGC), + Labels: []mm.Label{}, + }) + // Database metrics dbSize, err := h.metricsRepo.GetDatabaseSize() if err != nil {