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

bundle_failed_load_counter broken for bundles without revision #4822

Closed
jkbschmid opened this issue Jun 28, 2022 · 1 comment · Fixed by #4823
Closed

bundle_failed_load_counter broken for bundles without revision #4822

jkbschmid opened this issue Jun 28, 2022 · 1 comment · Fixed by #4823
Labels

Comments

@jkbschmid
Copy link
Contributor

Short description

At the moment, the bundle_failed_load_counter metric is broken for bundles without a revision field in their .manifest files.

To determine whether a bundle load failed and the bundle_failed_load_counter should be incremented, OPA currently uses bundle.Code and bundle.ActiveRevision:

if bundle.Code == "" && bundle.ActiveRevision != "" {

However, according to the docs, providing a .manifest file as well as specifying a revision is optional.

So if there's a bundle without a revision, bundle.ActiveRevision will be "" and OPA will always assume a bundle load failed and bundle_failed_load_counter will be incremented on every bundle load, regardless of success.

  • OPA version: main and v0.40
  • Prometheus bundle metrics enabled

Expected behavior

I'd expect bundle_failed_load_counter not to rely on the the revision of a bundle.
I'd be happy to provide a fix, e.g. like

if bundle.Code == "" && !bundle.LastSuccessfulActivation.IsZero() {
@jkbschmid jkbschmid added the bug label Jun 28, 2022
@srenatus
Copy link
Contributor

Sounds reasonable! It would be nice if you could contribute a fix. 👍

jkbschmid added a commit to jkbschmid/opa that referenced this issue Jun 28, 2022
..for bundles without a revision.
Fixes open-policy-agent#4822

Signed-off-by: Jakob Schmid <jkbschmid@github.com>
srenatus pushed a commit that referenced this issue Jun 28, 2022
...for bundles without a revision.

Fixes #4822.

Signed-off-by: Jakob Schmid <jkbschmid@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants