Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): Add maxPodLogsToRender setting (#9131) #14617

Merged

Conversation

lukaszgyg
Copy link
Contributor

@lukaszgyg lukaszgyg commented Jul 20, 2023

This PR is adding the configurable maxPodLogsToRender . This will allow the Argo-CD administrators to allow higher number of pods logs to be rendered in UI and avoid the rpc error: code = Unknown desc = Max pods to view logs are reached. Please provide more granular query. error as described in the issue #9131.
Closes ISSUE #9131

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.

Please see Contribution FAQs if you have questions about your pull-request.

@lukaszgyg lukaszgyg changed the title Add maxPodLogsToRender setting feat(server): Add maxPodLogsToRender setting Jul 20, 2023
@lukaszgyg lukaszgyg changed the title feat(server): Add maxPodLogsToRender setting feat(server): Add maxPodLogsToRender setting (#9131) Jul 20, 2023
@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Attention: Patch coverage is 14.28571% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 49.40%. Comparing base (05eea87) to head (3a8d1df).
Report is 48 commits behind head on master.

❗ Current head 3a8d1df differs from pull request most recent head 918b25c. Consider uploading reports for the commit 918b25c to get more accurate results

Files Patch % Lines
util/settings/settings.go 0.00% 14 Missing and 1 partial ⚠️
server/application/application.go 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #14617      +/-   ##
==========================================
- Coverage   49.44%   49.40%   -0.05%     
==========================================
  Files         273      272       -1     
  Lines       48662    47994     -668     
==========================================
- Hits        24063    23713     -350     
+ Misses      22237    21930     -307     
+ Partials     2362     2351      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lukaszgyg lukaszgyg force-pushed the add-maxPodLogsToRender-config branch from 0ae458d to f2db63e Compare July 20, 2023 12:53
@lukaszgyg lukaszgyg force-pushed the add-maxPodLogsToRender-config branch 4 times, most recently from 0eca40b to 7fbc3e6 Compare August 29, 2023 08:13
@lukaszgyg lukaszgyg marked this pull request as ready for review August 29, 2023 09:33
@@ -1569,8 +1569,13 @@ func (s *Server) PodLogs(q *application.ApplicationPodLogsQuery, ws application.
return nil
}

if len(pods) > maxPodLogsToRender {
return errors.New("Max pods to view logs are reached. Please provide more granular query.")
Copy link
Member

Choose a reason for hiding this comment

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

this is the root error that ends up in the argocd throwing 500 error responses.

while I agree having a configurable limit may mitigate this to some extent, can we also solve the generic case and treat this error differently?

a 4xx response may be more fitted.

Copy link
Contributor Author

@lukaszgyg lukaszgyg Aug 29, 2023

Choose a reason for hiding this comment

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

As specifying the log query will fix the problem I took the codes.InvalidArgument which will be transformed to http.StatusBadRequest

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the variable should be removed here also?

maxPodLogsToRender = 10

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @Jellyfrog for a good catch! I removed unused const.

@alexef alexef added the enhancement New feature or request label Aug 29, 2023
@lukaszgyg lukaszgyg force-pushed the add-maxPodLogsToRender-config branch from 7fbc3e6 to 7b334d2 Compare August 29, 2023 14:29
@lukaszgyg lukaszgyg force-pushed the add-maxPodLogsToRender-config branch 2 times, most recently from 6d85293 to 09e4113 Compare August 29, 2023 16:20
@lukaszgyg
Copy link
Contributor Author

@leoluz I updated my PR base on your suggestion from the ArgoCD contributor meeting. Can you take a look?

server/application/application_test.go Show resolved Hide resolved
@lukaszgyg lukaszgyg force-pushed the add-maxPodLogsToRender-config branch from 40dca79 to cc161d1 Compare October 18, 2023 07:39
@lukaszgyg lukaszgyg requested review from a team as code owners October 18, 2023 07:39
@lukaszgyg lukaszgyg force-pushed the add-maxPodLogsToRender-config branch from cc161d1 to 2b80481 Compare October 18, 2023 07:39
@Naist4869
Copy link

Is there any progress? This will be my motivation to upgrade the ArgoCD version.

@lukaszgyg
Copy link
Contributor Author

Is there any progress? This will be my motivation to upgrade the ArgoCD version.

The implementation is done. I'm waiting for review.
@crenshaw-dev can you have a look?

@lukaszgyg lukaszgyg force-pushed the add-maxPodLogsToRender-config branch from 2b80481 to 76df5f0 Compare January 12, 2024 11:33
@lukaszgyg lukaszgyg requested a review from a team as a code owner January 12, 2024 11:33
@lukaszgyg lukaszgyg force-pushed the add-maxPodLogsToRender-config branch from 76df5f0 to 3a8d1df Compare January 12, 2024 11:36
Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

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

LGTM!!

@crenshaw-dev crenshaw-dev merged commit 614f44c into argoproj:master Apr 3, 2024
27 checks passed
mkieweg pushed a commit to mkieweg/argo-cd that referenced this pull request Jun 11, 2024
Hariharasuthan99 pushed a commit to AmadeusITGroup/argo-cd that referenced this pull request Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready-for-review
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Make maxPodLogsToRender configurable
6 participants