MCPcopy Create free account
hub / github.com/cozystack/cozystack / report

Method report

internal/fluxshardoperator/controller.go:347–363  ·  view source on GitHub ↗

report refreshes the telemetry gauges.

(views map[string]*tenantView, desired map[string]string, shardCount, totalHRs, pending int)

Source from the content-addressed store, hash-verified

345
346// report refreshes the telemetry gauges.
347func (r *PlacementReconciler) report(views map[string]*tenantView, desired map[string]string, shardCount, totalHRs, pending int) {
348 shardLoadGauge.Reset()
349 load := map[string]int{}
350 for i := 0; i < shardCount; i++ {
351 load[ShardName(i)] = 0
352 }
353 for tenantNS, shard := range desired {
354 load[shard] += views[tenantNS].info.Weight
355 }
356 for shard, l := range load {
357 shardLoadGauge.WithLabelValues(shard).Set(float64(l))
358 }
359 tenantsGauge.Set(float64(len(views)))
360 helmReleasesGauge.Set(float64(totalHRs))
361 pendingMovesGauge.Set(float64(pending))
362 recommendedShardsGauge.Set(float64(RecommendedShardCount(totalHRs, len(views))))
363}
364
365// pruneCooldowns drops cooldown entries for tenants that no longer exist.
366func (r *PlacementReconciler) pruneCooldowns(views map[string]*tenantView) {

Callers 1

ReconcileMethod · 0.95

Calls 2

ShardNameFunction · 0.85
RecommendedShardCountFunction · 0.85

Tested by

no test coverage detected