Skip to content

Fix logging for sharded deployments#2135

Open
AndrewChubatiuk wants to merge 1 commit intomasterfrom
fix-logging-for-sharded-deployments
Open

Fix logging for sharded deployments#2135
AndrewChubatiuk wants to merge 1 commit intomasterfrom
fix-logging-for-sharded-deployments

Conversation

@AndrewChubatiuk
Copy link
Copy Markdown
Contributor

@AndrewChubatiuk AndrewChubatiuk commented May 4, 2026

fixes #2134


Summary by cubic

Fix incorrect scaling logs for sharded vmagent and vmanomaly. Logs now only emit when the shard count changes and correctly label upscaling vs downscaling.

Written for commit e167c0e. Summary will update on new commits.

@AndrewChubatiuk AndrewChubatiuk requested a review from vrutkovs as a code owner May 4, 2026 09:39
@AndrewChubatiuk AndrewChubatiuk force-pushed the fix-logging-for-sharded-deployments branch from 9128450 to 2869c6e Compare May 4, 2026 09:39
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

@vrutkovs
Copy link
Copy Markdown
Collaborator

vrutkovs commented May 6, 2026

Maybe lets make it look like this:

	isUpscaling := false
	if prevCR.IsSharded() {
		isUpscaling = prevShardCount < shardCount
		if prevShardCount != shardCount {
			action := "downscaling"
			if isUpscaling {
				action = "upscaling"
			}
			logger.WithContext(ctx).Info(fmt.Sprintf("VMAgent shard %s from=%d to=%d", action, prevShardCount, shardCount))
		}
	}

@AndrewChubatiuk AndrewChubatiuk force-pushed the fix-logging-for-sharded-deployments branch from 2869c6e to eae53ad Compare May 6, 2026 18:30
@AndrewChubatiuk AndrewChubatiuk force-pushed the fix-logging-for-sharded-deployments branch from eae53ad to e167c0e Compare May 6, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wrong log "VMAgent shard downscaling from=2 to=2"

2 participants