Skip to content

Fix logging for sharded deployments#2135

Merged
vrutkovs merged 1 commit into
masterfrom
fix-logging-for-sharded-deployments
May 12, 2026
Merged

Fix logging for sharded deployments#2135
vrutkovs merged 1 commit into
masterfrom
fix-logging-for-sharded-deployments

Conversation

@AndrewChubatiuk

@AndrewChubatiuk AndrewChubatiuk commented May 4, 2026

Copy link
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown
Contributor

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

vrutkovs commented May 6, 2026

Copy link
Copy Markdown
Collaborator

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
@vrutkovs vrutkovs merged commit e7f2845 into master May 12, 2026
6 checks passed
@vrutkovs vrutkovs deleted the fix-logging-for-sharded-deployments branch May 12, 2026 07:45
vrutkovs added a commit that referenced this pull request May 27, 2026
Co-authored-by: Vadim Rutkovsky <vadim@vrutkovs.eu>
Co-authored-by: Andrii Chubatiuk <andrew.chubatiuk@gmail.com>
Co-authored-by: Max Kotliar <mkotlyar@victoriametrics.com>
Co-authored-by: Nikolay <nik@victoriametrics.com>
Co-authored-by: Artem Fetishev <149964189+rtm0@users.noreply.github.com>
Signed-off-by: Max Kotliar <mkotlyar@victoriametrics.com>
Signed-off-by: Vadim Rutkovsky <vadim@vrutkovs.eu>
Signed-off-by: f41gh7 <nik@victoriametrics.com>
Signed-off-by: Artem Fetishev <rtm@victoriametrics.com>
Fix logging for sharded deployments (#2135)
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