Skip to content

✨ improve logging: catalog http server, op-con resolver #1564

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

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

joelanford
Copy link
Member

Description

This adds more logging to help administrators troubleshoot issues resolving bundles from catalogs. Specifically, it:

  • Adds logging to the catalogd http server, so that all requests are logged with useful metadata about the request and response
  • Adds logging in the resolution code path to:
    • report with catalogs are included in the resolution
    • report whether the desired package is found in each catalog
    • report the total count of bundles and the matched count of bundles in each catalog

This should help administrators narrow down which stage of resolution should be investigated when unexpected resolution errors occur.

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@joelanford joelanford requested a review from a team as a code owner January 10, 2025 02:39
Copy link

netlify bot commented Jan 10, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 9bcd005
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/678e487d6e3dfb0008483074
😎 Deploy Preview https://deploy-preview-1564--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 53.22581% with 29 lines in your changes missing coverage. Please review.

Project coverage is 67.17%. Comparing base (594cba3) to head (9bcd005).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
catalogd/internal/serverutil/serverutil.go 0.00% 26 Missing ⚠️
internal/resolve/catalog.go 91.66% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1564      +/-   ##
==========================================
- Coverage   67.35%   67.17%   -0.18%     
==========================================
  Files          55       55              
  Lines        4555     4616      +61     
==========================================
+ Hits         3068     3101      +33     
- Misses       1261     1288      +27     
- Partials      226      227       +1     
Flag Coverage Δ
e2e 53.57% <91.66%> (+0.39%) ⬆️
unit 54.20% <53.22%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

camilamacedo86
camilamacedo86 previously approved these changes Jan 10, 2025
Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 10, 2025
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 10, 2025
@camilamacedo86
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 10, 2025
Comment on lines +92 to +94
if isFBCEmpty(packageFBC) {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This early exit did not exist before. Are we worried about a change in behavior?

Copy link
Member Author

Choose a reason for hiding this comment

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

Before, if len(packageFBC.Bundles) was 0, we would evaluate/run the predicates against a 0-length slice, which would return a 0-length slice, and then we'd return nil in line 103 (old) / line 124 (new)

So I don't think there's a behavior change here other than skipping some unnecessary predicate setup.

@@ -158,6 +179,7 @@ func (r *CatalogResolver) Resolve(ctx context.Context, ext *ocv1.ClusterExtensio

// Check for ambiguity
if len(resolvedBundles) != 1 {
l.Info("resolution failed", "stats", catStats)
Copy link
Contributor

@tmshort tmshort Jan 10, 2025

Choose a reason for hiding this comment

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

Do we want this before all error returns from this point forward?

Copy link
Member Author

@joelanford joelanford Jan 14, 2025

Choose a reason for hiding this comment

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

We could. I felt like those other returns include context in the error message that would make it possible to figure out what happened, so that's why I only included it here.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 14, 2025
@joelanford joelanford enabled auto-merge January 19, 2025 19:15
@joelanford joelanford disabled auto-merge January 19, 2025 19:15
if fbc == nil {
return true
}
return len(fbc.Packages) == 0 && len(fbc.Channels) == 0 && len(fbc.Bundles) == 0 && len(fbc.Deprecations) == 0 && len(fbc.Others) == 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @joelanford

IHMO IsEmpty should be implemented in DeclarativeConfig itself. However, that is not a blocker for us to move forward here.

camilamacedo86
camilamacedo86 previously approved these changes Jan 19, 2025
Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

I think it is good enough for us move forward

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 19, 2025
@joelanford joelanford added this pull request to the merge queue Jan 20, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jan 20, 2025
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 20, 2025
@tmshort
Copy link
Contributor

tmshort commented Jan 21, 2025

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2025
@tmshort tmshort enabled auto-merge January 21, 2025 16:02
Copy link
Contributor

@tmshort tmshort left a comment

Choose a reason for hiding this comment

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

LGTM

@tmshort tmshort added this pull request to the merge queue Jan 21, 2025
Merged via the queue into operator-framework:main with commit a19f91a Jan 21, 2025
22 of 24 checks passed
@joelanford joelanford deleted the better-logging branch January 21, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants