feat: add goroutine count metric to the MetricService and update related files

This commit is contained in:
Marvin Zhang
2025-07-08 14:08:31 +08:00
parent 7e4187f388
commit 8bd3ef0b72
10 changed files with 39 additions and 11 deletions

View File

@@ -2,13 +2,14 @@ package notification
import (
"fmt"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/utils"
"regexp"
"strings"
"sync"
"time"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/utils"
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/entity"
"github.com/crawlab-team/crawlab/core/models/models"
@@ -471,6 +472,8 @@ func (svc *Service) getFormattedMetricValue(metricName string, m *models.Metric)
return fmt.Sprintf("%.2fMB/s", m.NetworkBytesSentRate/(1024*1024))
case "network_bytes_recv_rate":
return fmt.Sprintf("%.2fMB/s", m.NetworkBytesRecvRate/(1024*1024))
case "goroutine_count":
return fmt.Sprintf("%d", m.GoroutineCount)
default:
return "N/A"
}