Skip to content

chore(policies): disable gRPC or event handlers by configuration + add metrics - #3287

Open
pbleser-oc wants to merge 1 commit into
opencloud-eu:mainfrom
pbleser-oc:chore/#1312-policies-event-handler-split
Open

chore(policies): disable gRPC or event handlers by configuration + add metrics#3287
pbleser-oc wants to merge 1 commit into
opencloud-eu:mainfrom
pbleser-oc:chore/#1312-policies-event-handler-split

Conversation

@pbleser-oc

@pbleser-oc pbleser-oc commented Aug 11, 2026

Copy link
Copy Markdown
Member

Description

In the scope of the broader issue #1312, this PR deals with performing those changes for the policies service, namely to add the ability to disable the gRPC API or to disable the events API handler by configuration.

Additionally, it also fixes the README, and adds metrics.

Related Issue

Motivation and Context

Details can be found in #1312

  • add the ability to disable the gRPC API handler (POLICIES_GRPC_DISABLED)
  • add the ability to disable the Events API handler (POLICIES_EVENTS_DISABLED)
  • add metrics
  • add support for specifying rego files via the environment variable POLICIES_ENGINE_FILES
  • for file paths specified in yaml or in POLICIES_ENGINE_FILES, support config: and data: path prefixes
  • fix typos in the documentation, and try to make it more clear
  • add metrics to the documentation
  • add a section for testing in the documentation
  • introduces a new top-level package pkg/metrics/ with utilities for metrics that are backported from the groupware branch, with unit tests

How Has This Been Tested?

Since there are currently no feature tests, it was tested by running the policies service and debugging into the runtime to verify the behaviour.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation added

@codacy-production

codacy-production Bot commented Aug 11, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 2 critical · 26 minor

Alerts:
⚠ 28 issues (≤ 0 issues of at least minor severity)

Results:
28 new issues

Category Results
Security 2 critical
CodeStyle 26 minor

View in Codacy

🟢 Metrics 36 complexity · 0 duplication

Metric Results
Complexity 36
Duplication 0

View in Codacy

🟢 Coverage 20.52% diff coverage · -0.02% coverage variation

Metric Results
Coverage variation -0.02% coverage variation (-1.00%)
Diff coverage 20.52% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (b2cf7a9) 84082 19347 23.01%
Head commit (5b58792) 84362 (+280) 19395 (+48) 22.99% (-0.02%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3287) 307 63 20.52%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@pbleser-oc pbleser-oc moved this from Qualification to In Progress in OpenCloud Team Board Aug 12, 2026
@pbleser-oc
pbleser-oc force-pushed the chore/#1312-policies-event-handler-split branch from 9f7cf9c to 0ad1242 Compare August 12, 2026 17:08
@pbleser-oc

Copy link
Copy Markdown
Member Author

The test failures actually did highlight a bug, will fix.

@pbleser-oc
pbleser-oc force-pushed the chore/#1312-policies-event-handler-split branch from f5f32aa to f135baf Compare August 13, 2026 10:10
…trics

 * add the ability to disable the gRPC API handler
   (POLICIES_GRPC_DISABLED)

 * add the ability to disable the Events API handler
   (POLICIES_EVENTS_DISABLED)

 * add metrics

 * add support for specifying rego files via the environment varirable
   POLICIES_ENGINE_FILES

 * for file paths specified in yaml or in POLICIES_ENGINE_FILES, support
   'config:' and 'data:' path prefixes

 * fix typos in the documentation, and try to make it more clear

 * add metrics to the documentation

 * add a section for testing in the documentation

 * introduces a new top-level package pkg/metrics/ with utilities for
   metrics that are backported from the groupware branch, with unit
   tests
@pbleser-oc
pbleser-oc force-pushed the chore/#1312-policies-event-handler-split branch from f135baf to 5b58792 Compare August 13, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant