Skip to content

Commit

Permalink
Merge pull request #521 from cheney-lin/dev/metric
Browse files Browse the repository at this point in the history
chore(*): add metric
  • Loading branch information
luomingmeng authored Mar 26, 2024
2 parents c10d1d1 + 71a9c10 commit 58177dd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/agent/resourcemanager/fetcher/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ const healthzNameReporterFetcherReady = "ReporterFetcherReady"
const healthzGracePeriodMultiplier = 3

const (
metricsNameGetContentCost = "reporter_get_content_cost"
metricsNameGenericSyncCost = "reporter_generic_sync_cost"
metricsNameGetContentCost = "reporter_get_content_cost"
metricsNameGetContentPluginCost = "reporter_get_content_plugin_cost"
metricsNameGenericSyncCost = "reporter_generic_sync_cost"
)

// ReporterPluginManager is used to manage in-tree or out-tree reporter plugin registrations and
Expand Down Expand Up @@ -392,6 +393,7 @@ func (m *ReporterPluginManager) getReportContent(cacheFirst bool) map[string]*v1
resp, err = e.GetReportContent(ctx)
epCosts := time.Since(epBegin)
klog.InfoS("GetReportContent", "costs", epCosts, "pluginName", pluginName)
_ = m.emitter.StoreInt64(metricsNameGetContentPluginCost, epCosts.Microseconds(), metrics.MetricTypeNameRaw, []metrics.MetricTag{{Key: "plugin", Val: pluginName}}...)
if err != nil {
s, _ := status.FromError(err)
_ = m.emitter.StoreInt64("reporter_plugin_get_content_failed", 1, metrics.MetricTypeNameCount, []metrics.MetricTag{
Expand Down

0 comments on commit 58177dd

Please sign in to comment.