extend cluster topic metrics cleanup to cover all per-topic metric families#8564
Conversation
…milies Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| nc.rateLimitedUnicastMessagesCount.DeletePartialMatch(prometheus.Labels{LabelChannel: topic}) | ||
|
|
||
| // ALSP misbehavior counter (multi-label: channel + misbehavior) | ||
| nc.AlspMetrics.reportedMisbehaviorCount.DeletePartialMatch(prometheus.Labels{LabelChannel: topic}) |
There was a problem hiding this comment.
Instead of calling private method, it's better to create a public method for AlspMetrics, and calling that.
// In alsp.go
func (a *AlspMetrics) OnClusterTopicMetricsCleanup(topic string) {
a.reportedMisbehaviorCount.DeletePartialMatch(prometheus.Labels{LabelChannel: topic})
}
There was a problem hiding this comment.
made the change (through Claude).
…essing private field Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends #8562 to address remaining per-topic metrics that also accumulate stale cluster-ID-based label series across epoch transitions.
Problem
PR #8562 introduced
OnClusterTopicMetricsCleanupbut only covered a subset of the per-topic metrics tracked byNetworkCollector. The following metric families were missed and continue to accumulate stale time series when a collection node transitions to a new cluster each epoch:gossipsub_time_in_mesh_quantum_countGossipSubScoreMetricsgossipsub_mesh_message_deliveryGossipSubScoreMetricsgossipsub_first_message_delivery_countGossipSubScoreMetricsgossipsub_invalid_message_delivery_countGossipSubScoreMetricscurrent_messages_processingNetworkCollectordirect_messages_in_progressNetworkCollectorengine_message_processing_time_secondsNetworkCollectorunauthorized_messages_countNetworkCollectorrate_limited_unicast_messages_countNetworkCollectorreported_misbehavior_totalAlspMetricsChanges
gossipsub_score.go: addsOnClusterTopicMetricsCleanuptoGossipSubScoreMetricscovering the 4 per-topic scoring histogramsnetwork.go: extendsNetworkCollector.OnClusterTopicMetricsCleanupto also delegate toGossipSubScoreMetricsand delete the remaining per-channel metrics onNetworkCollectorandAlspMetricsNo new interfaces or mock changes needed —
GossipSubScoreMetrics.OnClusterTopicMetricsCleanupis called internally byNetworkCollectorand is not part of any exported interface.🤖 Generated with Claude Code