Repository navigation
fix: skip NoRows error logs for Argo CD status updates of unmanaged apps (#7095) - #7098
Open
prakash100198 wants to merge 1 commit into
Open
prakash100198 wants to merge 1 commit into
prakash100198 wants to merge 1 commit into
Conversation
Argo CD status events for applications with no Devtron CD pipeline or installed chart logged two error-level pg.ErrNoRows entries per update. No rows is the expected lookup result there, so log it at debug level and keep error logging for real lookup failures. Fixes #7095 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prakash100198
requested review from
prakarsh-dt and
vivek-devtron
as code owners
November 25, 2026 11:05
|
Bito Automatic Review Skipped - Branch Excluded |
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Fixes #7095
Enterprise counterpart (identical diff): https://github.com/devtron-labs/devtron-enterprise/pull/3453
Argo CD sends a status event for every application it manages, including ones Devtron doesn't manage (no CD pipeline and no installed chart with that name). Devtron correctly skips those updates, but it logged two error-level entries for every one of them:
On clusters with Argo CD apps outside Devtron, this fills the orchestrator log with false errors on every sync or refresh.
Cause: for an unmanaged app, the installed-app lookup by GitOps app name returns
pg.ErrNoRows, which is the expected result.InstalledAppReadService.GetInstalledAppByGitOpsAppNamelogged every lookup error at error level. TheAPPLICATION_STATUS_UPDATEhandler then logged the samepg.ErrNoRowsat error level again before returning.Fix:
pkg/appStore/installedApp/read/InstalledAppReadService.go:GetInstalledAppByGitOpsAppNameno longer logspg.ErrNoRows(matched witherrors.Is). It still returns(nil, err)unchanged, so every caller keeps its own no-rows handling. Other lookup errors (DB connection failure, multiple rows, …) are still logged at error level.pkg/eventProcessor/in/DeployedApplicationEventProcessorService.go: the status update handler matches no rows witherrors.Isand logs a debug line with the app name, then skips the update as before.Behaviour that does not change:
GetInstalledAppByGitOpsAppName, external Argo CD app link validation (ValidateIfAcdAppAlreadyLinked), already treats no rows as "not linked". Its API responses are unchanged; it only stops logging the same false error.How Has This Been Tested?
New unit test
pkg/appStore/installedApp/read/InstalledAppReadService_test.goforGetInstalledAppByGitOpsAppName:pg.ErrNoRows, andpg.ErrNoRowswrapped with%w: error returned unchanged, no error logpg.ErrMultiRows: error returned unchanged, error log with the app nameOn
developthe same test fails only on the two no-rows cases.End to end: a
developbuild and a build with this change ran against the same seeded Postgres and a local NATS. Argo CDApplicationDetailevents were published toAPPLICATION_STATUS_UPDATE, and the link validation API (POST /orchestrator/app/cd-pipeline/validate-link-request) was called.develop, 1 debug line with this changeinstalled_apps.active=false), of a chart on an inactive environment, and of a deleted CD pipeline: same result as aboveinstalled_appslookup failing (table made unavailable): error logs and early return. Identical on both builds.Across all cases, the only log differences are the two removed error lines and the added debug line, and the final database state is identical.
The tests above ran on the enterprise build, which contains these two files with the identical diff and the identical test file. This branch was not compiled locally.
Checklist:
Does this PR introduce a user-facing change?
🤖 Generated with Claude Code